MIRA
Public Member Functions | List of all members
PropertyManager Class Reference

The property manager maintains the properties of objects that are added to the manager. More...

#include <serialization/PropertyManager.h>

Public Member Functions

 PropertyManager ()
 
template<typename T >
void addObject (const char *name, T &object)
 Add the specified object to the PropertyManager under the specified name. More...
 
template<typename T >
void setProperty (const std::string &name, const T &value)
 Modifies the value of the specified property. More...
 
template<typename T >
getProperty (const std::string &name) const
 Obtains the value of the specified property. More...
 
const PropertyNodegetRootNode () const
 Returns the root node of the managed property tree. More...
 
PropertyNodegetRootNode ()
 Returns the root node of the managed property tree. More...
 
const PropertyNodegetPropertyNode (const std::string &name) const
 Returns the PropertyNode that represents the specified property. More...
 
PropertyNodegetPropertyNode (const std::string &name)
 Returns the PropertyNode that represents the specified property. More...
 
template<typename T >
const TypedPropertyNode< T > * getPropertyNode (const std::string &name) const
 Returns a typed PropertyNode that represents the specified property. More...
 
template<typename T >
TypedPropertyNode< T > * getPropertyNode (const std::string &name)
 Returns the PropertyNode that represents the specified property. More...
 

Detailed Description

The property manager maintains the properties of objects that are added to the manager.

A property is a special member of an object that is reflected via the "property" method to indicate that the member can be changed dynamically at runtime. For each object that is added via the addObject() method, all properties are reflected using the PropertySerializer. For each property a PropertyNode is created and stored within the manager. The value of properties of managed objects can be set and obtained using the setProperty() and getProperty() methods. Moreover, the PropertyNode of a property can be obtained directly through the getPropertyNode() methods.

Constructor & Destructor Documentation

◆ PropertyManager()

PropertyManager ( )
inline

Member Function Documentation

◆ addObject()

void addObject ( const char *  name,
T &  object 
)
inline

Add the specified object to the PropertyManager under the specified name.

After calling this method, the properties of the object can be obtained and modified using the getProperty() and setProperty() methods. For each property within the objects members, a PropertyNode is created.

◆ setProperty()

void setProperty ( const std::string &  name,
const T &  value 
)
inline

Modifies the value of the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

accesses the property member "value" of the member "myMember" of the object "myObject" that was added via addObject.

Exceptions
XBadCastIf the specified property is not of type T.
XLogicalIf the property is read-only, or does not exist.

◆ getProperty()

T getProperty ( const std::string &  name) const
inline

Obtains the value of the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

accesses the property member "value" of the member "myMember" of the object "myObject" that was added via addObject.

Exceptions
XBadCastIf the specified property is not of type T.
XLogicalIf the property does not exist.

◆ getRootNode() [1/2]

const PropertyNode* getRootNode ( ) const
inline

Returns the root node of the managed property tree.

Each child node of the root node corresponds to an object that was added via addObject().

◆ getRootNode() [2/2]

PropertyNode* getRootNode ( )
inline

Returns the root node of the managed property tree.

Each child node of the root node corresponds to an object that was added via addObject().

◆ getPropertyNode() [1/4]

const PropertyNode* getPropertyNode ( const std::string &  name) const
inline

Returns the PropertyNode that represents the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

returns the PropertyNode of the property member "value" of the member "myMember" of the object "myObject" that was added via addObject. Returns nullptr if no property with the given name exists.

◆ getPropertyNode() [2/4]

PropertyNode* getPropertyNode ( const std::string &  name)
inline

Returns the PropertyNode that represents the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

returns the PropertyNode of the property member "value" of the member "myMember" of the object "myObject" that was added via addObject. Returns nullptr if no property with the given name exists.

◆ getPropertyNode() [3/4]

const TypedPropertyNode<T>* getPropertyNode ( const std::string &  name) const
inline

Returns a typed PropertyNode that represents the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

returns the PropertyNode of the property member "value" of the member "myMember" of the object "myObject" that was added via addObject. Returns nullptr if no property with the given name exists.

Exceptions
XBadCastIf the specified property is not of type T.

◆ getPropertyNode() [4/4]

TypedPropertyNode<T>* getPropertyNode ( const std::string &  name)
inline

Returns the PropertyNode that represents the specified property.

The property is addressed via its full name. The following example:

myObject.myMember.value

returns the PropertyNode of the property member "value" of the member "myMember" of the object "myObject" that was added via addObject. Returns nullptr if no property with the given name exists.


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