MultiAgentDecisionProcess  Release 0.2.1
TreeNode< Tcontained > Class Template Reference

TreeNode represents a node in a tree of histories, for instance observation histories. More...

#include <TreeNode.h>

+ Inheritance diagram for TreeNode< Tcontained >:
+ Collaboration diagram for TreeNode< Tcontained >:

Public Member Functions

bool ExistsSuccessor (Index sucI)
 Check whether a particular successor sucI exists.
Tcontained * GetContainedElement () const
 Returns a pointer to the contained element (Tcontained)
Index GetIndex () const
 Returns the index of this TreeNode (and thus corresponding to the contained element).
TreeNodeGetPredecessor () const
 Get the predecessor TreeNode*.
TreeNodeGetSuccessor (Index sucI)
 Get the succesor TreeNode* for the sucI'th successor.
void Print () const
 Prints the tree starting from this node of the history tree (including the successors).
void PrintThisNode () const
 Prints only this node of the history tree (not the successors).
void SetIndex (Index i)
 Sets the index to i.
void SetPredeccessor (TreeNode< Tcontained > *pred)
 Sets the predecessor of this node to be pred.
void SetSuccessor (Index sucI, TreeNode< Tcontained > *suc)
 Sets the sucI'th successor of this TreeNode to suc.
 TreeNode ()
 (default) Constructor
 TreeNode (Tcontained *const oh)
 TreeNode (const TreeNode &a)
 Copy constructor.
virtual ~TreeNode ()
 Destructor.

Protected Attributes

Tcontained * _m_containedElem
 The contained element.
Index _m_index
 The index of this TreeNode (and thus of the contained Tcontained - typically an observation history).
bool _m_indexValid
 Whether the index is valid.
TreeNode< Tcontained > * _m_pred
 A Pointer to the predecessor.
std::map< Index, TreeNode
< Tcontained > * > 
_m_successor
 The map that stores the pointers to the successor TreeNodes.

Detailed Description

template<class Tcontained>
class TreeNode< Tcontained >

TreeNode represents a node in a tree of histories, for instance observation histories.

TreeNode is a class that represents a wrapper for the Tcontained class. Each node also specifies a (sub-)tree so there is no actual difference between a tree and a node. This implementation assumes that ObservationHistories are always contained in exactly 1 TreeNode: i.e., deleting an object of TreeNode will free the memory of the node and the subtree represented by it as well as the memory of all the contained ObservationHistories.

Definition at line 53 of file TreeNode.h.

Constructor & Destructor Documentation

template<class Tcontained>
TreeNode< Tcontained >::TreeNode ( )
inline

(default) Constructor

Definition at line 75 of file TreeNode.h.

template<class Tcontained>
TreeNode< Tcontained >::TreeNode ( Tcontained *const  oh)
inline

Definition at line 83 of file TreeNode.h.

template<class Tcontained>
TreeNode< Tcontained >::TreeNode ( const TreeNode< Tcontained > &  a)
inline

Copy constructor.

Definition at line 91 of file TreeNode.h.

template<class Tcontained>
virtual TreeNode< Tcontained >::~TreeNode ( )
inlinevirtual

Destructor.

Definition at line 107 of file TreeNode.h.

Member Function Documentation

template<class Tcontained >
bool TreeNode< Tcontained >::ExistsSuccessor ( Index  sucI)

Check whether a particular successor sucI exists.

Definition at line 214 of file TreeNode.h.

template<class Tcontained>
Tcontained* TreeNode< Tcontained >::GetContainedElement ( ) const
inline
template<class Tcontained>
Index TreeNode< Tcontained >::GetIndex ( ) const
inline
template<class Tcontained>
TreeNode* TreeNode< Tcontained >::GetPredecessor ( ) const
inline

Get the predecessor TreeNode*.

Reimplemented in JointActionObservationHistoryTree, JointObservationHistoryTree, and ObservationHistoryTree.

Definition at line 147 of file TreeNode.h.

template<class Tcontained >
TreeNode< Tcontained > * TreeNode< Tcontained >::GetSuccessor ( Index  sucI)

Get the succesor TreeNode* for the sucI'th successor.

Reimplemented in JointObservationHistoryTree, and ObservationHistoryTree.

Definition at line 205 of file TreeNode.h.

template<class Tcontained >
void TreeNode< Tcontained >::Print ( ) const

Prints the tree starting from this node of the history tree (including the successors).

Reimplemented in JointActionObservationHistoryTree, and ActionObservationHistoryTree.

Definition at line 234 of file TreeNode.h.

Referenced by PlanningUnitMADPDiscrete::InitializeJointObservationHistories().

template<class Tcontained >
void TreeNode< Tcontained >::PrintThisNode ( ) const

Prints only this node of the history tree (not the successors).

Definition at line 224 of file TreeNode.h.

Referenced by TreeNode< ObservationHistory >::TreeNode(), and TreeNode< ObservationHistory >::~TreeNode().

template<class Tcontained>
void TreeNode< Tcontained >::SetIndex ( Index  i)
inline
template<class Tcontained>
void TreeNode< Tcontained >::SetPredeccessor ( TreeNode< Tcontained > *  pred)
inline

Sets the predecessor of this node to be pred.

This function is typically called by SetSuccessor (not manually).

Definition at line 139 of file TreeNode.h.

Referenced by TreeNode< Tcontained >::SetSuccessor().

template<class Tcontained>
void TreeNode< Tcontained >::SetSuccessor ( Index  sucI,
TreeNode< Tcontained > *  suc 
)

Sets the sucI'th successor of this TreeNode to suc.

For example, the successor for observation number sucI. Also sets the predecessor of suc to this.

Definition at line 175 of file TreeNode.h.

References TreeNode< Tcontained >::SetPredeccessor().

Referenced by PlanningUnitMADPDiscrete::CreateObservationHistoryTree(), and PlanningUnitMADPDiscrete::InitializeJointObservationHistories().

Member Data Documentation

template<class Tcontained>
Tcontained* TreeNode< Tcontained >::_m_containedElem
protected
template<class Tcontained>
Index TreeNode< Tcontained >::_m_index
protected

The index of this TreeNode (and thus of the contained Tcontained - typically an observation history).

Definition at line 64 of file TreeNode.h.

Referenced by TreeNode< ObservationHistory >::GetIndex(), TreeNode< ObservationHistory >::SetIndex(), and TreeNode< ObservationHistory >::TreeNode().

template<class Tcontained>
bool TreeNode< Tcontained >::_m_indexValid
protected
template<class Tcontained>
TreeNode<Tcontained>* TreeNode< Tcontained >::_m_pred
protected
template<class Tcontained>
std::map< Index, TreeNode<Tcontained>* > TreeNode< Tcontained >::_m_successor
protected

The map that stores the pointers to the successor TreeNodes.

Definition at line 59 of file TreeNode.h.

Referenced by TreeNode< ObservationHistory >::TreeNode(), and TreeNode< ObservationHistory >::~TreeNode().


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