fw4spl
|
Base class for each data object. More...
#include <Object.hpp>
Classes | |
class | Registrar |
Class used to register a class factory in factory registry. This class defines also the object factory ( 'create' ) More... | |
Public Types | |
typedef ::fwData::factory::Key | Key |
typedef std::string | FieldNameType |
typedef std::vector< FieldNameType > | FieldNameVectorType |
typedef ::std::unordered_map< FieldNameType,::fwData::Object::sptr > | FieldMapType |
typedef ::std::unordered_map< ::fwData::Object::csptr,::fwData::Object::sptr > | DeepCopyCacheType |
Public Types inherited from fwCom::HasSignals | |
typedef std::shared_ptr< HasSignals > | sptr |
typedef std::shared_ptr< const HasSignals > | csptr |
Public Member Functions | |
virtual bool | isA (const std::string &type) const override |
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). More... | |
template<typename DATA_TYPE > | |
std::shared_ptr< DATA_TYPE > | getField (const FieldNameType &name) const |
Returns a pointer of corresponding field. More... | |
template<typename DATA_TYPE > | |
std::shared_ptr< DATA_TYPE > | getField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue) const |
Returns a pointer of corresponding field. More... | |
template<typename DATA_TYPE > | |
std::shared_ptr< DATA_TYPE > | setDefaultField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue) |
Returns a pointer of corresponding field. If field did not exist, it is set to defaultValue if defaultValue is not null. More... | |
FWDATA_API::fwData::Object::csptr | getConstField (const FieldNameType &name) const |
Returns a pointer of corresponding field (null if non exist). More... | |
FWDATA_API const FieldMapType & | getFields () const |
Returns fields map. | |
FWDATA_API FieldNameVectorType | getFieldNames () const |
Returns vector of field names. | |
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 replaced. More... | |
FWDATA_API void | setFields (const FieldMapType &fieldMap) |
Replace the field map content. | |
FWDATA_API void | removeField (const FieldNameType &name) |
Removes field with specified name. More... | |
virtual FWDATA_API void | shallowCopy (const ::fwData::Object::csptr &source) |
A shallow copy of fields (objects in m_children) More... | |
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 helper on the object. Prefer using fwData::Object::copy instead. | |
FWDATA_API void | fieldShallowCopy (const ::fwData::Object::csptr &source) |
A shallow copy of fields (objects in m_children) More... | |
FWDATA_API void | fieldDeepCopy (const ::fwData::Object::csptr &source) |
A deep copy of fields (objects in m_children) More... | |
::fwCore::mt::ReadWriteMutex & | getMutex () const |
Returns the object's mutex. | |
Public Member Functions inherited from fwTools::Object | |
Public Member Functions inherited from fwCore::BaseObject | |
virtual const std::string & | getLeafClassname () const |
return object's classname without its namespace, i.e. BaseObject | |
Public Member Functions inherited from fwCom::HasSignals | |
std::shared_ptr< SignalBase > | signal (const Signals::SignalKeyType &key) const |
template<typename SignalType > | |
std::shared_ptr< SignalType > | signal (const Signals::SignalKeyType &key) const |
template<typename SignalType > | |
std::shared_ptr< SignalType > | newSignal (const Signals::SignalKeyType &key) |
Static Public Member Functions | |
static bool | isTypeOf (const std::string &type) |
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. | |
template<typename DATA_TYPE > | |
static std::shared_ptr< DATA_TYPE > | copy (const std::shared_ptr< const DATA_TYPE > &source) |
return a copy of the source. if source is a null pointer, return a null pointer. | |
template<typename DATA_TYPE > | |
static std::shared_ptr< DATA_TYPE > | copy (const std::shared_ptr< DATA_TYPE > &source) |
return a copy of the source. if source is a null pointer, return a null pointer. | |
Static Public Member Functions inherited from fwTools::Object | |
static bool | isTypeOf (const std::string &type) |
static const std::string & | classname () |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
Static Public Member Functions inherited from fwCore::BaseObject | |
static bool | isTypeOf (const std::string &type) |
static const std::string & | leafClassname () |
return object's classname without its namespace, i.e. BaseObject | |
static const std::string & | classname () |
return object's classname without its namespace, i.e. BaseObject | |
Protected Attributes | |
FieldMapType | m_fields |
Fields. | |
mutable::fwCore::mt::ReadWriteMutex | m_mutex |
Mutex to protect object access. | |
Protected Attributes inherited from fwTools::Object | |
std::shared_ptr< ::fwTools::UUID > | m_uuid |
UUID used to identify the object, notably for serialization. | |
Protected Attributes inherited from fwCom::HasSignals | |
Signals | m_signals |
Demangling methods | |
virtual const std::string & | getClassname () const override |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
static const std::string & | classname () |
return full object's classname with its namespace, i.e. fwCore::BaseObject | |
Signals | |
typedef ::fwCom::Signal< void() > | ModifiedSignalType |
Type of signal m_sigModified. | |
typedef std::map< std::string,::fwData::Object::sptr > | FieldsContainerType |
Type of signal m_sigModified. | |
typedef ::fwCom::Signal< void(FieldsContainerType) > | AddedFieldsSignalType |
Type of signal when objects are added. | |
typedef ::fwCom::Signal< void(FieldsContainerType, FieldsContainerType) > | ChangedFieldsSignalType |
Type of signal when objects are changed (newObjects, oldObjects) | |
typedef ::fwCom::Signal< void(FieldsContainerType) > | RemovedFieldsSignalType |
Type of signal when objects are removed. | |
static FWDATA_APIconst::fwCom::Signals::SignalKeyType | s_MODIFIED_SIG = "modified" |
Key in m_signals map of signal m_sigModified. | |
static FWDATA_APIconst::fwCom::Signals::SignalKeyType | s_ADDED_FIELDS_SIG = "addedFields" |
Type of signal m_sigModified. | |
static FWDATA_APIconst::fwCom::Signals::SignalKeyType | s_CHANGED_FIELDS_SIG = "changedFields" |
Type of signal m_sigModified. | |
static FWDATA_APIconst::fwCom::Signals::SignalKeyType | s_REMOVED_FIELDS_SIG = "removedFields" |
Type of signal m_sigModified. | |
FWDATA_API void | fieldDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache) |
Internal-use methods to implement Object's deepCopy. | |
virtual FWDATA_API void | cachedDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)=0 |
Internal-use methods to implement Object's deepCopy. | |
static FWDATA_API::fwData::Object::sptr | copy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache) |
Internal-use methods to implement Object's deepCopy. | |
template<typename DATA_TYPE > | |
static std::shared_ptr< DATA_TYPE > | copy (const std::shared_ptr< const DATA_TYPE > &source, DeepCopyCacheType &cache) |
Internal-use methods to implement Object's deepCopy. | |
template<typename DATA_TYPE > | |
static std::shared_ptr< DATA_TYPE > | copy (const std::shared_ptr< DATA_TYPE > &source, DeepCopyCacheType &cache) |
Internal-use methods to implement Object's deepCopy. | |
Additional Inherited Members | |
Protected Types inherited from fwTools::fwID | |
enum | Policy { EMPTY = 1, GENERATE, MUST_EXIST } |
typedef std::string | IDType |
Protected Member Functions inherited from fwTools::fwID | |
FWTOOLS_API bool | hasID () const |
Return true if the object has an id set. More... | |
FWTOOLS_API IDType | getID (Policy policy=GENERATE) const |
Returns the id of the object. If it is not set and the policy value is. More... | |
virtual FWTOOLS_API void | setID (IDType newID) |
Set a newID for the object, (newID must not exist in fwID), the oldest one is released. More... | |
FWTOOLS_API void | resetID () |
Release the id for the object. More... | |
fwID () | |
Constructor : does nothing. | |
virtual const std::string & | getLeafClassname () const |
return object's classname without its namespace, i.e. BaseObject | |
Protected Member Functions inherited from fwCom::HasSignals | |
HasSignals (const HasSignals &) | |
Copy constructor forbidden. | |
HasSignals & | operator= (const HasSignals &) |
Copy operator forbidden. | |
Static Protected Member Functions inherited from fwTools::fwID | |
static bool | isTypeOf (const std::string &type) |
static FWTOOLS_API bool | exist (IDType _id) |
static FWTOOLS_API std::shared_ptr< ::fwTools::Object > | getObject (IDType requestID) |
Retrieve the object attached to the given id. Return a null sptr if no correspondence exist. More... | |
static const std::string & | leafClassname () |
return object's classname without its namespace, i.e. BaseObject | |
static const std::string & | classname () |
return object's classname without its namespace, i.e. BaseObject | |
Base class for each data object.
Each object can optionally embed sub-object with string identifier. We name this concept a Field. An Object containing a field name "dummy" corresponds to having a labeledObject with label "dummy" and containing a specific Object. When accessing to this object with getField("dummy") we get the specific Object
Definition at line 48 of file SrcLib/core/fwData/include/fwData/Object.hpp.
void fwData::Object::fieldDeepCopy | ( | const ::fwData::Object::csptr & | source | ) |
A deep copy of fields (objects in m_children)
[in] | source | source of the copy. |
Definition at line 127 of file SrcLib/core/fwData/src/fwData/Object.cpp.
Referenced by fwData::location::MultiFiles::cachedDeepCopy(), fwData::Material::cachedDeepCopy(), fwMedData::Study::cachedDeepCopy(), fwMedData::Equipment::cachedDeepCopy(), fwData::Histogram::cachedDeepCopy(), fwMedData::Patient::cachedDeepCopy(), fwRenderQt::data::Viewport::cachedDeepCopy(), fwData::location::SingleFile::cachedDeepCopy(), fwData::String::cachedDeepCopy(), fwData::Edge::cachedDeepCopy(), fwPacsIO::data::PacsConfiguration::cachedDeepCopy(), fwData::Boolean::cachedDeepCopy(), fwData::Integer::cachedDeepCopy(), fwData::Line::cachedDeepCopy(), fwData::ResectionDB::cachedDeepCopy(), fwData::location::Folder::cachedDeepCopy(), fwData::TransformationMatrix3D::cachedDeepCopy(), fwData::Plane::cachedDeepCopy(), fwData::Float::cachedDeepCopy(), fwMedData::Series::cachedDeepCopy(), fwData::PlaneList::cachedDeepCopy(), fwData::Resection::cachedDeepCopy(), fwData::Color::cachedDeepCopy(), fwData::Point::cachedDeepCopy(), fwData::Reconstruction::cachedDeepCopy(), fwData::PointList::cachedDeepCopy(), fwData::Port::cachedDeepCopy(), fwData::StructureTraitsDictionary::cachedDeepCopy(), fwData::Array::cachedDeepCopy(), fwData::Tag::cachedDeepCopy(), fwData::ReconstructionTraits::cachedDeepCopy(), fwData::Landmarks::cachedDeepCopy(), fwData::ROITraits::cachedDeepCopy(), fwData::Node::cachedDeepCopy(), fwData::Image::cachedDeepCopy(), fwMedData::SeriesDB::cachedDeepCopy(), fwData::List::cachedDeepCopy(), fwData::Composite::cachedDeepCopy(), fwData::Spline::cachedDeepCopy(), fwData::Vector::cachedDeepCopy(), fwData::TransferFunction::cachedDeepCopy(), fwData::ProcessObject::cachedDeepCopy(), fwData::Mesh::cachedDeepCopy(), fwData::StructureTraits::cachedDeepCopy(), and fwData::Graph::getConnections().
void fwData::Object::fieldShallowCopy | ( | const ::fwData::Object::csptr & | source | ) |
A shallow copy of fields (objects in m_children)
[in] | source | source of the copy. |
Definition at line 113 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References setFields().
Referenced by fwData::Graph::getConnections(), fwMedData::Study::shallowCopy(), fwData::Material::shallowCopy(), fwMedData::Equipment::shallowCopy(), fwData::Histogram::shallowCopy(), fwMedData::Patient::shallowCopy(), fwRenderQt::data::Viewport::shallowCopy(), fwData::Boolean::shallowCopy(), fwData::String::shallowCopy(), fwPacsIO::data::PacsConfiguration::shallowCopy(), fwData::Edge::shallowCopy(), fwData::Integer::shallowCopy(), fwData::Line::shallowCopy(), fwData::ResectionDB::shallowCopy(), fwData::location::SingleFile::shallowCopy(), fwData::location::Folder::shallowCopy(), fwData::TransformationMatrix3D::shallowCopy(), fwData::Plane::shallowCopy(), fwData::Float::shallowCopy(), fwData::PlaneList::shallowCopy(), fwMedData::Series::shallowCopy(), fwData::Resection::shallowCopy(), fwData::Color::shallowCopy(), fwData::PointList::shallowCopy(), fwData::Point::shallowCopy(), fwData::Reconstruction::shallowCopy(), fwData::Port::shallowCopy(), fwData::StructureTraitsDictionary::shallowCopy(), fwData::Tag::shallowCopy(), fwData::Landmarks::shallowCopy(), fwData::Node::shallowCopy(), fwData::Image::shallowCopy(), fwMedData::SeriesDB::shallowCopy(), fwData::List::shallowCopy(), fwData::Composite::shallowCopy(), fwData::Vector::shallowCopy(), fwData::TransferFunction::shallowCopy(), fwData::ProcessObject::shallowCopy(), and fwData::Mesh::shallowCopy().
fwData::Object::csptr fwData::Object::getConstField | ( | const FieldNameType & | name | ) | const |
Returns a pointer of corresponding field (null if non exist).
[in] | name | Field name |
Definition at line 58 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References getField().
fwData::Object::sptr fwData::Object::getField | ( | const FieldNameType & | name, |
::fwData::Object::sptr | defaultValue = ::fwData::Object::sptr() |
||
) | const |
Returns a pointer of corresponding field (null if non exist).
[in] | name | Field name |
[in] | defaultValue | Default value |
Definition at line 45 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References m_fields.
Referenced by fwDataTools::fieldHelper::MedicalImageHelpers::checkImageSliceIndex(), getConstField(), visuVTKAdaptor::SImage3DCursor::starting(), visuVTKAdaptor::SImageMultiDistances::updating(), and fwGdcmIO::writer::Series::write().
std::shared_ptr< DATA_TYPE > fwData::Object::getField | ( | const FieldNameType & | name | ) | const |
Returns a pointer of corresponding field.
[in] | name | Field name |
Definition at line 275 of file SrcLib/core/fwData/include/fwData/Object.hpp.
References SPTR.
std::shared_ptr< DATA_TYPE > fwData::Object::getField | ( | const FieldNameType & | name, |
std::shared_ptr< DATA_TYPE > | defaultValue | ||
) | const |
Returns a pointer of corresponding field.
[in] | name | Field name |
[in] | defaultValue | Default value |
Definition at line 286 of file SrcLib/core/fwData/include/fwData/Object.hpp.
References SPTR.
void fwData::Object::removeField | ( | const FieldNameType & | name | ) |
Removes field with specified name.
[in] | name | Field name |
Definition at line 101 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References m_fields, and OSLM_ASSERT.
Referenced by uiMeasurement::action::RemoveDistance::updating().
std::shared_ptr< DATA_TYPE > fwData::Object::setDefaultField | ( | const FieldNameType & | name, |
std::shared_ptr< DATA_TYPE > | defaultValue | ||
) |
Returns a pointer of corresponding field. If field did not exist, it is set to defaultValue if defaultValue is not null.
[in] | name | Field name |
[in] | defaultValue | default return value if field was not found |
Definition at line 297 of file SrcLib/core/fwData/include/fwData/Object.hpp.
References SPTR.
void fwData::Object::setField | ( | const FieldNameType & | name, |
::fwData::Object::sptr | obj | ||
) |
Register field with specified name. If the name does already exist, the matching field will be replaced.
[in] | name | Field name |
[in] | obj | Field |
Definition at line 83 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References m_fields.
Referenced by fieldDeepCopy().
|
virtual |
A shallow copy of fields (objects in m_children)
[in] | source | source of the copy. |
Reimplemented in fwMedData::SeriesDB, fwMedData::ModelSeries, fwMedData::DicomSeries, fwMedData::ActivitySeries, fwMedData::NavigationSeries, fwMedData::ImageSeries, fwMedData::Series, fwMedData::Equipment, fwMedData::Patient, fwRenderQt::data::Viewport, uiMedDataQt::InsertSeries, and fwMedData::Study.
Definition at line 147 of file SrcLib/core/fwData/src/fwData/Object.cpp.
References getClassname(), and SLM_FATAL.