A handle for a particular node in a read-only hierarchy.
Use these handles to access parts of the hierarchy.
The get_value_always() methods return the appropriate value or TypeTraits::get_null_value() if the node does not have that attribute.
See the NodeHandle for modifying the contents.
Inheritance diagram for RMF::NodeConstHandle:Public Member Functions | |
| template<class T > | |
| T | get_association () const |
| Return the associated pointer for this node. | |
| NodeConstHandles | get_children () const |
| FileConstHandle | get_file () const |
| bool | get_has_association () const |
| NodeID | get_id () const |
| get a unique id for this node | |
| std::string | get_name () const |
| Return the number of child nodes. | |
| NodeType | get_type () const |
| get the type of this node | |
| operator Showable () const | |
| template<class T > | |
| void | set_association (const T &v, bool overwrite=false) |
| void | show (std::ostream &out) const |
Functions to access attributes | |
Type is one of the standard types. | |
| Types | get_value (TypeKey k, int frame=-1) const |
| Types | get_value_always (TypeKey k, unsigned int frame=0) const |
| bool | get_has_value (TypeKey k, unsigned int frame=0) const |
| T RMF::NodeConstHandle::get_association | ( | ) | const |
Return the associated pointer for this node.
An exception will be thrown if it doesn't have one.
| NodeID RMF::NodeConstHandle::get_id | ( | ) | const |
get a unique id for this node
| std::string RMF::NodeConstHandle::get_name | ( | ) | const |
Return the number of child nodes.
| NodeType RMF::NodeConstHandle::get_type | ( | ) | const |
get the type of this node
| void RMF::NodeConstHandle::set_association | ( | const T & | v, |
| bool | overwrite = false |
||
| ) |
Each node can be associated at runtime with an arbitrary piece of data to aid in maintaining the relationship with application data structures. This data type must be convertible to a void* pointer. If direct casting does not work, you can implement a function called get_void_pointer() that takes the passed type and returns a void* pointer in the namespace where the type is declared (so it is found via Koenig lookup). Support has already been added for boost::shared_ptr.
Either the association must not have been set before or overwrite must be true. If overwrite is true, the type must be the same as the old type.