MeVisLab Toolbox Reference
PropertyContainer Class Reference

#include <mlPropertyContainer.h>

Inheritance diagram for PropertyContainer:
BaseGraphItem Skeleton VesselEdge VesselNode

Public Types

typedef PropertyManager::Pointer ManagerPointer
typedef PropertyManager::ConstPointer ConstManagerPointer
typedef PropertyManager::PropertyMap PropertyMap

Public Member Functions

 PropertyContainer (const ManagerPointer &manager)
 PropertyContainer (const PropertyContainer &other)
 ~PropertyContainer () override
bool operator== (const PropertyContainer &other) const
 Check for equality (managers and values).
bool operator!= (const PropertyContainer &other) const
 Check for inequality (managers and values).
void copyProperties (const PropertyContainer &other)
 Copy all properties from the given container to this object.
const PropertyManagergetPropertyManager () const
 Get read-only access to the associated property manager.
PropertyManagergetPropertyManager ()
 Get access to the associated property manager.
PropertyMap getPropertyMap () const
 Get a map of the contained properties, can be useful for comparison.
size_t numberOfProperties () const
 Return the number of properties currently available.
const PropertyValueproperty (size_t index) const
 Get the property with index index as PropertyValue.
template<typename T>
Tproperty (size_t index)
 Get the property with index index with type T. Throws boost::bad_get exception if the currently stored property has a different type.
template<typename T>
const Tproperty (size_t index) const
 Get the property with index index with type T, const version. Throws boost::bad_get exception if the currently stored property has a different type.
const PropertyValueproperty (const std::string &name) const
template<typename T>
Tproperty (const std::string &name)
template<typename T>
const Tproperty (const std::string &name) const
virtual void reset ()
 Set all properties to default values.
 ML_ABSTRACT_CLASS_HEADER (PropertyContainer)
Persistence
void addStateToTree (TreeNode *parent) const override
 ML_SET_ADDSTATE_VERSION (1)
 Set current addStateToTree() version number:
void readStateFromTree (TreeNode *parent) override
 Reads the object state from the children of the given parent node.

Protected Attributes

std::vector< PropertyValue_values
ManagerPointer _manager

Friends

class PropertyManager
class ::MLPropertyContainerWrapper

Detailed Description

Definition at line 31 of file mlPropertyContainer.h.

Member Typedef Documentation

◆ ConstManagerPointer

◆ ManagerPointer

◆ PropertyMap

Constructor & Destructor Documentation

◆ PropertyContainer() [1/2]

PropertyContainer::PropertyContainer ( const ManagerPointer & manager)

◆ PropertyContainer() [2/2]

PropertyContainer::PropertyContainer ( const PropertyContainer & other)

References PropertyContainer().

◆ ~PropertyContainer()

PropertyContainer::~PropertyContainer ( )
override

Member Function Documentation

◆ addStateToTree()

void PropertyContainer::addStateToTree ( TreeNode * parent) const
override

Attaches the object state as children of the given parent node.

◆ copyProperties()

void PropertyContainer::copyProperties ( const PropertyContainer & other)

Copy all properties from the given container to this object.

References PropertyContainer().

◆ getPropertyManager() [1/2]

PropertyManager * PropertyContainer::getPropertyManager ( )
inline

Get access to the associated property manager.

Definition at line 54 of file mlPropertyContainer.h.

References _manager, and PropertyManager.

◆ getPropertyManager() [2/2]

const PropertyManager * PropertyContainer::getPropertyManager ( ) const
inline

Get read-only access to the associated property manager.

Definition at line 52 of file mlPropertyContainer.h.

References _manager, and PropertyManager.

Referenced by DefaultPropertyAccessor< T >::operator()(), and DefaultPropertyAccessor< T >::operator()().

◆ getPropertyMap()

PropertyMap PropertyContainer::getPropertyMap ( ) const

Get a map of the contained properties, can be useful for comparison.

◆ ML_ABSTRACT_CLASS_HEADER()

PropertyContainer::ML_ABSTRACT_CLASS_HEADER ( PropertyContainer )

References PropertyContainer().

◆ ML_SET_ADDSTATE_VERSION()

PropertyContainer::ML_SET_ADDSTATE_VERSION ( 1 )

Set current addStateToTree() version number:

◆ numberOfProperties()

size_t PropertyContainer::numberOfProperties ( ) const
inline

Return the number of properties currently available.

Definition at line 59 of file mlPropertyContainer.h.

References _values.

◆ operator!=()

bool PropertyContainer::operator!= ( const PropertyContainer & other) const
inline

Check for inequality (managers and values).

Definition at line 46 of file mlPropertyContainer.h.

References PropertyContainer().

◆ operator==()

bool PropertyContainer::operator== ( const PropertyContainer & other) const

Check for equality (managers and values).

References PropertyContainer().

◆ property() [1/6]

template<typename T>
T & PropertyContainer::property ( const std::string & name)
inline

Definition at line 81 of file mlPropertyContainer.h.

References _manager, _values, and T.

◆ property() [2/6]

template<typename T>
const T & PropertyContainer::property ( const std::string & name) const
inline

Definition at line 83 of file mlPropertyContainer.h.

References _manager, _values, and T.

◆ property() [3/6]

const PropertyValue & PropertyContainer::property ( const std::string & name) const
inline

Get the property with name name. This requires a lookup of the index in the graph container. If you need to access the same property for many different objects, it is more efficient to do the lookup manually and use the index-based access. Have a look at SmartPropertyIndex for how a convenient and safe way to do index-based lookups. Throws ML_BAD_PARAMETER if the property does not exist.

Definition at line 79 of file mlPropertyContainer.h.

References _manager, and _values.

◆ property() [4/6]

template<typename T>
T & PropertyContainer::property ( size_t index)
inline

Get the property with index index with type T. Throws boost::bad_get exception if the currently stored property has a different type.

Definition at line 67 of file mlPropertyContainer.h.

References _values, and T.

◆ property() [5/6]

template<typename T>
const T & PropertyContainer::property ( size_t index) const
inline

Get the property with index index with type T, const version. Throws boost::bad_get exception if the currently stored property has a different type.

Definition at line 70 of file mlPropertyContainer.h.

References _values, and T.

◆ property() [6/6]

const PropertyValue & PropertyContainer::property ( size_t index) const
inline

Get the property with index index as PropertyValue.

Get the property with index index as PropertyValue, const version.

Definition at line 64 of file mlPropertyContainer.h.

References _values.

Referenced by DefaultPropertyAccessor< T >::operator()(), and DefaultPropertyAccessor< T >::operator()().

◆ readStateFromTree()

void PropertyContainer::readStateFromTree ( TreeNode * parent)
override

Reads the object state from the children of the given parent node.

◆ reset()

virtual void PropertyContainer::reset ( )
virtual

Set all properties to default values.

◆ ::MLPropertyContainerWrapper

friend class ::MLPropertyContainerWrapper
friend

Definition at line 33 of file mlPropertyContainer.h.

◆ PropertyManager

friend class PropertyManager
friend

Definition at line 32 of file mlPropertyContainer.h.

References PropertyManager.

Referenced by getPropertyManager(), getPropertyManager(), and PropertyManager.

Member Data Documentation

◆ _manager

ManagerPointer PropertyContainer::_manager
protected

Definition at line 91 of file mlPropertyContainer.h.

Referenced by getPropertyManager(), getPropertyManager(), property(), and property().

◆ _values

std::vector<PropertyValue> PropertyContainer::_values
protected

Definition at line 89 of file mlPropertyContainer.h.

Referenced by numberOfProperties(), property(), property(), property(), and property().


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