8 #include <fwCom/Signal.hpp> 9 #include <fwCom/Signal.hxx> 11 #include "fwData/factory/new.hpp" 12 #include "fwData/Object.hpp" 45 ::fwData::Object::sptr
Object::getField(
const FieldNameType& name, ::fwData::Object::sptr defaultValue )
const 47 ::fwData::Object::sptr
object = defaultValue;
48 FieldMapType::const_iterator iter =
m_fields.find(name);
51 object = iter->second;
74 FieldNameVectorType names;
76 std::back_inserter(names),
77 std::bind(&FieldMapType::value_type::first, std::placeholders::_1) );
85 std::pair<FieldMapType::iterator, bool> res =
m_fields.insert(FieldMapType::value_type(name, obj));
88 res.first->second = obj;
103 FieldMapType::const_iterator iter =
m_fields.find(name);
122 DeepCopyCacheType cache;
129 DeepCopyCacheType cache;
138 const ::fwData::Object::FieldMapType& sourceFields = source->getFields();
139 for(const ::fwData::Object::FieldMapType::value_type& elt : sourceFields)
149 FwCoreNotUsedMacro(source);
155 ::fwData::Object::sptr
Object::copy(const ::fwData::Object::csptr& source)
157 DeepCopyCacheType cache;
163 ::fwData::Object::sptr
Object::copy(const ::fwData::Object::csptr& source, Object::DeepCopyCacheType& cache)
165 ::fwData::Object::sptr obj;
169 DeepCopyCacheType::const_iterator cacheItem = cache.find(source);
171 if (cacheItem == cache.end())
173 obj = ::fwData::factory::New(source->getClassname());
174 cache.insert( DeepCopyCacheType::value_type(source, obj) );
175 obj->cachedDeepCopy(source, cache);
179 obj = cacheItem->second;
virtual FWDATA_API void shallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWDATA_API const FieldMapType & getFields() const
Returns fields map.
FWDATA_API void removeField(const FieldNameType &name)
Removes field with specified name.
virtual const std::string & getClassname() const override
return full object's classname with its namespace, i.e. fwCore::BaseObject
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CHANGED_FIELDS_SIG
Type of signal m_sigModified.
FieldMapType m_fields
Fields.
FWDATA_API::fwData::Object::sptr getField(const FieldNameType &name,::fwData::Object::sptr defaultValue=::fwData::Object::sptr()) const
Returns a pointer of corresponding field (null if non exist).
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_FIELDS_SIG
Type of signal m_sigModified.
FWDATA_API::fwData::Object::csptr getConstField(const FieldNameType &name) const
Returns a pointer of corresponding field (null if non exist).
virtual FWDATA_API void cachedDeepCopy(const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)=0
Internal-use methods to implement Object's deepCopy.
#define SLM_FATAL(message)
FWDATA_API FieldNameVectorType getFieldNames() const
Returns vector of field names.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
static FWDATA_API::fwData::Object::sptr copy(const ::fwData::Object::csptr &source)
return a copy of the source. if source is a null pointer, return a null pointer.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_FIELDS_SIG
Type of signal m_sigModified.
Contains the representation of the data objects used in the framework.
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
FWDATA_API void setField(const FieldNameType &name,::fwData::Object::sptr obj)
Register field with specified name. If the name does already exist, the matching field will be replac...
FWDATA_API void setFields(const FieldMapType &fieldMap)
Replace the field map content.
FWDATA_API void deepCopy(const ::fwData::Object::csptr &source)
Make a deep copy from the source Calling this method may invalidate any DumpLock, RescursiveLock or h...