MIRA
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
TypedPropertyNodeImplGetSetMixin< T, bool > Class Template Referenceabstract

Partial Implementations of the get/set of TypedPropertyNode specialized for normal classes / for classes that are not copyable. More...

#include <serialization/PropertyNode.h>

Inheritance diagram for TypedPropertyNodeImplGetSetMixin< T, bool >:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 TypedPropertyNodeImplGetSetMixin (const std::string &id, const std::string &name, const std::string &comment, value_type &value, bool isReadOnly, bool isVolatile)
 
virtual value_type get () const
 Returns the value of the property. More...
 
virtual void set (const value_type &value)=0
 Sets the property to the specified 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 NodeListchildren ()
 Returns a vector with all child property nodes. More...
 
virtual const NodeListchildren () const
 Returns a vector with all child property nodes. 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 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 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 Types

typedef LockedPropertyNodeAccess< TypedPropertyNodeImplGetSetMixinBase< T >, value_type, true, IsCopyAssignable< value_type >::valueLockedAccess
 

Protected Member Functions

void setValue (const value_type &value)
 
const LockedAccess value () const
 
LockedAccess value ()
 
void update (T &value)
 Is called by PropertySerializer to update the internal representation of the value of the property. More...
 
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

friend LockedAccess
 
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, bool>
class mira::TypedPropertyNodeImplGetSetMixin< T, bool >

Partial Implementations of the get/set of TypedPropertyNode specialized for normal classes / for classes that are not copyable.

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

Member Typedef Documentation

◆ value_type

◆ LockedAccess

◆ NodeList

typedef std::vector<PropertyNode*> NodeList
inherited

Constructor & Destructor Documentation

◆ TypedPropertyNodeImplGetSetMixin()

TypedPropertyNodeImplGetSetMixin ( const std::string &  id,
const std::string &  name,
const std::string &  comment,
value_type value,
bool  isReadOnly,
bool  isVolatile 
)
inline

Member Function Documentation

◆ setValue()

void setValue ( const value_type value)
inlineprotected

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IF YOU GET A COMPILER ERROR HERE, your class with type ValueType does not support the assignment operator. In this case, you must specialize mira::IsCopyAssignable for your type to indicate that. This will resolve this issue.

◆ get()

virtual value_type get ( ) const
inlinevirtual

Returns the value of the property.

Implements TypedPropertyNode< T >.

◆ value() [1/2]

const LockedAccess value ( ) const
inlineprotectedinherited

◆ value() [2/2]

LockedAccess value ( )
inlineprotectedinherited

◆ update()

void update ( T &  value)
inlineprotectedinherited

Is called by PropertySerializer to update the internal representation of the value of the property.

Not meant to be called anywhere else!

◆ set()

virtual void set ( const value_type value)
pure virtualinherited

◆ parent() [1/2]

virtual PropertyNode* parent ( )
inlinevirtualinherited

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

Reimplemented in TypedRemotePropertyNode< T >.

◆ parent() [2/2]

virtual const PropertyNode* parent ( ) const
inlinevirtualinherited

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

Reimplemented in TypedRemotePropertyNode< T >.

◆ children() [1/2]

virtual NodeList& children ( )
inlinevirtualinherited

Returns a vector with all child property nodes.

Reimplemented in TypedRemotePropertyNode< T >.

◆ children() [2/2]

virtual const NodeList& children ( ) const
inlinevirtualinherited

Returns a vector with all child property nodes.

Reimplemented in TypedRemotePropertyNode< 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.

◆ setFromJSON()

virtual void setFromJSON ( const json::Value value)
pure virtualinherited

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

◆ getAsJSON()

virtual json::Value getAsJSON ( ) const
pure virtualinherited

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

◆ synchronize()

virtual void synchronize ( )
pure virtualinherited

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

Implemented in TypedRemotePropertyNode< T >.

◆ 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

◆ LockedAccess

friend LockedAccess
protectedinherited

◆ 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: