MIRA
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TypedRemotePropertyNode< T > Class Template Reference

Special TypedPropertyNode for remote properties. More...

#include <serialization/PropertyNode.h>

Inheritance diagram for TypedRemotePropertyNode< T >:
Inheritance graph
[legend]

Public Types

typedef TypedPropertyNode< T > Base
 
typedef Base::value_type value_type
 
typedef std::vector< PropertyNode * > NodeList
 

Public Member Functions

 TypedRemotePropertyNode (AbstractRemotePropertyNode *node)
 
virtual void setFromJSON (const json::Value &node)
 Sets the value of the property, where the value is described as JSON value. More...
 
virtual json::Value getAsJSON () const
 Returns the value of the property as JSON value. More...
 
virtual PropertyNodeparent ()
 Returns the parent property node (or NULL, if this is a root node) More...
 
virtual const PropertyNodeparent () const
 Returns the parent property node (or NULL, if this is a root node) More...
 
virtual PropertyNode::NodeListchildren ()
 Returns a vector with all child property nodes. More...
 
virtual const PropertyNode::NodeListchildren () const
 Returns a vector with all child property nodes. More...
 
virtual void synchronize ()
 Synchronize with the reflected object (update PropertyNode when reflected content changes) More...
 
virtual void set (const value_type &value)
 Sets the property to the specified value. More...
 
virtual value_type get () const
 Returns the value of the property. More...
 
const PropertyNodefindChildNode (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...
 
PropertyNodefindChildNode (const std::vector< std::string > &ids, std::size_t level=0)
 
const PropertyNodefindChildNode (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...
 
PropertyNodefindChildNode (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 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 RootPropertyNodegetRootNode ()
 
virtual const RootPropertyNodegetRootNode () 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 Typenametype () const
 Returns the type of this property as Typename. More...
 
template<typename 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 removeChild (int index, NodeList::iterator it)
 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 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...
 

Detailed Description

template<typename T>
class mira::TypedRemotePropertyNode< T >

Special TypedPropertyNode for remote properties.

Instances of this class are created by the toTyped() method of the AbstractRemotePropertyNode class. The instances are also owned by their corresponding AbstractRemotePropertyNode objects.

This class stores the PropertyNodeInfo only AND is of the correct type of the underlying property. Instances of this class have no further information concerning the property hierarchy. Calls to the parent() and children() methods are delegated to the associated AbstractRemotePropertyNode class.

Besides the sole PropertyNodeInfo this class only provides get() and set(). These methods depend on the data type of the property. They serialize the data into JSON format and delegate the data via setFromJSON() and getAsJSON() to the associated AbstractRemotePropertyNode class (which must handle the remote transport).

Note
This class is for internal use by the property serialization framework

Member Typedef Documentation

◆ Base

typedef TypedPropertyNode<T> Base

◆ value_type

◆ NodeList

typedef std::vector<PropertyNode*> NodeList
inherited

Constructor & Destructor Documentation

◆ TypedRemotePropertyNode()

Member Function Documentation

◆ setFromJSON()

virtual void setFromJSON ( const json::Value value)
inlinevirtual

Sets the value of the property, where the value is described as JSON value.

Implements PropertyNode.

◆ getAsJSON()

virtual json::Value getAsJSON ( ) const
inlinevirtual

Returns the value of the property as JSON value.

Implements PropertyNode.

◆ parent() [1/2]

virtual PropertyNode* parent ( )
inlinevirtual

Returns the parent property node (or NULL, if this is a root node)

Reimplemented from PropertyNode.

◆ parent() [2/2]

virtual const PropertyNode* parent ( ) const
inlinevirtual

Returns the parent property node (or NULL, if this is a root node)

Reimplemented from PropertyNode.

◆ children() [1/2]

virtual PropertyNode::NodeList& children ( )
inlinevirtual

Returns a vector with all child property nodes.

Reimplemented from PropertyNode.

◆ children() [2/2]

virtual const PropertyNode::NodeList& children ( ) const
inlinevirtual

Returns a vector with all child property nodes.

Reimplemented from PropertyNode.

◆ synchronize()

virtual void synchronize ( )
inlinevirtual

Synchronize with the reflected object (update PropertyNode when reflected content changes)

Implements PropertyNode.

◆ set()

virtual void set ( const value_type value)
inlinevirtual

Sets the property to the specified value.

Implements TypedPropertyNode< T >.

◆ get()

virtual value_type get ( ) const
inlinevirtual

Returns the value of the property.

Implements TypedPropertyNode< T >.

◆ findChildNode() [1/4]

const PropertyNode* findChildNode ( const std::vector< std::string > &  ids,
std::size_t  level = 0 
) const
inherited

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.

◆ findChildNode() [2/4]

PropertyNode* findChildNode ( const std::vector< std::string > &  ids,
std::size_t  level = 0 
)
inherited

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.

◆ findChildNode() [3/4]

const PropertyNode* findChildNode ( const std::string &  id) const
inherited

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

myObject.myMember.value

addresses the child property "value" of the property "myMember" of the child property "myObject".

◆ findChildNode() [4/4]

PropertyNode* findChildNode ( const std::string &  id)
inherited

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

myObject.myMember.value

addresses the child property "value" of the property "myMember" of the child property "myObject".

◆ fullID()

std::string fullID ( PropertyNode p = NULL) const
inlineinherited

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.

◆ setFromString()

virtual void setFromString ( const std::string &  value)
virtualinherited

Sets the value of the property, where the value is given as string.

◆ getAsString()

virtual std::string getAsString ( ) const
virtualinherited

Returns the value of the property as string.

◆ toTyped() [1/2]

TypedPropertyNode< T > * toTyped ( )
inlineinherited

Casts this property node to a typed property node, or returns NULL if the types do not match.

◆ toTyped() [2/2]

const TypedPropertyNode< T > * toTyped ( ) const
inlineinherited

Casts this property node to a typed property node, or returns NULL if the types do not match.

◆ getRootNode() [1/2]

virtual RootPropertyNode* getRootNode ( )
virtualinherited

Reimplemented in RootPropertyNode.

◆ getRootNode() [2/2]

virtual const RootPropertyNode* getRootNode ( ) const
virtualinherited

Reimplemented in RootPropertyNode.

◆ addChild()

void addChild ( PropertyNode child,
int  index = -1 
)
protectedinherited

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.

◆ removeChild() [1/2]

void removeChild ( int  index)
inlineprotectedinherited

Removes child at specific index (without deleting it).

Notifies all registered listeners.

◆ removeChild() [2/2]

void removeChild ( int  index,
NodeList::iterator  it 
)
protectedinherited

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)

◆ removeChildren() [1/2]

void removeChildren ( int  index,
int  count 
)
inlineprotectedinherited

Removes contiguous children, starting at index (without deleting them).

Notifies all registered listeners.

◆ removeChildren() [2/2]

void removeChildren ( int  index,
NodeList::iterator  it,
int  count 
)
protectedinherited

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).

◆ removeAllChildren()

void removeAllChildren ( )
protectedinherited

Removes all child nodes (without deleting them).

Notifies all registered listeners.

◆ moveChild() [1/2]

void moveChild ( int  index,
int  destination 
)
inlineprotectedinherited

Moves a child node from index to before element at destination.

Notifies all registered listeners.

◆ moveChild() [2/2]

void moveChild ( int  index,
NodeList::iterator  it,
int  destination,
NodeList::iterator  destIt 
)
protectedinherited

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)

◆ beginAddChildren()

virtual void beginAddChildren ( PropertyNodeListenerList listeners,
int  index,
int  count 
)
protectedvirtualinherited

Caller must ensure to keep listeners locked between beginAddChildren and endAddChildren!

◆ endAddChildren()

virtual void endAddChildren ( PropertyNodeListenerList listeners)
protectedvirtualinherited

◆ beginRemoveChildren()

virtual void beginRemoveChildren ( PropertyNodeListenerList listeners,
int  index,
NodeList::iterator  it,
int  count 
)
protectedvirtualinherited

Caller must ensure to keep listeners locked between beginRemoveChildren and endRemoveChildren!

◆ endRemoveChildren()

virtual void endRemoveChildren ( PropertyNodeListenerList listeners)
protectedvirtualinherited

◆ beginMoveChildren()

virtual void beginMoveChildren ( PropertyNodeListenerList listeners,
int  index,
NodeList::iterator  it,
int  count,
int  destination 
)
protectedvirtualinherited

Caller must ensure to keep listeners locked between beginMoveChildren and endMoveChildren!

◆ endMoveChildren()

virtual void endMoveChildren ( PropertyNodeListenerList listeners)
protectedvirtualinherited

◆ reflectCommon()

void reflectCommon ( Reflector &  r)
inlineinherited

◆ reflectRead()

void reflectRead ( Reflector &  r)
inlineinherited

◆ reflectWrite()

void reflectWrite ( Reflector &  r)
inlineinherited

◆ id()

const std::string& id ( ) const
inlineinherited

Returns the unique id of this property.

◆ name()

const std::string& name ( ) const
inlineinherited

Returns the name of this property as specified in the reflect() method.

◆ comment()

const std::string& comment ( ) const
inlineinherited

Returns the comment that is associated with this property.

◆ type()

const Typename& type ( ) const
inlineinherited

Returns the type of this property as Typename.

◆ getHint()

T getHint ( const std::string &  attribute,
const T &  defaultValue = T() 
) const
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.

◆ hasHint()

bool hasHint ( const std::string &  attribute) const
inlineinherited

Returns true if a hint with the specified attribute exists.

◆ isReadOnly()

bool isReadOnly ( ) const
inlineinherited

Returns true, if this property is read-only and hence, can not be modified.

◆ isVolatile()

bool isVolatile ( ) const
inlineinherited

Returns true, if this property is volatile and hence, must be locked for access.

◆ setName()

void setName ( const std::string &  name)
inlineinherited

For internal use by PropertySerializer only: Overrides the name of the property.

Member Data Documentation

◆ mID

std::string mID
protectedinherited

the unique id of the property

◆ mName

std::string mName
protectedinherited

the name of the property (mostly equal to mID)

◆ mComment

std::string mComment
protectedinherited

the comment that is associated to the property

◆ mHint

PropertyHint mHint
protectedinherited

the specified property hints

◆ mType

Typename mType
protectedinherited

the type of the property

◆ mIsReadOnly

bool mIsReadOnly
protectedinherited

indicates whether the property is read-only

◆ mIsVolatile

bool mIsVolatile
protectedinherited

indicates whether the property is volatile


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