creaImageIO::tree::Node Class Reference

Node of an attributed Tree structure. More...

#include <creaImageIOTreeNode.h>

Inheritance diagram for creaImageIO::tree::Node:

Inheritance graph
[legend]
Collaboration diagram for creaImageIO::tree::Node:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::map
< std::string,
std::string > 
AttributeMapType
typedef std::vector
< Node * > 
ChildrenListType
 The type of children container.

Public Member Functions

 Node (Node *parent)
 Ctor with parent.
 Node (Node *parent, const AttributeMapType &)
 Ctor with parent and attributes map.
virtual ~Node ()
 Virtual destructor.
void InitializeAttributeMap ()
 Initializes the attribute map i.e. creates the entries.
const LevelDescriptorGetLevelDescriptor () const
 Returns the level descriptor of the node.
virtual TreeGetTree ()
 Returns the tree to which the node belongs.
virtual const TreeGetTree () const
 Returns the tree to which the node belongs.
virtual int GetLevel () const
 Returns the level of the node in the tree.
NodeGetParent () const
 Returns the parent of the node.
unsigned int GetNumberOfChildren () const
bool GetChildrenLoaded () const
 Returns true iff the node's children are loaded.
void SetChildrenLoaded (bool l)
 Sets the node's children.
ChildrenListTypeGetChildrenList ()
 Returns the list of children.
const ChildrenListTypeGetChildrenList () const
 Returns the list of children (const).
int RemoveChildrenFromList (Node *)
 Remove the given children from the children list.
AttributeMapTypeGetAttributeMap ()
const AttributeMapTypeGetAttributeMap () const
const std::string & GetAttribute (const std::string &k) const
const std::string & GetCleanAttribute (const std::string &k) const
const std::string & UnsafeGetAttribute (const std::string &k) const
void SetAttribute (const std::string &k, const std::string &v)
void UnsafeSetAttribute (const std::string &k, const std::string &v)
const
AttributeDescriptor
GetAttributeDescriptor (const std::string &k) const
bool Matches (const AttributeMapType &) const
 Returns true iff the KEY attributes of the node match those of the map provided.
template<class T>
GetData () const
 Returns the node data casted into the type T.
void SetData (NodeData *d)
 Sets the node data. Deletes existing data if any.
void SortChildren (const LexicographicalComparator &)
 Sorts the children of the node.
virtual void Print () const
std::string GetLabel () const

Private Attributes

NodemParent
 The parent of the node.
ChildrenListType mChildren
 The list of children.
AttributeMapType mAttributeMap
 The map of attributes.
NodeDatamData
 User data.
bool mChildrenLoaded
 Are the children loaded ?


Detailed Description

Node of an attributed Tree structure.

Definition at line 34 of file creaImageIOTreeNode.h.


Member Typedef Documentation

typedef std::map<std::string,std::string> creaImageIO::tree::Node::AttributeMapType

Definition at line 37 of file creaImageIOTreeNode.h.

typedef std::vector<Node*> creaImageIO::tree::Node::ChildrenListType

The type of children container.

Definition at line 77 of file creaImageIOTreeNode.h.


Constructor & Destructor Documentation

creaImageIO::tree::Node::Node ( Node parent  ) 

Ctor with parent.

creaImageIO::tree::Node::Node ( Node parent,
const AttributeMapType  
)

Ctor with parent and attributes map.

virtual creaImageIO::tree::Node::~Node (  )  [virtual]

Virtual destructor.


Member Function Documentation

void creaImageIO::tree::Node::InitializeAttributeMap (  ) 

Initializes the attribute map i.e. creates the entries.

const LevelDescriptor& creaImageIO::tree::Node::GetLevelDescriptor (  )  const

Returns the level descriptor of the node.

virtual Tree* creaImageIO::tree::Node::GetTree (  )  [inline, virtual]

Returns the tree to which the node belongs.

Reimplemented in creaImageIO::tree::Tree.

Definition at line 55 of file creaImageIOTreeNode.h.

References GetTree(), and mParent.

Referenced by GetTree().

00055 { return mParent->GetTree(); }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual const Tree* creaImageIO::tree::Node::GetTree (  )  const [inline, virtual]

Returns the tree to which the node belongs.

Reimplemented in creaImageIO::tree::Tree.

Definition at line 57 of file creaImageIOTreeNode.h.

References GetTree(), and mParent.

00057 { return mParent->GetTree(); }

Here is the call graph for this function:

virtual int creaImageIO::tree::Node::GetLevel (  )  const [inline, virtual]

Returns the level of the node in the tree.

Reimplemented in creaImageIO::tree::Tree.

Definition at line 59 of file creaImageIOTreeNode.h.

References GetLevel(), and mParent.

Referenced by GetLevel().

00059 { return mParent->GetLevel()+1; }

Here is the call graph for this function:

Here is the caller graph for this function:

Node* creaImageIO::tree::Node::GetParent (  )  const [inline]

Returns the parent of the node.

Definition at line 62 of file creaImageIOTreeNode.h.

References mParent.

00062 { return mParent; }

unsigned int creaImageIO::tree::Node::GetNumberOfChildren (  )  const [inline]

Returns the number of children of the node. Warning : if the children are not loaded then might return 0 even if the node has children ! see TreeHandler::GetNumberOfChildren

Definition at line 68 of file creaImageIOTreeNode.h.

References mChildren.

00068 { return mChildren.size(); }

bool creaImageIO::tree::Node::GetChildrenLoaded (  )  const [inline]

Returns true iff the node's children are loaded.

Definition at line 71 of file creaImageIOTreeNode.h.

References mChildrenLoaded.

00071 { return mChildrenLoaded; }

void creaImageIO::tree::Node::SetChildrenLoaded ( bool  l  )  [inline]

Sets the node's children.

Definition at line 74 of file creaImageIOTreeNode.h.

References mChildrenLoaded.

00074 { mChildrenLoaded = l; }

ChildrenListType& creaImageIO::tree::Node::GetChildrenList (  )  [inline]

Returns the list of children.

Definition at line 79 of file creaImageIOTreeNode.h.

References mChildren.

00079 { return mChildren; }

const ChildrenListType& creaImageIO::tree::Node::GetChildrenList (  )  const [inline]

Returns the list of children (const).

Definition at line 81 of file creaImageIOTreeNode.h.

References mChildren.

00081 { return mChildren; }

int creaImageIO::tree::Node::RemoveChildrenFromList ( Node  ) 

Remove the given children from the children list.

AttributeMapType& creaImageIO::tree::Node::GetAttributeMap (  )  [inline]

Definition at line 87 of file creaImageIOTreeNode.h.

References mAttributeMap.

00087 { return mAttributeMap; }

const AttributeMapType& creaImageIO::tree::Node::GetAttributeMap (  )  const [inline]

Definition at line 88 of file creaImageIOTreeNode.h.

References mAttributeMap.

00088 { return mAttributeMap; }

const std::string& creaImageIO::tree::Node::GetAttribute ( const std::string &  k  )  const

const std::string& creaImageIO::tree::Node::GetCleanAttribute ( const std::string &  k  )  const

const std::string& creaImageIO::tree::Node::UnsafeGetAttribute ( const std::string &  k  )  const [inline]

Definition at line 91 of file creaImageIOTreeNode.h.

References mAttributeMap.

00092       { return mAttributeMap.find(k)->second; }

void creaImageIO::tree::Node::SetAttribute ( const std::string &  k,
const std::string &  v 
)

void creaImageIO::tree::Node::UnsafeSetAttribute ( const std::string &  k,
const std::string &  v 
) [inline]

Definition at line 94 of file creaImageIOTreeNode.h.

References mAttributeMap.

00095       { mAttributeMap[k] = v; }

const AttributeDescriptor& creaImageIO::tree::Node::GetAttributeDescriptor ( const std::string &  k  )  const

bool creaImageIO::tree::Node::Matches ( const AttributeMapType  )  const

Returns true iff the KEY attributes of the node match those of the map provided.

template<class T>
T creaImageIO::tree::Node::GetData (  )  const [inline]

Returns the node data casted into the type T.

Definition at line 105 of file creaImageIOTreeNode.h.

References mData.

00106       { if (mData!=0) return dynamic_cast<T>(mData); return 0; }

void creaImageIO::tree::Node::SetData ( NodeData d  )  [inline]

Sets the node data. Deletes existing data if any.

Definition at line 109 of file creaImageIOTreeNode.h.

References mData.

00109 { if (mData) delete mData; mData = d; }

void creaImageIO::tree::Node::SortChildren ( const LexicographicalComparator  ) 

Sorts the children of the node.

virtual void creaImageIO::tree::Node::Print (  )  const [virtual]

Reimplemented in creaImageIO::tree::Tree.

std::string creaImageIO::tree::Node::GetLabel (  )  const


Member Data Documentation

Node* creaImageIO::tree::Node::mParent [private]

The parent of the node.

Definition at line 125 of file creaImageIOTreeNode.h.

Referenced by GetLevel(), GetParent(), and GetTree().

ChildrenListType creaImageIO::tree::Node::mChildren [private]

The list of children.

Definition at line 127 of file creaImageIOTreeNode.h.

Referenced by GetChildrenList(), and GetNumberOfChildren().

AttributeMapType creaImageIO::tree::Node::mAttributeMap [private]

The map of attributes.

Definition at line 129 of file creaImageIOTreeNode.h.

Referenced by GetAttributeMap(), UnsafeGetAttribute(), and UnsafeSetAttribute().

NodeData* creaImageIO::tree::Node::mData [private]

User data.

Definition at line 131 of file creaImageIOTreeNode.h.

Referenced by GetData(), and SetData().

bool creaImageIO::tree::Node::mChildrenLoaded [private]

Are the children loaded ?

Definition at line 133 of file creaImageIOTreeNode.h.

Referenced by GetChildrenLoaded(), and SetChildrenLoaded().


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 10:50:15 2009 for CreaImageIO by  doxygen 1.5.3