Skip to content

Commit

Permalink
Merge branch 'master' into CpuTaskAndThreadType
Browse files Browse the repository at this point in the history
  • Loading branch information
fspadoni authored Apr 2, 2019
2 parents 0acdde1 + 9cbb775 commit 0499ddc
Show file tree
Hide file tree
Showing 76 changed files with 1,003 additions and 707 deletions.
2 changes: 1 addition & 1 deletion SofaKernel/framework/sofa/core/DataTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace core
void update() override { m_updateCallback( this ); }

/// This method is needed by DDGNode
const std::string& getName() const
const std::string& getName() const override
{
static const std::string emptyName ="";
return emptyName;
Expand Down
14 changes: 7 additions & 7 deletions SofaKernel/framework/sofa/core/ObjectFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ class ObjectCreator : public ObjectFactory::Creator
public:
bool canCreate(objectmodel::BaseContext* context, objectmodel::BaseObjectDescription* arg) override
{
RealObject* instance = NULL;
RealObject* instance = nullptr;
return RealObject::canCreate(instance, context, arg);
}
objectmodel::BaseObject::SPtr createInstance(objectmodel::BaseContext* context, objectmodel::BaseObjectDescription* arg)
objectmodel::BaseObject::SPtr createInstance(objectmodel::BaseContext* context, objectmodel::BaseObjectDescription* arg) override
{
RealObject* instance = NULL;
RealObject* instance = nullptr;
return RealObject::create(instance, context, arg);
}
const std::type_info& type()
const std::type_info& type() override
{
return typeid(RealObject);
}
Expand All @@ -230,9 +230,9 @@ class ObjectCreator : public ObjectFactory::Creator
return RealObject::HeaderFileLocation();
}

virtual std::string shortName(objectmodel::BaseObjectDescription* arg)
virtual std::string shortName(objectmodel::BaseObjectDescription* arg) override
{
RealObject* instance = NULL;
RealObject* instance = nullptr;
return RealObject::shortName(instance,arg);
}

Expand Down Expand Up @@ -289,7 +289,7 @@ class SOFA_CORE_API RegisterObject
template<class RealObject>
RegisterObject& add(bool defaultTemplate=false)
{
RealObject* p = NULL;
RealObject* p = nullptr;
std::string classname = RealObject::className(p);
std::string templatename = RealObject::templateName(p);

Expand Down
4 changes: 2 additions & 2 deletions SofaKernel/framework/sofa/core/collision/Intersection.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public:
{
Model1* m1 = static_cast<Model1*>(model1);
Model2* m2 = static_cast<Model2*>(model2);
if (contacts == NULL)
if (contacts == nullptr)
{
contacts = impl->createOutputVector(m1,m2);
}
Expand All @@ -70,7 +70,7 @@ public:
return impl->computeIntersection(e1, e2, impl->getOutputVector(e1.getCollisionModel(), e2.getCollisionModel(), contacts));
}

std::string name() const
std::string name() const override
{
return sofa::helper::gettypename(typeid(Elem1))+std::string("-")+sofa::helper::gettypename(typeid(Elem2));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class NarrowPhaseDetection : virtual public Detection
m_outputsMap.swap(m_storedOutputsMap[inst]);
}

private:
protected:
std::map<Instance, DetectionOutputMap> m_storedOutputsMap;

protected:
Expand Down
20 changes: 10 additions & 10 deletions SofaKernel/framework/sofa/core/objectmodel/BaseData.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class SOFA_CORE_API BaseData : public DDGNode
/// @{

/// Set one of the flags.
void setFlag(DataFlagsEnum flag, bool b) { if(b) m_dataFlags |= (DataFlags)flag; else m_dataFlags &= ~(DataFlags)flag; }
void setFlag(DataFlagsEnum flag, bool b) { if(b) m_dataFlags |= static_cast<DataFlags>(flag); else m_dataFlags &= ~static_cast<DataFlags>(flag); }

/// Get one of the flags.
bool getFlag(DataFlagsEnum flag) const { return (m_dataFlags&(DataFlags)flag)!=0; }
bool getFlag(DataFlagsEnum flag) const { return (m_dataFlags&static_cast<DataFlags>(flag))!=0; }

/// Return whether this %Data has to be displayed in GUIs.
bool isDisplayed() const { return getFlag(FLAG_DISPLAYED); }
Expand Down Expand Up @@ -236,7 +236,7 @@ class SOFA_CORE_API BaseData : public DDGNode
}

/// Return the name of this %Data within the Base component
const std::string& getName() const { return m_name; }
const std::string& getName() const override { return m_name; }
/// Set the name of this %Data.
///
/// This method should not be called directly, the %Data registration methods in Base should be used instead.
Expand All @@ -249,17 +249,17 @@ class SOFA_CORE_API BaseData : public DDGNode
/// True if the value has been modified
/// If this data is linked, the value of this data will be considered as modified
/// (even if the parent's value has not been modified)
bool isSet(const core::ExecParams* params=nullptr) const { return m_isSets[currentAspect(params)]; }
bool isSet(const core::ExecParams* params=nullptr) const { return m_isSets[static_cast<size_t>(currentAspect(params))]; }

/// Reset the isSet flag to false, to indicate that the current value is the default for this %Data.
void unset(const core::ExecParams* params=nullptr) { m_isSets[currentAspect(params)] = false; }
void unset(const core::ExecParams* params=nullptr) { m_isSets[static_cast<size_t>(currentAspect(params))] = false; }

/// Reset the isSet flag to true, to indicate that the current value has been modified.
void forceSet(const core::ExecParams* params=nullptr) { m_isSets[currentAspect(params)] = true; }
void forceSet(const core::ExecParams* params=nullptr) { m_isSets[static_cast<size_t>(currentAspect(params))] = true; }

/// Return the number of changes since creation
/// This can be used to efficiently detect changes
int getCounter(const core::ExecParams* params=nullptr) const { return m_counters[currentAspect(params)]; }
int getCounter(const core::ExecParams* params=nullptr) const { return m_counters[static_cast<size_t>(currentAspect(params))]; }

/// @}

Expand All @@ -282,14 +282,14 @@ class SOFA_CORE_API BaseData : public DDGNode
/// Accessor to the vector containing all the fields of this object
const VecLink& getLinks() const { return m_vecLink; }

virtual bool findDataLinkDest(DDGNode*& ptr, const std::string& path, const BaseLink* link);
virtual bool findDataLinkDest(DDGNode*& ptr, const std::string& path, const BaseLink* link) override;

virtual bool findDataLinkDest(BaseData*& ptr, const std::string& path, const BaseLink* link);

template<class DataT>
bool findDataLinkDest(DataT*& ptr, const std::string& path, const BaseLink* link)
{
BaseData* base = NULL;
BaseData* base = nullptr;
if (!findDataLinkDest(base, path, link)) return false;
ptr = dynamic_cast<DataT*>(base);
return (ptr != NULL);
Expand Down Expand Up @@ -363,7 +363,7 @@ class LinkTraitsPtrCasts
public:
static sofa::core::objectmodel::Base* getBase(sofa::core::objectmodel::Base* b) { return b; }
static sofa::core::objectmodel::Base* getBase(sofa::core::objectmodel::BaseData* d) { return d->getOwner(); }
static sofa::core::objectmodel::BaseData* getData(sofa::core::objectmodel::Base* /*b*/) { return NULL; }
static sofa::core::objectmodel::BaseData* getData(sofa::core::objectmodel::Base* /*b*/) { return nullptr; }
static sofa::core::objectmodel::BaseData* getData(sofa::core::objectmodel::BaseData* d) { return d; }
};

Expand Down
26 changes: 13 additions & 13 deletions SofaKernel/framework/sofa/core/objectmodel/Data.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ class TData : public BaseData
~TData() override
{}

inline void printValue(std::ostream& out) const;
inline std::string getValueString() const;
inline std::string getValueTypeString() const; // { return std::string(typeid(m_value).name()); }
inline void printValue(std::ostream& out) const override;
inline std::string getValueString() const override;
inline std::string getValueTypeString() const override; // { return std::string(typeid(m_value).name()); }

/// Get info about the value type of the associated variable
const sofa::defaulttype::AbstractTypeInfo* getValueTypeInfo() const override
Expand Down Expand Up @@ -105,7 +105,7 @@ class TData : public BaseData
/** Try to read argument value from an input stream.
Return false if failed
*/
virtual bool read( const std::string& s )
virtual bool read( const std::string& s ) override
{
if (s.empty())
{
Expand Down Expand Up @@ -382,15 +382,15 @@ class Data : public TData<T>
/** \copydoc BaseData(const BaseData::BaseInitData& init) */
explicit Data(const BaseData::BaseInitData& init)
: TData<T>(init)
, shared(NULL)
, shared(nullptr)
{
}

/** \copydoc Data(const BaseData::BaseInitData&) */
explicit Data(const InitData& init)
: TData<T>(init)
, m_values()
, shared(NULL)
, shared(nullptr)
{
m_values[DDGNode::currentAspect()] = ValueType(init.value);
}
Expand All @@ -399,7 +399,7 @@ class Data : public TData<T>
Data( const char* helpMsg=nullptr, bool isDisplayed=true, bool isReadOnly=false)
: TData<T>(helpMsg, isDisplayed, isReadOnly)
, m_values()
, shared(NULL)
, shared(nullptr)
{
ValueType val;
m_values.assign(val);
Expand All @@ -411,7 +411,7 @@ class Data : public TData<T>
Data( const T& value, const char* helpMsg=nullptr, bool isDisplayed=true, bool isReadOnly=false)
: TData<T>(helpMsg, isDisplayed, isReadOnly)
, m_values()
, shared(NULL)
, shared(nullptr)
{
m_values[DDGNode::currentAspect()] = ValueType(value);
}
Expand All @@ -427,7 +427,7 @@ class Data : public TData<T>

inline T* beginEdit(const core::ExecParams* params = nullptr)
{
size_t aspect = DDGNode::currentAspect(params);
size_t aspect = static_cast<size_t>(DDGNode::currentAspect(params));
this->updateIfDirty(params);
++this->m_counters[aspect];
this->m_isSets[aspect] = true;
Expand All @@ -438,7 +438,7 @@ class Data : public TData<T>
/// BeginEdit method if it is only to write the value
inline T* beginWriteOnly(const core::ExecParams* params = nullptr)
{
size_t aspect = DDGNode::currentAspect(params);
size_t aspect = static_cast<size_t>(DDGNode::currentAspect(params));
++this->m_counters[aspect];
this->m_isSets[aspect] = true;
BaseData::setDirtyOutputs(params);
Expand Down Expand Up @@ -493,7 +493,7 @@ class Data : public TData<T>
const Data<T>* d = dynamic_cast< const Data<T>* >(&bd);
if (d)
{
size_t aspect = DDGNode::currentAspect();
size_t aspect = static_cast<size_t>(DDGNode::currentAspect());
this->m_values[aspect] = d->m_values[aspect];
//FIX: update counter
++this->m_counters[aspect];
Expand Down Expand Up @@ -648,8 +648,8 @@ class WriteAccessor< core::objectmodel::Data<T> > : public WriteAccessor<T>
WriteAccessor( container_type* c, data_container_type& d, const core::ExecParams* params=nullptr ) : Inherit(*c), data(d), dparams(params) {}

public:
WriteAccessor(data_container_type& d) : Inherit(*d.beginEdit()), data(d), dparams(NULL) {}
WriteAccessor(data_container_type* d) : Inherit(*d->beginEdit()), data(*d), dparams(NULL) {}
WriteAccessor(data_container_type& d) : Inherit(*d.beginEdit()), data(d), dparams(nullptr) {}
WriteAccessor(data_container_type* d) : Inherit(*d->beginEdit()), data(*d), dparams(nullptr) {}
WriteAccessor(const core::ExecParams* params, data_container_type& d) : Inherit(*d.beginEdit(params)), data(d), dparams(params) {}
WriteAccessor(const core::ExecParams* params, data_container_type* d) : Inherit(*d->beginEdit(params)), data(*d), dparams(params) {}
~WriteAccessor() { if (dparams) data.endEdit(dparams); else data.endEdit(); }
Expand Down
2 changes: 1 addition & 1 deletion SofaKernel/framework/sofa/core/objectmodel/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace objectmodel
protected:\
static const size_t s_eventTypeIndex; \
public:\
virtual size_t getEventTypeIndex() const { return T::s_eventTypeIndex; } \
virtual size_t getEventTypeIndex() const override { return T::s_eventTypeIndex; } \
static bool checkEventType( const Event* event ) { return event->getEventTypeIndex() == T::s_eventTypeIndex; }


Expand Down
12 changes: 6 additions & 6 deletions SofaKernel/framework/sofa/core/objectmodel/Link.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ class TLink : public BaseLink

size_t size(const core::ExecParams* params = nullptr) const
{
return (size_t)m_value[core::ExecParams::currentAspect(params)].size();
return static_cast<size_t>(m_value[core::ExecParams::currentAspect(params)].size());
}

bool empty(const core::ExecParams* params = nullptr) const
Expand Down Expand Up @@ -493,7 +493,7 @@ class TLink : public BaseLink
{
return TraitsDestCasts::getData(getIndex(index));
}
std::string getLinkedPath(unsigned int index=0) const
std::string getLinkedPath(unsigned int index=0) const override
{
return getPath(index);
}
Expand All @@ -502,7 +502,7 @@ class TLink : public BaseLink
/// @{

/// Read the command line
virtual bool read( const std::string& str )
virtual bool read( const std::string& str ) override
{
if (str.empty())
return true;
Expand Down Expand Up @@ -566,7 +566,7 @@ class TLink : public BaseLink
// Remove the objects from the container that are not in the new list
// TODO epernod 2018-08-01: This cast from size_t to unsigned int remove a large amount of warnings.
// But need to be rethink in the future. The problem is if index i is a site_t, then we need to template container<size_t> which impact the whole architecture.
unsigned int csize = (unsigned int)container.size();
unsigned int csize = static_cast<unsigned int>(container.size());
for (unsigned int i = 0; i != csize; i++)
{
DestPtr dest(container[i]);
Expand Down Expand Up @@ -597,7 +597,7 @@ class TLink : public BaseLink
if (!context)
{
std::string p,d;
return BaseLink::ParseString( path, &p, (ActiveFlags & FLAG_DATALINK) ? &d : NULL, NULL);
return BaseLink::ParseString( path, &p, (ActiveFlags & FLAG_DATALINK) ? &d : nullptr, nullptr);
}
else
{
Expand Down Expand Up @@ -719,7 +719,7 @@ class MultiLink : public TLink<TOwnerType,TDestType,TFlags|BaseLink::FLAG_MULTIL
if (!this->m_owner) return false;
bool ok = true;
const int aspect = core::ExecParams::currentAspect();
unsigned int n = (unsigned int)this->getSize();
unsigned int n = static_cast<unsigned int>(this->getSize());
for (unsigned int i = 0; i<n; ++i)
{
ValueType& value = this->m_value[aspect][i];
Expand Down
12 changes: 6 additions & 6 deletions SofaKernel/framework/sofa/core/topology/TopologyElementHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ class SOFA_CORE_API TopologyElementHandler : public sofa::core::topology::Topolo
using TopologyHandler::ApplyTopologyChange;

/// Apply swap between indices elements.
virtual void ApplyTopologyChange(const EIndicesSwap* event);
virtual void ApplyTopologyChange(const EIndicesSwap* event) override;
/// Apply adding elements.
virtual void ApplyTopologyChange(const EAdded* event);
virtual void ApplyTopologyChange(const EAdded* event) override;
/// Apply removing elements.
virtual void ApplyTopologyChange(const ERemoved* event);
virtual void ApplyTopologyChange(const ERemoved* event) override;
/// Apply renumbering on elements.
virtual void ApplyTopologyChange(const ERenumbering* event);
virtual void ApplyTopologyChange(const ERenumbering* event) override;
/// Apply moving elements.
virtual void ApplyTopologyChange(const EMoved* event);
/// Apply adding function on moved elements.
Expand All @@ -87,7 +87,7 @@ class SOFA_CORE_API TopologyElementHandler : public sofa::core::topology::Topolo
void swap( Topology::ElemID /*i1*/, Topology::ElemID /*i2*/ ) override {}

/// Reorder the values.
virtual void renumber( const sofa::helper::vector<Topology::ElemID> &/*index*/ ) {}
virtual void renumber( const sofa::helper::vector<Topology::ElemID> &/*index*/ ) override {}

/// Add some values. Values are added at the end of the vector.
/// This is the (old) version, to be deprecated in favor of the next method
Expand All @@ -106,7 +106,7 @@ class SOFA_CORE_API TopologyElementHandler : public sofa::core::topology::Topolo
)
{
// call old method by default
add((Topology::ElemID)index.size(), elems, ancestors, coefs);
add( static_cast<Topology::ElemID>(index.size()), elems, ancestors, coefs);
}

/// Remove the values corresponding to the ELement removed.
Expand Down
8 changes: 4 additions & 4 deletions SofaKernel/framework/sofa/defaulttype/DataTypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class VirtualTypeInfo : public AbstractTypeInfo
const AbstractTypeInfo* BaseType() const override { return VirtualTypeInfo<typename Info::BaseType>::get(); }
const AbstractTypeInfo* ValueType() const override { return VirtualTypeInfo<typename Info::ValueType>::get(); }

virtual std::string name() const { return DataTypeName<DataType>::name(); }
virtual std::string name() const override { return DataTypeName<DataType>::name(); }

bool ValidInfo() const override { return Info::ValidInfo; }
bool FixedSize() const override { return Info::FixedSize; }
Expand Down Expand Up @@ -365,7 +365,7 @@ class VirtualTypeInfo : public AbstractTypeInfo
return v;
}

virtual std::string getTextValue (const void* data, size_t index) const
virtual std::string getTextValue (const void* data, size_t index) const override
{
std::string v;
Info::getValueString(*(const DataType*)data, index, v);
Expand All @@ -382,7 +382,7 @@ class VirtualTypeInfo : public AbstractTypeInfo
Info::setValue(*(DataType*)data, index, value);
}

virtual void setTextValue(void* data, size_t index, const std::string& value) const
virtual void setTextValue(void* data, size_t index, const std::string& value) const override
{
Info::setValueString(*(DataType*)data, index, value);
}
Expand All @@ -395,7 +395,7 @@ class VirtualTypeInfo : public AbstractTypeInfo
return Info::getValuePtr(*(DataType*)data);
}

virtual const std::type_info* type_info() const { return &typeid(DataType); }
virtual const std::type_info* type_info() const override { return &typeid(DataType); }


protected: // only derived types can instantiate this class
Expand Down
Loading

0 comments on commit 0499ddc

Please sign in to comment.