namespace tree
{
+ /**
+ * \ingroup Tree
+ */
//=====================================================================
/// Forward declaration of Tree
class Tree;
//=====================================================================
//=====================================================================
- /// Abstract class to store user data on a tree node
+ /// Abstract class to store user data on a Tree node
struct NodeData
{
NodeData() {}
//=====================================================================
- /// Node of an attributed tree structure
+ /// Node of an attributed Tree structure
class Node
{
public:
+ typedef std::map<std::string,std::string> AttributeMapType;
+
+
/// Ctor with parent
Node(Node* parent);
+ /// Ctor with parent and attributes map
+ Node(Node* parent, const AttributeMapType& );
/// Virtual destructor
virtual ~Node();
+ /// Initializes the attribute map i.e. creates the entries
+ void InitializeAttributeMap();
/// Returns the level descriptor of the node
const LevelDescriptor& GetLevelDescriptor() const;
const ChildrenListType& GetChildrenList() const { return mChildren; }
/// Remove the given children from the children list
- void RemoveChildrenFromList(Node*);
+ int RemoveChildrenFromList(Node*);
- typedef std::map<std::string,std::string> AttributeMapType;
AttributeMapType& GetAttributeMap() { return mAttributeMap; }
const AttributeMapType& GetAttributeMap() const { return mAttributeMap; }
void UnsafeSetAttribute(const std::string& k, const std::string& v)
{ mAttributeMap[k] = v; }
- const AttributeDescriptor& GetAttributeDescriptor(const std::string& k)
- const;
+ const AttributeDescriptor& GetAttributeDescriptor(const std::string& k)const;
// { return GetTypeDescription().GetFieldDescription(k); }
-
+ /// Returns true iff the KEY attributes of the node match those of the map provided
+ bool Matches( const AttributeMapType& ) const;
+
/// Returns the node data casted into the type T
template<class T> T GetData() const
{ if (mData!=0) return dynamic_cast<T>(mData); return 0; }
/// Sorts the children of the node
void SortChildren(const LexicographicalComparator&);
- /*
- virtual void Print() const;
+ virtual void Print() const;
std::string GetLabel() const;
+ /*
int ImageGetRows() const;
int ImageGetColumns() const;
int ImageGetFrames() const;