TwiceAsNice  2019-02-18
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Nice::Joint Class Reference

This class represents one node of the configuration tree. Each joint can have a set of children joint OR a leaf which is of the type defined by the template parameter. The class provides several operators to set and extract data to and from a joint node. More...

#include <Joint.h>

Inheritance diagram for Nice::Joint:
Inheritance graph
Collaboration diagram for Nice::Joint:
Collaboration graph

Public Member Functions

 Joint ()
 Constructor of a joint node. More...
 
 Joint (const std::string &_name)
 Constructor. More...
 
 ~Joint ()
 Destructor. More...
 
std::string toString ()
 returns tree as string. More...
 
bool exist (const std::string &_path) const
 Checks if a node exists. More...
 
template<typename Type >
void operator= (const Type &_val)
 Stream operator. More...
 
void set (const Nice::PropertyPtr &_p)
 Set a Nice::Property as leaf at this node. More...
 
void set (const char *_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const char *_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const std::string &_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const std::string &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
template<typename Type >
void set (const Type &_val)
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
template<typename Type >
void set (const Type &_val, const Nice::Date &_date)
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
template<typename Type >
void set (const Type &_val, Nice::I64 _setterId, const Nice::Date &=Nice::Date::now())
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
void setAtNode (const std::string &_node, const Nice::PropertyPtr &_p)
 Set a Nice::Property as leaf at node _node. More...
 
void setAtNode (const char *_node, const Nice::PropertyPtr &_p)
 Set a const char * as a std::string leaf atnode _node. More...
 
void setAtNode (const std::string &_node, const char *_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at node _node. More...
 
void setAtNode (const std::string &_node, const char *_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at node _node. More...
 
template<typename Type >
void setAtNode (const char *_node, const Type &_val, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const char *_node, const Type &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const std::string &_node, const Type &_val, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const std::string &_node, const Type &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setIfNotExist (const Type &_default)
 Set type Type as a leaf if it doesnt exist. More...
 
template<typename Type >
void setIfNotExist (const std::string &_node, const Type &_default)
 Set type Type as a leaf at node _node if it doesnt exist. More...
 
template<typename Type >
Type get ()
 Get data from Property with a specific data type Type. More...
 
template<typename Type >
Type getAtNode (const std::string &_node)
 Get data from Property at a subnode with a specific data type Type. More...
 
template<typename Type >
Type getWithDefault (const Type &_default)
 Get data from Property with a specific data type Type. More...
 
template<typename Type >
Type getWithDefault (const std::string &_node, const Type &_default, bool _warning=false)
 Get data from Property with a specific data type Type at a subnode. More...
 
const Nice::PropertyPtrleaf ()
 Get the connected Property pointer from the current node. More...
 
template<typename Type >
const Nice::PropertyPtrleaf ()
 Get the connected Property pointer from the current node and create leaf if its not there. More...
 
template<typename Type >
const Nice::PropertyPtrleaf (const std::string &_path, bool _create=true)
 Get the connected Property pointer from a specific subnode. More...
 
const Nice::PropertyPtrleaf (const std::string &_path, bool _create=true)
 Get the connected Property pointer from a specific subnode. More...
 
Nice::JointPtr node (const std::string &_path, bool _create=true)
 Get the Joint pointer from a specific subnode. More...
 
Nice::JointPtr parent () const
 Get the parent joint of this. More...
 
Nice::JointPtrVector getParents ()
 Get the entire path to this started by the Root joint. More...
 
int depth ()
 Get the entire path to this started by the Root joint. More...
 
JointPtrMap children ()
 Get a reference to the children vector. More...
 
void children (JointPtrVector &_children, const std::string &_pre="", bool _exact=false)
 Get a vector of all children joint. More...
 
void children (SeqString &_children, const std::string &_pre="", bool _exact=false)
 Get a vector of all children as node strings. More...
 
size_t leafs (JointPtrVector &_leaf, const std::string &_pre="", bool _exact=false)
 Get a vector of leaf joints. More...
 
template<typename T >
size_t leafsWithType (JointPtrVector &_leaf, const std::string &_pre="", bool _exact=false)
 Get a vector of leaf joints with type TYPE. More...
 
template<typename T >
size_t leafsWithBridgeType (JointPtrVector &_leaf, const std::string &_id)
 Get a vector of leaf joints with bridge type TYPE. More...
 
size_t leafCount (const std::string &_pre="")
 Get the amount of leafs (endpoints) this subtree contains. More...
 
bool isChildOf (const JointPtr &_branch) const
 Checks if a joint is a child of this. More...
 
size_t childCount () const
 Checks if a joint is a leaf. More...
 
bool hasLeaf () const
 Checks if a joint has a Property. More...
 
std::string path (const JointPtr &_leaf=0) const
 Get the entire path to this started by the Root joint. More...
 
const std::string & name () const
 Get the entire path string from this to a leaf seperated by ".". More...
 
void replace (const Nice::JointPtr &_branch)
 adds a subtree to the current node, existing sub tree will be deleted. More...
 
void merge (const Nice::JointPtr &_branch, bool _overwrite=true)
 adds a subtree to the current node, existing sub tree will be merged. More...
 
void merge (const std::string &_node, const Nice::JointPtr &_branch, bool _overwrite=true)
 adds a subtree to the current node, existing sub tree will be merged. More...
 
void mergeContext (const Nice::JointPtr &_branch)
 merge the context(Property values) of a node to this node existing sub tree will be merged. More...
 
bool operator== (const JointPtr &_value)
 
template<typename Type >
 operator Type ()
 Returns a copy of leaf. More...
 
 Joint ()
 Constructor of a joint node. More...
 
 Joint (const std::string &_name)
 Constructor. More...
 
 ~Joint ()
 Destructor. More...
 
std::string toString ()
 returns tree as string. More...
 
bool exist (const std::string &_path) const
 Checks if a node exists. More...
 
template<typename Type >
void operator= (const Type &_val)
 Stream operator. More...
 
void set (const Nice::PropertyPtr &_p)
 Set a Nice::Property as leaf at this node. More...
 
void set (const char *_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const char *_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const std::string &_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
void set (const std::string &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at this node. More...
 
template<typename Type >
void set (const Type &_val)
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
template<typename Type >
void set (const Type &_val, const Nice::Date &_date)
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
template<typename Type >
void set (const Type &_val, Nice::I64 _setterId, const Nice::Date &=Nice::Date::now())
 Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf. More...
 
void setAtNode (const std::string &_node, const Nice::PropertyPtr &_p)
 Set a Nice::Property as leaf at node _node. More...
 
void setAtNode (const char *_node, const Nice::PropertyPtr &_p)
 Set a const char * as a std::string leaf atnode _node. More...
 
void setAtNode (const std::string &_node, const char *_val, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at node _node. More...
 
void setAtNode (const std::string &_node, const char *_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set a const char * as a std::string leaf at node _node. More...
 
template<typename Type >
void setAtNode (const char *_node, const Type &_val, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const char *_node, const Type &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const std::string &_node, const Type &_val, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setAtNode (const std::string &_node, const Type &_val, Nice::I64 _setterId, const Nice::Date &_date=Nice::Date::now())
 Set type Type as a leaf of type Type at node _node. More...
 
template<typename Type >
void setIfNotExist (const Type &_default)
 Set type Type as a leaf if it doesnt exist. More...
 
template<typename Type >
void setIfNotExist (const std::string &_node, const Type &_default)
 Set type Type as a leaf at node _node if it doesnt exist. More...
 
template<typename Type >
Type get ()
 Get data from Property with a specific data type Type. More...
 
template<typename Type >
Type getAtNode (const std::string &_node)
 Get data from Property at a subnode with a specific data type Type. More...
 
template<typename Type >
Type getWithDefault (const Type &_default)
 Get data from Property with a specific data type Type. More...
 
template<typename Type >
Type getWithDefault (const std::string &_node, const Type &_default, bool _warning=false)
 Get data from Property with a specific data type Type at a subnode. More...
 
const Nice::PropertyPtrleaf ()
 Get the connected Property pointer from the current node. More...
 
template<typename Type >
const Nice::PropertyPtrleaf ()
 Get the connected Property pointer from the current node and create leaf if its not there. More...
 
template<typename Type >
const Nice::PropertyPtrleaf (const std::string &_path, bool _create=true)
 Get the connected Property pointer from a specific subnode. More...
 
const Nice::PropertyPtrleaf (const std::string &_path, bool _create=true)
 Get the connected Property pointer from a specific subnode. More...
 
Nice::JointPtr node (const std::string &_path, bool _create=true)
 Get the Joint pointer from a specific subnode. More...
 
Nice::JointPtr parent () const
 Get the parent joint of this. More...
 
Nice::JointPtrVector getParents ()
 Get the entire path to this started by the Root joint. More...
 
int depth ()
 Get the entire path to this started by the Root joint. More...
 
JointPtrMap children ()
 Get a reference to the children vector. More...
 
void children (JointPtrVector &_children, const std::string &_pre="", bool _exact=false)
 Get a vector of all children joint. More...
 
void children (SeqString &_children, const std::string &_pre="", bool _exact=false)
 Get a vector of all children as node strings. More...
 
size_t leafs (JointPtrVector &_leaf, const std::string &_pre="", bool _exact=false)
 Get a vector of leaf joints. More...
 
template<typename T >
size_t leafsWithType (JointPtrVector &_leaf, const std::string &_pre="", bool _exact=false)
 Get a vector of leaf joints with type TYPE. More...
 
template<typename T >
size_t leafsWithBridgeType (JointPtrVector &_leaf, const std::string &_id)
 Get a vector of leaf joints with bridge type TYPE. More...
 
size_t leafCount (const std::string &_pre="")
 Get the amount of leafs (endpoints) this subtree contains. More...
 
bool isChildOf (const JointPtr &_branch) const
 Checks if a joint is a child of this. More...
 
size_t childCount () const
 Checks if a joint is a leaf. More...
 
bool hasLeaf () const
 Checks if a joint has a Property. More...
 
std::string path (const JointPtr &_leaf=0) const
 Get the entire path to this started by the Root joint. More...
 
const std::string & name () const
 Get the entire path string from this to a leaf seperated by ".". More...
 
void replace (const Nice::JointPtr &_branch)
 adds a subtree to the current node, existing sub tree will be deleted. More...
 
void merge (const Nice::JointPtr &_branch, bool _overwrite=true)
 adds a subtree to the current node, existing sub tree will be merged. More...
 
void merge (const std::string &_node, const Nice::JointPtr &_branch, bool _overwrite=true)
 adds a subtree to the current node, existing sub tree will be merged. More...
 
void mergeContext (const Nice::JointPtr &_branch)
 merge the context(Property values) of a node to this node existing sub tree will be merged. More...
 
bool operator== (const JointPtr &_value)
 
template<typename Type >
 operator Type ()
 Returns a copy of leaf. More...
 

Static Public Member Functions

static void chop (Nice::JointPtr &_node)
 Delete all children, deregister with parent and move _node pointer to the the next parent. More...
 
static void chop (Nice::JointPtr &_node)
 Delete all children, deregister with parent and move _node pointer to the the next parent. More...
 

Protected Member Functions

 Joint (const Nice::JointPtr &_joint, const Nice::JointPtr &_parent)
 Copyconstructor. More...
 
 Joint (const std::string &_name, const Nice::JointPtr &_parent)
 Constructor. More...
 
 Joint (const Nice::JointPtr &_joint, const Nice::JointPtr &_parent)
 Copyconstructor. More...
 
 Joint (const std::string &_name, const Nice::JointPtr &_parent)
 Constructor. More...
 

Private Attributes

Nice::JointPtrThreadSafeMap m_children
 
std::string m_name
 
Nice::Jointm_parent
 
Nice::PropertyPtr m_leaf
 

Detailed Description

This class represents one node of the configuration tree. Each joint can have a set of children joint OR a leaf which is of the type defined by the template parameter. The class provides several operators to set and extract data to and from a joint node.

Author
Juergen Berwein
Version
Date
2012-08-10 11:04:58 AM
Todo:
implementation of adding joint subtrees to an existing tree is incosistent! following methods should use void append(const Nice::JointPtr& _branch) explicit Joint( const Nice::JointPtr & _joint, const Nice::JointPtr & _parent =0 );
Author
Juergen Berwein
Version
Date
2012-08-10 11:04:58 AM
Todo:
implementation of adding joint subtrees to an existing tree is incosistent! following methods should use void append(const Nice::JointPtr& _branch) explicit Joint( const Nice::JointPtr & _joint, const Nice::JointPtr & _parent =0 );

Constructor & Destructor Documentation

◆ Joint() [1/8]

Nice::Joint::Joint ( const Nice::JointPtr _joint,
const Nice::JointPtr _parent 
)
explicitprotected

Copyconstructor.

The entire subtree will be copied.

Parameters
_jointJoint to copy.
_parentNew parent joint of the copy.

◆ Joint() [2/8]

Nice::Joint::Joint ( const std::string &  _name,
const Nice::JointPtr _parent 
)
explicitprotected

Constructor.

Creates a new joint with a specified name.

Parameters
_nameName of the new joint.
_parentParent of the new joint. By default a node has no parent, so a root joint with another name than ROOT can be created.

◆ Joint() [3/8]

Nice::Joint::Joint ( )
explicit

Constructor of a joint node.

By default this node is named ROOT and has no parent joint.

◆ Joint() [4/8]

Nice::Joint::Joint ( const std::string &  _name)
explicit

Constructor.

Creates a new joint with a specified name.

Parameters
_nameName of the new joint. no parent, so a root joint with another name than ROOT can be created.

◆ ~Joint() [1/2]

Nice::Joint::~Joint ( )

Destructor.

Calls the destructor of all children and the attached leafs.

◆ Joint() [5/8]

Nice::Joint::Joint ( const Nice::JointPtr _joint,
const Nice::JointPtr _parent 
)
explicitprotected

Copyconstructor.

The entire subtree will be copied.

Parameters
_jointJoint to copy.
_parentNew parent joint of the copy.

◆ Joint() [6/8]

Nice::Joint::Joint ( const std::string &  _name,
const Nice::JointPtr _parent 
)
explicitprotected

Constructor.

Creates a new joint with a specified name.

Parameters
_nameName of the new joint.
_parentParent of the new joint. By default a node has no parent, so a root joint with another name than ROOT can be created.

◆ Joint() [7/8]

Nice::Joint::Joint ( )
explicit

Constructor of a joint node.

By default this node is named ROOT and has no parent joint.

◆ Joint() [8/8]

Nice::Joint::Joint ( const std::string &  _name)
explicit

Constructor.

Creates a new joint with a specified name.

Parameters
_nameName of the new joint. no parent, so a root joint with another name than ROOT can be created.

◆ ~Joint() [2/2]

Nice::Joint::~Joint ( )

Destructor.

Calls the destructor of all children and the attached leafs.

Member Function Documentation

◆ childCount() [1/2]

size_t Nice::Joint::childCount ( ) const

Checks if a joint is a leaf.

If the joint has no children the joint is a leaf.

Returns
True, if the joint has no children.

◆ childCount() [2/2]

size_t Nice::Joint::childCount ( ) const

Checks if a joint is a leaf.

If the joint has no children the joint is a leaf.

Returns
True, if the joint has no children.

◆ children() [1/6]

JointPtrMap Nice::Joint::children ( )
inline

Get a reference to the children vector.

◆ children() [2/6]

JointPtrMap Nice::Joint::children ( )
inline

Get a reference to the children vector.

◆ children() [3/6]

void Nice::Joint::children ( JointPtrVector _children,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of all children joint.

Parameters
_childrenReference of a vector to fill in pointer of found children.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector.

◆ children() [4/6]

void Nice::Joint::children ( JointPtrVector _children,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of all children joint.

Parameters
_childrenReference of a vector to fill in pointer of found children.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector.

◆ children() [5/6]

void Nice::Joint::children ( Nice::SeqString _children,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of all children as node strings.

Parameters
_childrenReference of a vector to fill in pointer of found children.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector.

◆ children() [6/6]

void Nice::Joint::children ( SeqString _children,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of all children as node strings.

Parameters
_childrenReference of a vector to fill in pointer of found children.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector.

◆ chop() [1/2]

void Nice::Joint::chop ( Nice::JointPtr _node)
static

Delete all children, deregister with parent and move _node pointer to the the next parent.

◆ chop() [2/2]

static void Nice::Joint::chop ( Nice::JointPtr _node)
static

Delete all children, deregister with parent and move _node pointer to the the next parent.

◆ depth() [1/2]

int Nice::Joint::depth ( )

Get the entire path to this started by the Root joint.

Returns
A vector of all parent joints. Element 0 is this.

◆ depth() [2/2]

int Nice::Joint::depth ( )

Get the entire path to this started by the Root joint.

Returns
A vector of all parent joints. Element 0 is this.

◆ exist() [1/2]

bool Nice::Joint::exist ( const std::string &  _path) const

Checks if a node exists.

Parameters
_pathPath to the node to check.
Returns
Return true if the node exists.

◆ exist() [2/2]

bool Nice::Joint::exist ( const std::string &  _path) const

Checks if a node exists.

Parameters
_pathPath to the node to check.
Returns
Return true if the node exists.

◆ get() [1/2]

template<typename Type >
Type Nice::Joint::get ( )

Get data from Property with a specific data type Type.

Returns
Value with Type from Property

◆ get() [2/2]

template<typename Type >
template bool Nice::Joint::get< bool > ( )

Get data from Property with a specific data type Type.

Returns
Value with Type from Property

◆ getAtNode() [1/2]

template<typename Type >
template bool Nice::Joint::getAtNode< bool > ( const std::string &  _node)

Get data from Property at a subnode with a specific data type Type.

Parameters
_nodePath to subnode which has a Property.
Returns
Value with Type from Property at a specific node.

◆ getAtNode() [2/2]

template<typename Type >
Type Nice::Joint::getAtNode ( const std::string &  _node)

Get data from Property at a subnode with a specific data type Type.

Parameters
_nodePath to subnode which has a Property.
Returns
Value with Type from Property at a specific node.

◆ getParents() [1/2]

Nice::JointPtrVector Nice::Joint::getParents ( )

Get the entire path to this started by the Root joint.

Returns
A vector of all parent joints. Element 0 is this.

◆ getParents() [2/2]

Nice::JointPtrVector Nice::Joint::getParents ( )

Get the entire path to this started by the Root joint.

Returns
A vector of all parent joints. Element 0 is this.

◆ getWithDefault() [1/4]

template<typename Type >
Type Nice::Joint::getWithDefault ( const Type _default)

Get data from Property with a specific data type Type.

If the node does not have a Property, a new Property is created and a default value is set.

Parameters
_defaultDefault value of the Property.
Returns
Value of Property type Type.

◆ getWithDefault() [2/4]

template<typename Type >
Type Nice::Joint::getWithDefault ( const Type _default)

Get data from Property with a specific data type Type.

If the node does not have a Property, a new Property is created and a default value is set.

Parameters
_defaultDefault value of the Property.
Returns
Value of Property type Type.

◆ getWithDefault() [3/4]

template<typename Type >
Type Nice::Joint::getWithDefault ( const std::string &  _node,
const Type _default,
bool  _warning = false 
)
inline

Get data from Property with a specific data type Type at a subnode.

If the node does not have a Property, a new Property is created and a default value with Type is set.

Parameters
_nodePath to the subnode to get the Property value from.
_defaultDefault value of the Property with type Type.
_warningprints a warning log when the property doesn't exist.
Returns
Value of Property with type Type.

◆ getWithDefault() [4/4]

template<typename Type >
Type Nice::Joint::getWithDefault ( const std::string &  _node,
const Type _default,
bool  _warning = false 
)
inline

Get data from Property with a specific data type Type at a subnode.

If the node does not have a Property, a new Property is created and a default value with Type is set.

Parameters
_nodePath to the subnode to get the Property value from.
_defaultDefault value of the Property with type Type.
_warningprints a warning log when the property doesn't exist.
Returns
Value of Property with type Type.

◆ hasLeaf() [1/2]

bool Nice::Joint::hasLeaf ( ) const

Checks if a joint has a Property.

Returns
True, if the joint has a Property.

◆ hasLeaf() [2/2]

bool Nice::Joint::hasLeaf ( ) const

Checks if a joint has a Property.

Returns
True, if the joint has a Property.

◆ isChildOf() [1/2]

bool Nice::Joint::isChildOf ( const JointPtr _branch) const

Checks if a joint is a child of this.

Parameters
_branchJoint to check.
Returns
True, if _branch is a child of this.

◆ isChildOf() [2/2]

bool Nice::Joint::isChildOf ( const JointPtr _branch) const

Checks if a joint is a child of this.

Parameters
_branchJoint to check.
Returns
True, if _branch is a child of this.

◆ leaf() [1/8]

const Nice::PropertyPtr& Nice::Joint::leaf ( )
inline

Get the connected Property pointer from the current node.

Returns
Property pointer of the current node.

◆ leaf() [2/8]

const Nice::PropertyPtr& Nice::Joint::leaf ( )
inline

Get the connected Property pointer from the current node.

Returns
Property pointer of the current node.

◆ leaf() [3/8]

template<typename Type >
const Nice::PropertyPtr& Nice::Joint::leaf ( )
inline

Get the connected Property pointer from the current node and create leaf if its not there.

Returns
Property pointer of the current node.

◆ leaf() [4/8]

template<typename Type >
const Nice::PropertyPtr& Nice::Joint::leaf ( )
inline

Get the connected Property pointer from the current node and create leaf if its not there.

Returns
Property pointer of the current node.

◆ leaf() [5/8]

template<typename Type >
const Nice::PropertyPtr& Nice::Joint::leaf ( const std::string &  _path,
bool  _create = true 
)
inline

Get the connected Property pointer from a specific subnode.

Parameters
_pathPath to the subnode to get the Property pointer from.
_createIf True the subnodes will be created if they do not exist.
Returns
The Property pointer at a specific subnode.

◆ leaf() [6/8]

template<typename Type >
const Nice::PropertyPtr& Nice::Joint::leaf ( const std::string &  _path,
bool  _create = true 
)
inline

Get the connected Property pointer from a specific subnode.

Parameters
_pathPath to the subnode to get the Property pointer from.
_createIf True the subnodes will be created if they do not exist.
Returns
The Property pointer at a specific subnode.

◆ leaf() [7/8]

const Nice::PropertyPtr& Nice::Joint::leaf ( const std::string &  _path,
bool  _create = true 
)

Get the connected Property pointer from a specific subnode.

Parameters
_pathPath to the subnode to get the Property pointer from.
_createIf True the subnodes will be created if they do not exist.
Returns
The Property pointer at a specific subnode.

◆ leaf() [8/8]

const Nice::PropertyPtr & Nice::Joint::leaf ( const std::string &  _path,
bool  _create = true 
)

Get the connected Property pointer from a specific subnode.

Parameters
_pathPath to the subnode to get the Property pointer from.
_createIf True the subnodes will be created if they do not exist.
Returns
The Property pointer at a specific subnode.

◆ leafCount() [1/2]

size_t Nice::Joint::leafCount ( const std::string &  _pre = "")

Get the amount of leafs (endpoints) this subtree contains.

Returns
Number of leafs.

◆ leafCount() [2/2]

size_t Nice::Joint::leafCount ( const std::string &  _pre = "")

Get the amount of leafs (endpoints) this subtree contains.

Returns
Number of leafs.

◆ leafs() [1/2]

size_t Nice::Joint::leafs ( JointPtrVector _leaf,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of leaf joints.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector. Returns number of leafs;

◆ leafs() [2/2]

size_t Nice::Joint::leafs ( JointPtrVector _leaf,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of leaf joints.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_preSearch string of leafs. Only leafs which contain _pre in its name are added to the vector. Returns number of leafs;

◆ leafsWithBridgeType() [1/2]

template<typename Type >
size_t Nice::Joint::leafsWithBridgeType ( JointPtrVector _leaf,
const std::string &  _id 
)

Get a vector of leaf joints with bridge type TYPE.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_identityof the bridge

◆ leafsWithBridgeType() [2/2]

template<typename T >
size_t Nice::Joint::leafsWithBridgeType ( JointPtrVector _leaf,
const std::string &  _id 
)

Get a vector of leaf joints with bridge type TYPE.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_identityof the bridge

◆ leafsWithType() [1/2]

template<typename T >
size_t Nice::Joint::leafsWithType ( JointPtrVector _leaf,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of leaf joints with type TYPE.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_typeSearch string of leafs. Only leafs which contain _pre in its name are added to the vector. Returns number of leafs;

◆ leafsWithType() [2/2]

template<typename Type >
size_t Nice::Joint::leafsWithType ( JointPtrVector _leaf,
const std::string &  _pre = "",
bool  _exact = false 
)

Get a vector of leaf joints with type TYPE.

Parameters
_leafReference of a vector to fill in pointer of found leafs.
_typeSearch string of leafs. Only leafs which contain _pre in its name are added to the vector. Returns number of leafs;

◆ merge() [1/4]

void Nice::Joint::merge ( const Nice::JointPtr _branch,
bool  _overwrite = true 
)

adds a subtree to the current node, existing sub tree will be merged.

◆ merge() [2/4]

void Nice::Joint::merge ( const Nice::JointPtr _branch,
bool  _overwrite = true 
)

adds a subtree to the current node, existing sub tree will be merged.

◆ merge() [3/4]

void Nice::Joint::merge ( const std::string &  _node,
const Nice::JointPtr _branch,
bool  _overwrite = true 
)

adds a subtree to the current node, existing sub tree will be merged.

◆ merge() [4/4]

void Nice::Joint::merge ( const std::string &  _node,
const Nice::JointPtr _branch,
bool  _overwrite = true 
)

adds a subtree to the current node, existing sub tree will be merged.

◆ mergeContext() [1/2]

void Nice::Joint::mergeContext ( const Nice::JointPtr _branch)

merge the context(Property values) of a node to this node existing sub tree will be merged.

◆ mergeContext() [2/2]

void Nice::Joint::mergeContext ( const Nice::JointPtr _branch)

merge the context(Property values) of a node to this node existing sub tree will be merged.

◆ name() [1/2]

const std::string & Nice::Joint::name ( ) const

Get the entire path string from this to a leaf seperated by ".".

Parameters
_leafLeaf to get the path to.
Returns
String to the leaf. Get the name of this joint.
Name of this joint.

◆ name() [2/2]

const std::string& Nice::Joint::name ( ) const

Get the entire path string from this to a leaf seperated by ".".

Parameters
_leafLeaf to get the path to.
Returns
String to the leaf. Get the name of this joint.
Name of this joint.

◆ node() [1/2]

Nice::JointPtr Nice::Joint::node ( const std::string &  _path,
bool  _create = true 
)

Get the Joint pointer from a specific subnode.

Parameters
_pathPath to the subnode
IfTrue the subnodes will be created if they do not exist.
Returns
The Joint pointer at a specific subnode.

◆ node() [2/2]

Nice::JointPtr Nice::Joint::node ( const std::string &  _path,
bool  _create = true 
)

Get the Joint pointer from a specific subnode.

Parameters
_pathPath to the subnode
IfTrue the subnodes will be created if they do not exist.
Returns
The Joint pointer at a specific subnode.

◆ operator Type() [1/2]

template<typename Type >
Nice::Joint::operator Type ( )

Returns a copy of leaf.

Parameters
_branchAutomatic type conversion.

◆ operator Type() [2/2]

template<typename Type >
Nice::Joint::operator Type ( )

Returns a copy of leaf.

Parameters
_branchAutomatic type conversion.

◆ operator=() [1/2]

template<typename Type >
void Nice::Joint::operator= ( const Type _val)

Stream operator.

Assigned a value to the leaf.

Parameters
_leafValue to assign.

◆ operator=() [2/2]

template<typename Type >
void Nice::Joint::operator= ( const Type _val)

Stream operator.

Assigned a value to the leaf.

Parameters
_leafValue to assign.

◆ operator==() [1/2]

bool Nice::Joint::operator== ( const JointPtr _value)
Parameters
_value
Returns
True, if equal.

◆ operator==() [2/2]

bool Nice::Joint::operator== ( const JointPtr _value)
Parameters
_value
Returns
True, if equal.

◆ parent() [1/2]

Nice::JointPtr Nice::Joint::parent ( ) const

Get the parent joint of this.

Returns
Parent joint of this.

◆ parent() [2/2]

Nice::JointPtr Nice::Joint::parent ( ) const

Get the parent joint of this.

Returns
Parent joint of this.

◆ path() [1/2]

std::string Nice::Joint::path ( const JointPtr _leaf = 0) const

Get the entire path to this started by the Root joint.

Returns
The string path from this to root or until ancestor _leaf.

◆ path() [2/2]

std::string Nice::Joint::path ( const JointPtr _leaf = 0) const

Get the entire path to this started by the Root joint.

Returns
The string path from this to root or until ancestor _leaf.

◆ replace() [1/2]

void Nice::Joint::replace ( const Nice::JointPtr _branch)

adds a subtree to the current node, existing sub tree will be deleted.

◆ replace() [2/2]

void Nice::Joint::replace ( const Nice::JointPtr _branch)

adds a subtree to the current node, existing sub tree will be deleted.

◆ set() [1/16]

void Nice::Joint::set ( const Nice::PropertyPtr _p)
inline

Set a Nice::Property as leaf at this node.

Parameters
_pas Nice::PropertyPtr

◆ set() [2/16]

void Nice::Joint::set ( const Nice::PropertyPtr _p)
inline

Set a Nice::Property as leaf at this node.

Parameters
_pas Nice::PropertyPtr

◆ set() [3/16]

void Nice::Joint::set ( const char *  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [4/16]

void Nice::Joint::set ( const char *  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [5/16]

void Nice::Joint::set ( const char *  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [6/16]

void Nice::Joint::set ( const char *  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [7/16]

void Nice::Joint::set ( const std::string &  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [8/16]

void Nice::Joint::set ( const std::string &  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [9/16]

void Nice::Joint::set ( const std::string &  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [10/16]

void Nice::Joint::set ( const std::string &  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at this node.

Parameters
_valas const char *

◆ set() [11/16]

template<typename Type >
void Nice::Joint::set ( const Type _val)
inline

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ set() [12/16]

template<typename Type >
void Nice::Joint::set ( const Type _val)
inline

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ set() [13/16]

template<typename Type >
void Nice::Joint::set ( const Type _val,
const Nice::Date _date 
)

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ set() [14/16]

template<typename Type >
void Nice::Joint::set ( const Type _val,
const Nice::Date _date 
)

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ set() [15/16]

template<typename Type >
void Nice::Joint::set ( const Type _val,
Nice::I64  _setterId,
const Nice::Date = Nice::Date::now() 
)

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ set() [16/16]

template<typename Type >
void Nice::Joint::set ( const Type _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)

Set type Type as a leaf at this node, if a leaf already exists, _val will be converted into the type of the leaf.

Parameters
_valas type Type.

◆ setAtNode() [1/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const Nice::PropertyPtr _p 
)
inline

Set a Nice::Property as leaf at node _node.

Parameters
_node- node name
_p- property pointer

◆ setAtNode() [2/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const Nice::PropertyPtr _p 
)
inline

Set a Nice::Property as leaf at node _node.

Parameters
_node- node name
_p- property pointer

◆ setAtNode() [3/16]

void Nice::Joint::setAtNode ( const char *  _node,
const Nice::PropertyPtr _p 
)
inline

Set a const char * as a std::string leaf atnode _node.

Parameters
_node- node name
_p- property pointer

◆ setAtNode() [4/16]

void Nice::Joint::setAtNode ( const char *  _node,
const Nice::PropertyPtr _p 
)
inline

Set a const char * as a std::string leaf atnode _node.

Parameters
_node- node name
_p- property pointer

◆ setAtNode() [5/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const char *  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at node _node.

Parameters
_node- node name
_valas const char *
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [6/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const char *  _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at node _node.

Parameters
_node- node name
_valas const char *
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [7/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const char *  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at node _node.

Parameters
_node- node name
_valas const char *
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [8/16]

void Nice::Joint::setAtNode ( const std::string &  _node,
const char *  _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set a const char * as a std::string leaf at node _node.

Parameters
_node- node name
_valas const char *
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [9/16]

template<typename Type >
void Nice::Joint::setAtNode ( const char *  _node,
const Type _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [10/16]

template<typename Type >
void Nice::Joint::setAtNode ( const char *  _node,
const Type _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [11/16]

template<typename Type >
void Nice::Joint::setAtNode ( const char *  _node,
const Type _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [12/16]

template<typename Type >
void Nice::Joint::setAtNode ( const char *  _node,
const Type _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [13/16]

template<typename Type >
void Nice::Joint::setAtNode ( const std::string &  _node,
const Type _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [14/16]

template<typename Type >
void Nice::Joint::setAtNode ( const std::string &  _node,
const Type _val,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [15/16]

template<typename Type >
void Nice::Joint::setAtNode ( const std::string &  _node,
const Type _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setAtNode() [16/16]

template<typename Type >
void Nice::Joint::setAtNode ( const std::string &  _node,
const Type _val,
Nice::I64  _setterId,
const Nice::Date _date = Nice::Date::now() 
)
inline

Set type Type as a leaf of type Type at node _node.

Parameters
_node- node name
_valas type Type
_date- time stamp with default=now() or as parameter.

◆ setIfNotExist() [1/4]

template<typename Type >
void Nice::Joint::setIfNotExist ( const Type _default)
inline

Set type Type as a leaf if it doesnt exist.

Parameters
_defaultvalue to set.

◆ setIfNotExist() [2/4]

template<typename Type >
void Nice::Joint::setIfNotExist ( const Type _default)
inline

Set type Type as a leaf if it doesnt exist.

Parameters
_defaultvalue to set.

◆ setIfNotExist() [3/4]

template<typename Type >
void Nice::Joint::setIfNotExist ( const std::string &  _node,
const Type _default 
)
inline

Set type Type as a leaf at node _node if it doesnt exist.

Parameters
_defaultvalue to set.
_nodenode name.

◆ setIfNotExist() [4/4]

template<typename Type >
void Nice::Joint::setIfNotExist ( const std::string &  _node,
const Type _default 
)
inline

Set type Type as a leaf at node _node if it doesnt exist.

Parameters
_defaultvalue to set.
_nodenode name.

◆ toString() [1/2]

std::string Nice::Joint::toString ( )

returns tree as string.

Returns
Return tree as string.

◆ toString() [2/2]

std::string Nice::Joint::toString ( )

returns tree as string.

Returns
Return tree as string.

Member Data Documentation

◆ m_children

Nice::JointPtrThreadSafeMap Nice::Joint::m_children
private

◆ m_leaf

Nice::PropertyPtr Nice::Joint::m_leaf
private

◆ m_name

std::string Nice::Joint::m_name
private

◆ m_parent

Nice::Joint * Nice::Joint::m_parent
private

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