55 #include "core/common/WStringUtils.h"
61 WHnode::WHnode( nodeID_t idInit ): m_fullID( idInit ), m_parent( std::make_pair( false, 0 ) ),
62 m_nodeSize( 1 ), m_distanceLevel( 0 ), m_hLevel( 0 ), m_flag( false )
66 WHnode::WHnode( nodeID_t idInit, std::vector<nodeID_t>childrenInit,
size_t nodeSizeInit, dist_t distanceLevelInit,
size_t hLevelInit ):
67 m_fullID( idInit ), m_parent( std::make_pair( false, 0 ) ), m_children( childrenInit ), m_nodeSize( nodeSizeInit ),
68 m_distanceLevel( distanceLevelInit ), m_hLevel( hLevelInit ), m_flag( false )
122 oString +=
". Size: " + str( boost::format(
"%06d" ) %
m_nodeSize );
125 oString +=
". Kids: (";
126 for(
size_t i = 0; i <
m_children.size(); ++i )
146 for(
size_t i = 0; i <
m_children.size(); ++i )
159 std::ostream& operator <<( std::ostream& os,
const WHnode&
object )
161 os <<
object.printJointData();
this class implements a hierarchical tree node with several relevant attributes
size_t m_hLevel
level in the hierarchy (max number of nodes until reaching a leaf)
WHnode(nodeID_t idInit)
Constructor.
void setParent(const nodeID_t newDad)
sets the parent id field to the specified value
dist_t m_distanceLevel
distance level where the node was created
std::string printJointData() const
prints out a string with the node join data, (reduced version of the node data)
nodeID_t m_parent
parent node ID
void setChildren(std::vector< nodeID_t > newKids)
sets the children vector to the input values
void setHLevel(const size_t newLevel)
sets the hierarchical level field to the specified value
std::vector< nodeID_t > m_children
chlidren nodes IDs
void setSize(const size_t newSize)
sets the size field to the specified value
size_t m_nodeSize
number of leaves contained on the node
bool isRoot() const
returns true if object is the root of the tree
std::string printAllData() const
prints out a string with the node data, in order to implement the operator <<
void setID(const nodeID_t newID)
sets the ID field to the specified value
void setFlag(const bool newFlag)
sets the prune flag to the indicated value
void setDistLevel(const dist_t newLevel)
sets the distance level field to the specified value
std::string toString(const T &value)
Convert a given value to a string.