MIRA
|
Abstract base class for all derived property node classes. More...
#include <serialization/PropertyNode.h>
Public Types | |
typedef std::vector< PropertyNode * > | NodeList |
Public Member Functions | |
PropertyNode (const PropertyNodeInfo &info) | |
PropertyNode (const std::string &id, const std::string &name, const std::string &comment, const Typename &type, bool isReadOnly, bool isVolatile) | |
virtual | ~PropertyNode () |
virtual PropertyNode * | parent () |
Returns the parent property node (or NULL, if this is a root node) More... | |
virtual const PropertyNode * | parent () const |
Returns the parent property node (or NULL, if this is a root node) More... | |
virtual NodeList & | children () |
Returns a vector with all child property nodes. More... | |
virtual const NodeList & | children () const |
Returns a vector with all child property nodes. More... | |
const PropertyNode * | findChildNode (const std::vector< std::string > &ids, std::size_t level=0) const |
Searches for a child property node (which may also be a child of a child of a child, etc). More... | |
PropertyNode * | findChildNode (const std::vector< std::string > &ids, std::size_t level=0) |
const PropertyNode * | findChildNode (const std::string &id) const |
Searches for a child property node (which may also be a child of a child of a child, etc). More... | |
PropertyNode * | findChildNode (const std::string &id) |
Searches for a child property node (which may also be a child of a child of a child, etc). More... | |
std::string | fullID (PropertyNode *p=NULL) const |
Returns the full qualified ID of this property, including the names of the parent properties separated by '. More... | |
virtual void | setFromJSON (const json::Value &value)=0 |
Sets the value of the property, where the value is described as JSON value. More... | |
virtual json::Value | getAsJSON () const =0 |
Returns the value of the property as JSON value. More... | |
virtual void | setFromString (const std::string &value) |
Sets the value of the property, where the value is given as string. More... | |
virtual std::string | getAsString () const |
Returns the value of the property as string. More... | |
template<typename T > | |
TypedPropertyNode< T > * | toTyped () |
Casts this property node to a typed property node, or returns NULL if the types do not match. More... | |
template<typename T > | |
const TypedPropertyNode< T > * | toTyped () const |
Casts this property node to a typed property node, or returns NULL if the types do not match. More... | |
virtual void | synchronize ()=0 |
Synchronize with the reflected object (update PropertyNode when reflected content changes) More... | |
virtual RootPropertyNode * | getRootNode () |
virtual const RootPropertyNode * | getRootNode () const |
template<typename Reflector > | |
void | reflectCommon (Reflector &r) |
template<typename Reflector > | |
void | reflectRead (Reflector &r) |
template<typename Reflector > | |
void | reflectWrite (Reflector &r) |
const std::string & | id () const |
Returns the unique id of this property. More... | |
const std::string & | name () const |
Returns the name of this property as specified in the reflect() method. More... | |
const std::string & | comment () const |
Returns the comment that is associated with this property. More... | |
const Typename & | type () const |
Returns the type of this property as Typename. More... | |
template<typename T > | |
T | getHint (const std::string &attribute, const T &defaultValue=T()) const |
Returns the specified value for the given property hint attribute. More... | |
bool | hasHint (const std::string &attribute) const |
Returns true if a hint with the specified attribute exists. More... | |
bool | isReadOnly () const |
Returns true, if this property is read-only and hence, can not be modified. More... | |
bool | isVolatile () const |
Returns true, if this property is volatile and hence, must be locked for access. More... | |
void | setName (const std::string &name) |
For internal use by PropertySerializer only: Overrides the name of the property. More... | |
Protected Member Functions | |
void | addChild (PropertyNode *child, int index=-1) |
Adds the specified property node as child node. More... | |
void | removeChild (int index) |
Removes child at specific index (without deleting it). More... | |
void | removeChildren (int index, int count) |
Removes contiguous children, starting at index (without deleting them). More... | |
void | removeChild (int index, NodeList::iterator it) |
Removes child at specific index (without deleting it). More... | |
void | removeChildren (int index, NodeList::iterator it, int count) |
Removes contiguous children, starting at index (without deleting them). More... | |
void | removeAllChildren () |
Removes all child nodes (without deleting them). More... | |
void | moveChild (int index, int destination) |
Moves a child node from index to before element at destination. More... | |
void | moveChild (int index, NodeList::iterator it, int destination, NodeList::iterator destIt) |
Moves a child node from index to before element at destination. More... | |
virtual void | beginAddChildren (PropertyNodeListenerList &listeners, int index, int count) |
Caller must ensure to keep listeners locked between beginAddChildren and endAddChildren! More... | |
virtual void | endAddChildren (PropertyNodeListenerList &listeners) |
virtual void | beginRemoveChildren (PropertyNodeListenerList &listeners, int index, NodeList::iterator it, int count) |
Caller must ensure to keep listeners locked between beginRemoveChildren and endRemoveChildren! More... | |
virtual void | endRemoveChildren (PropertyNodeListenerList &listeners) |
virtual void | beginMoveChildren (PropertyNodeListenerList &listeners, int index, NodeList::iterator it, int count, int destination) |
Caller must ensure to keep listeners locked between beginMoveChildren and endMoveChildren! More... | |
virtual void | endMoveChildren (PropertyNodeListenerList &listeners) |
Protected Attributes | |
std::string | mID |
the unique id of the property More... | |
std::string | mName |
the name of the property (mostly equal to mID) More... | |
std::string | mComment |
the comment that is associated to the property More... | |
PropertyHint | mHint |
the specified property hints More... | |
Typename | mType |
the type of the property More... | |
bool | mIsReadOnly |
indicates whether the property is read-only More... | |
bool | mIsVolatile |
indicates whether the property is volatile More... | |
Friends | |
class | PropertySerializer |
Abstract base class for all derived property node classes.
A property node represents a property, which 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. A property node usually is part of a hierarchy of property nodes. If a property has a member that itself is property, its corresponding property node is added as children to the parent node.
The property nodes are created by the PropertySerializer that is used to visit all properties that are specified in the reflect() methods of the objects. The PropertySerializer will create TypedPropertyNode instances that implement the abstract PropertyNode class for each certain type.
typedef std::vector<PropertyNode*> NodeList |
|
inline |
|
inline |
|
virtual |
|
inlinevirtual |
Returns the parent property node (or NULL, if this is a root node)
Reimplemented in TypedRemotePropertyNode< T >.
|
inlinevirtual |
Returns the parent property node (or NULL, if this is a root node)
Reimplemented in TypedRemotePropertyNode< T >.
|
inlinevirtual |
Returns a vector with all child property nodes.
Reimplemented in TypedRemotePropertyNode< T >.
|
inlinevirtual |
Returns a vector with all child property nodes.
Reimplemented in TypedRemotePropertyNode< T >.
const PropertyNode* findChildNode | ( | const std::vector< std::string > & | ids, |
std::size_t | level = 0 |
||
) | const |
Searches for a child property node (which may also be a child of a child of a child, etc).
The "path" to the child node is specified via the provided vector, where the first item corresponds to the id of the child property, the second item corresponds to the child property of the child property, etc. The parameter 'level' specifies the item where to start within the specified vector, this parameter usually will be 0 in the first call.
PropertyNode* findChildNode | ( | const std::vector< std::string > & | ids, |
std::size_t | level = 0 |
||
) |
The "path" to the child node is specified via the provided vector, where the first item corresponds to the id of the child property, the second item corresponds to the child property of the child property, etc. The parameter 'level' specifies the item where to start within the specified vector, this parameter usually will be 0 in the first call.
const PropertyNode* findChildNode | ( | const std::string & | id | ) | const |
Searches for a child property node (which may also be a child of a child of a child, etc).
The "path" to the property is addressed via its full name. The following example
addresses the child property "value" of the property "myMember" of the child property "myObject".
PropertyNode* findChildNode | ( | const std::string & | id | ) |
Searches for a child property node (which may also be a child of a child of a child, etc).
The "path" to the property is addressed via its full name. The following example
addresses the child property "value" of the property "myMember" of the child property "myObject".
|
inline |
Returns the full qualified ID of this property, including the names of the parent properties separated by '.
'
If no optional parameter is specified, the name is generated up to the root of the property hierarchy. If another parent node is specified as the name is generated relative to that node.
|
pure virtual |
Sets the value of the property, where the value is described as JSON value.
Implemented in TypedRemotePropertyNode< T >, TypedPropertyNodeImpl< Accessor< Getter, Setter > >, TypedPropertyNodeImpl< T * >, and TypedPropertyNodeImpl< T >.
|
pure virtual |
Returns the value of the property as JSON value.
Implemented in TypedRemotePropertyNode< T >, TypedPropertyNodeImpl< Accessor< Getter, Setter > >, TypedPropertyNodeImpl< T * >, and TypedPropertyNodeImpl< T >.
|
virtual |
Sets the value of the property, where the value is given as string.
|
virtual |
Returns the value of the property as string.
|
inline |
Casts this property node to a typed property node, or returns NULL if the types do not match.
|
inline |
Casts this property node to a typed property node, or returns NULL if the types do not match.
|
pure virtual |
Synchronize with the reflected object (update PropertyNode when reflected content changes)
Implemented in TypedRemotePropertyNode< T >.
|
virtual |
Reimplemented in RootPropertyNode.
|
virtual |
Reimplemented in RootPropertyNode.
|
protected |
Adds the specified property node as child node.
Inserts before the element at position index (or at end, if index is not a valid position). Notifies all registered listeners.
|
inlineprotected |
Removes child at specific index (without deleting it).
Notifies all registered listeners.
|
inlineprotected |
Removes contiguous children, starting at index (without deleting them).
Notifies all registered listeners.
|
protected |
Removes child at specific index (without deleting it).
Notifies all registered listeners. Use this for efficiency if iterator is already known, otherwise use removeChild(index)
|
protected |
Removes contiguous children, starting at index (without deleting them).
Notifies all registered listeners. Use this for efficiency if iterator is already known, otherwise use removeChild(index) Iterator it must be a forward iterator to the first of the removed children (at index).
|
protected |
Removes all child nodes (without deleting them).
Notifies all registered listeners.
|
inlineprotected |
Moves a child node from index to before element at destination.
Notifies all registered listeners.
|
protected |
Moves a child node from index to before element at destination.
Notifies all registered listeners. Use this for efficiency if iterators are already known, otherwise use moveChild(index, destination)
|
protectedvirtual |
Caller must ensure to keep listeners locked between beginAddChildren and endAddChildren!
|
protectedvirtual |
|
protectedvirtual |
Caller must ensure to keep listeners locked between beginRemoveChildren and endRemoveChildren!
|
protectedvirtual |
|
protectedvirtual |
Caller must ensure to keep listeners locked between beginMoveChildren and endMoveChildren!
|
protectedvirtual |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Returns the unique id of this property.
|
inlineinherited |
Returns the name of this property as specified in the reflect() method.
|
inlineinherited |
Returns the comment that is associated with this property.
|
inlineinherited |
Returns the type of this property as Typename.
|
inlineinherited |
Returns the specified value for the given property hint attribute.
If no such attribute is set in this hint, then the defaultValue is returned.
|
inlineinherited |
Returns true if a hint with the specified attribute exists.
|
inlineinherited |
Returns true, if this property is read-only and hence, can not be modified.
|
inlineinherited |
Returns true, if this property is volatile and hence, must be locked for access.
|
inlineinherited |
For internal use by PropertySerializer only: Overrides the name of the property.
|
friend |
|
protectedinherited |
the unique id of the property
|
protectedinherited |
the name of the property (mostly equal to mID)
|
protectedinherited |
the comment that is associated to the property
|
protectedinherited |
the specified property hints
|
protectedinherited |
the type of the property
|
protectedinherited |
indicates whether the property is read-only
|
protectedinherited |
indicates whether the property is volatile