torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::PropertyContainer Class Reference

Represents objects that have properties. More...

#include <PropertyContainer.hpp>

+ Inheritance diagram for torc::generic::PropertyContainer:
+ Collaboration diagram for torc::generic::PropertyContainer:

Public Member Functions

PropertySharedPtr getProperty (const std::string &inName)
 
bool setProperty (const std::string &inName, const PropertySharedPtr &inProperty)
 
void getProperties (std::map< std::string, PropertySharedPtr > &outProperties) const
 
void setProperties (const std::map< std::string, PropertySharedPtr > &inSource)
 
template<typename _Action >
void applyOnAllProperties (const _Action &action) throw (Error)
 
 ~PropertyContainer () throw ()
 

Protected Member Functions

 PropertyContainer ()
 

Private Member Functions

 PropertyContainer (const PropertyContainer &source)
 
PropertyContaineroperator= (const PropertyContainer &source)
 

Private Attributes

SymTab< std::string,
PropertySharedPtr
mProperties
 

Detailed Description

Represents objects that have properties.

The PropertyContainer interface is generalized by classes tat need to hold one or more properties. A property is identified by name in the container.

Definition at line 39 of file PropertyContainer.hpp.

Constructor & Destructor Documentation

torc::generic::PropertyContainer::PropertyContainer ( )
protected

Definition at line 73 of file PropertyContainer.cpp.

73 : mProperties() {}
SymTab< std::string, PropertySharedPtr > mProperties
torc::generic::PropertyContainer::~PropertyContainer ( )
throw (
)

Definition at line 75 of file PropertyContainer.cpp.

75 {}
torc::generic::PropertyContainer::PropertyContainer ( const PropertyContainer source)
private

Member Function Documentation

template<typename _Action >
void torc::generic::PropertyContainer::applyOnAllProperties ( const _Action &  action)
throw (Error
)
inline

Apply action on all properties.

Parameters
[in]actionAction to be applied

Definition at line 113 of file PropertyContainer.hpp.

114  {
115  try {
116  mProperties.applyOnAll(action);
117  } catch(Error& e) {
118  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
119  throw;
120  }
121 }
void applyOnAll(const _Action &action)
Definition: SymTab.hpp:192
SymTab< std::string, PropertySharedPtr > mProperties

+ Here is the call graph for this function:

void torc::generic::PropertyContainer::getProperties ( std::map< std::string, PropertySharedPtr > &  outProperties) const
inline

Get the map of all properties

Parameters
[out]outPropertiesThe map of properties

Get the map of all properties

Returns
The map of properties

Definition at line 107 of file PropertyContainer.hpp.

108  {
109  mProperties.getValueMap(outProperties);
110  return;
111 }
void getValueMap(UserMap &outMap) const
Definition: SymTab.hpp:171
SymTab< std::string, PropertySharedPtr > mProperties

+ Here is the call graph for this function:

PropertySharedPtr torc::generic::PropertyContainer::getProperty ( const std::string &  inName)

Get a property

Parameters
[in]inNameName of the property to be retreived
Returns
Pointer to the property object if present, empty pointer otherwise.

Get a property

Parameters
[in]nameName of the property to be retreived
Returns
Pointer to the property object if present, empty pointer otherwise.

Definition at line 37 of file PropertyContainer.cpp.

37  {
38  PropertySharedPtr property;
39  if(!inName.empty()) {
40  mProperties.get(inName, property);
41  }
42  return property;
43 }
bool get(const KeyType &inKey, ValueType &outValue) const
Definition: SymTab.hpp:121
SymTab< std::string, PropertySharedPtr > mProperties
boost::shared_ptr< Property > PropertySharedPtr

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PropertyContainer& torc::generic::PropertyContainer::operator= ( const PropertyContainer source)
private
void torc::generic::PropertyContainer::setProperties ( const std::map< std::string, PropertySharedPtr > &  inSource)

Set the map of properties

Parameters
[in]inSourceThe map of properties

Definition at line 66 of file PropertyContainer.cpp.

66  {
67  std::map<std::string, PropertySharedPtr>::const_iterator it = inSource.begin();
68  for(; it != inSource.end(); it++) {
69  setProperty((*it).first, (*it).second);
70  }
71 }
bool setProperty(const std::string &inName, const PropertySharedPtr &inProperty)

+ Here is the call graph for this function:

bool torc::generic::PropertyContainer::setProperty ( const std::string &  inName,
const PropertySharedPtr inProperty 
)

Save the inSource of a property

Parameters
[in]inNameName of the property to be saved
[in]inPropertyPointer to the property object if present, empty pointer otherwise.
Returns
bool True if saved, false otherwise.

Save the inSource of a property

Parameters
[in]inNameName of the property to be saved
[in]inPopertyPointer to the property object if present, empty pointer otherwise.
Returns
bool True if saved, false otherwise.

Definition at line 53 of file PropertyContainer.cpp.

54  {
55  if(!inName.empty()) {
56  return mProperties.set(inName, inProperty);
57  }
58  return false;
59 }
bool set(const KeyType &inKey, const ValueType &inValue)
Definition: SymTab.hpp:132
SymTab< std::string, PropertySharedPtr > mProperties

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

SymTab<std::string, PropertySharedPtr> torc::generic::PropertyContainer::mProperties
private

Definition at line 99 of file PropertyContainer.hpp.


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