fw4spl
fwData::Vector Class Reference

This class defines a vector of objects. More...

#include <Vector.hpp>

+ Inheritance diagram for fwData::Vector:
+ Collaboration diagram for fwData::Vector:

Public Types

typedef std::vector< Object::sptr > ContainerType
 
typedef ContainerType::value_type ValueType
 
typedef ContainerType::reference ReferenceType
 
typedef ContainerType::const_reference ConstReferenceType
 
typedef ContainerType::iterator IteratorType
 
typedef ContainerType::const_iterator ConstIteratorType
 
typedef ContainerType::reverse_iterator ReverseIteratorType
 
typedef ContainerType::const_reverse_iterator ConstReverseIteratorType
 
typedef ContainerType::size_type SizeType
 
- Public Types inherited from fwData::Object
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
 
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.
 
- Public Types inherited from fwCom::HasSignals
typedef std::shared_ptr< HasSignalssptr
 
typedef std::shared_ptr< const HasSignalscsptr
 

Public Member Functions

virtual bool isA (const std::string &type) const override
 
FWDATA_API Vector (::fwData::Object::Key key)
 Constructor. More...
 
virtual FWDATA_API ~Vector ()
 Destructor.
 
FWDATA_API void shallowCopy (const Object::csptr &_source) override
 Defines shallow copy.
 
FWDATA_API void cachedDeepCopy (const Object::csptr &_source, DeepCopyCacheType &cache) override
 Defines deep copy.
 
template<class DATATYPE >
void setDataContainer (const std::vector< std::shared_ptr< DATATYPE > > &vec)
 Method to initialize a fwData::Vector from a std::vector.
 
template<class DATATYPE >
std::vector< std::shared_ptr< DATATYPE > > getDataContainer () const
 Method to get a std::vector from fwData::Vector.
 
ContainerType & getContainer ()
 get/set the vector of fwData::Object
 
const ContainerType & getContainer () const
 get/set the vector of fwData::Object
 
void setContainer (const ContainerType &val)
 get/set the vector of fwData::Object
 
- Public Member Functions inherited from fwData::Object
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::ReadWriteMutexgetMutex () const
 Returns the object's mutex.
 
- Public Member Functions inherited from fwTools::Object
- Public Member Functions inherited from fwCore::BaseObject
- Public Member Functions inherited from fwCom::HasSignals
std::shared_ptr< SignalBasesignal (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 Public Member Functions inherited from fwData::Object
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 const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- 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

ContainerType m_container
 
- Protected Attributes inherited from fwData::Object
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::UUIDm_uuid
 UUID used to identify the object, notably for serialization.
 
- Protected Attributes inherited from fwCom::HasSignals
Signals m_signals
 

Friends

template<class , class , class >
class ::fwTools::ClassFactory
 
class ::fwTools::Factory
 

Demangling methods

virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
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
 
typedef ContainerType::value_type value_type
 
typedef ContainerType::iterator iterator
 
typedef ContainerType::const_iterator const_iterator
 
typedef ContainerType::reverse_iterator reverse_iterator
 
typedef ContainerType::const_reverse_iterator const_reverse_iterator
 
typedef ContainerType::size_type size_type
 
typedef Vector Container
 
IteratorType begin ()
 
IteratorType end ()
 
ConstIteratorType begin () const
 
ConstIteratorType end () const
 
ReverseIteratorType rbegin ()
 
ReverseIteratorType rend ()
 
ConstReverseIteratorType rbegin () const
 
ConstReverseIteratorType rend () const
 
bool empty () const
 
SizeType size () const
 
ValueType front () const
 
ValueType back () const
 
ReferenceType operator[] (size_type n)
 
ConstReferenceType operator[] (size_type n) const
 
ReferenceType at (SizeType n)
 
ConstReferenceType at (SizeType n) const
 

Signals

typedef ::fwCom::Signal< void(ContainerType) > AddedObjectsSignalType
 Type of signal when objects are added.
 
typedef ::fwCom::Signal< void(ContainerType) > RemovedObjectsSignalType
 Type of signal when objects are removed.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_OBJECTS_SIG = "addedObjects"
 Type of signal when objects are added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_OBJECTS_SIG = "removedObjects"
 Type of signal when objects are added.
 

Additional Inherited Members

- Static Public Attributes inherited from fwData::Object
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.
 
- Protected Types inherited from fwTools::fwID
enum  Policy { EMPTY = 1, GENERATE, MUST_EXIST }
 
typedef std::string IDType
 
- Protected Member Functions inherited from fwData::Object
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.
 
- 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.
 
- Protected Member Functions inherited from fwCom::HasSignals
 HasSignals (const HasSignals &)
 Copy constructor forbidden.
 
HasSignalsoperator= (const HasSignals &)
 Copy operator forbidden.
 
- Static Protected Member Functions inherited from fwData::Object
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.
 
- 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::ObjectgetObject (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
 

Detailed Description

This class defines a vector of objects.

Vector contains a vector of fwData::Object.

Definition at line 34 of file include/fwData/Vector.hpp.

Member Typedef Documentation

typedef ContainerType::const_iterator fwData::Vector::const_iterator

boost_foreach/stl compatibility

Definition at line 66 of file include/fwData/Vector.hpp.

typedef ContainerType::const_reverse_iterator fwData::Vector::const_reverse_iterator

boost_foreach/stl compatibility

Definition at line 68 of file include/fwData/Vector.hpp.

boost_foreach/stl compatibility

Definition at line 71 of file include/fwData/Vector.hpp.

typedef ContainerType::iterator fwData::Vector::iterator

boost_foreach/stl compatibility

Definition at line 65 of file include/fwData/Vector.hpp.

typedef ContainerType::reverse_iterator fwData::Vector::reverse_iterator

boost_foreach/stl compatibility

Definition at line 67 of file include/fwData/Vector.hpp.

typedef ContainerType::size_type fwData::Vector::size_type

boost_foreach/stl compatibility

Definition at line 69 of file include/fwData/Vector.hpp.

typedef ContainerType::value_type fwData::Vector::value_type

boost_foreach/stl compatibility

Definition at line 64 of file include/fwData/Vector.hpp.

Constructor & Destructor Documentation

fwData::Vector::Vector ( ::fwData::Object::Key  key)

Constructor.

Parameters
keyPrivate construction key

Definition at line 24 of file src/fwData/Vector.cpp.

References s_ADDED_OBJECTS_SIG, and s_REMOVED_OBJECTS_SIG.

Member Function Documentation

Vector::ReferenceType fwData::Vector::at ( Vector::SizeType  n)
inline

boost_foreach/stl compatibility

Definition at line 237 of file include/fwData/Vector.hpp.

Vector::ConstReferenceType fwData::Vector::at ( Vector::SizeType  n) const
inline

boost_foreach/stl compatibility

Definition at line 244 of file include/fwData/Vector.hpp.

Vector::ValueType fwData::Vector::back ( ) const
inline

boost_foreach/stl compatibility

Definition at line 216 of file include/fwData/Vector.hpp.

Vector::IteratorType fwData::Vector::begin ( )
inline

boost_foreach/stl compatibility

Definition at line 139 of file include/fwData/Vector.hpp.

Vector::ConstIteratorType fwData::Vector::begin ( ) const
inline

boost_foreach/stl compatibility

Definition at line 153 of file include/fwData/Vector.hpp.

bool fwData::Vector::empty ( ) const
inline

boost_foreach/stl compatibility

Definition at line 195 of file include/fwData/Vector.hpp.

Vector::IteratorType fwData::Vector::end ( )
inline

boost_foreach/stl compatibility

Definition at line 146 of file include/fwData/Vector.hpp.

Vector::ConstIteratorType fwData::Vector::end ( ) const
inline

boost_foreach/stl compatibility

Definition at line 160 of file include/fwData/Vector.hpp.

Vector::ValueType fwData::Vector::front ( ) const
inline

boost_foreach/stl compatibility

Definition at line 209 of file include/fwData/Vector.hpp.

Vector::ReferenceType fwData::Vector::operator[] ( Vector::size_type  n)
inline

boost_foreach/stl compatibility

Definition at line 223 of file include/fwData/Vector.hpp.

Vector::ConstReferenceType fwData::Vector::operator[] ( Vector::size_type  n) const
inline

boost_foreach/stl compatibility

Definition at line 230 of file include/fwData/Vector.hpp.

Vector::ReverseIteratorType fwData::Vector::rbegin ( )
inline

boost_foreach/stl compatibility

Definition at line 167 of file include/fwData/Vector.hpp.

Vector::ConstReverseIteratorType fwData::Vector::rbegin ( ) const
inline

boost_foreach/stl compatibility

Definition at line 181 of file include/fwData/Vector.hpp.

Vector::ReverseIteratorType fwData::Vector::rend ( )
inline

boost_foreach/stl compatibility

Definition at line 174 of file include/fwData/Vector.hpp.

Vector::ConstReverseIteratorType fwData::Vector::rend ( ) const
inline

boost_foreach/stl compatibility

Definition at line 188 of file include/fwData/Vector.hpp.

Vector::SizeType fwData::Vector::size ( ) const
inline

boost_foreach/stl compatibility

Definition at line 202 of file include/fwData/Vector.hpp.


The documentation for this class was generated from the following files: