]> Creatis software - creaImageIO.git/blob - src2/creaImageIOTree.h
*** empty log message ***
[creaImageIO.git] / src2 / creaImageIOTree.h
1 #ifndef __creaImageIOTree_h_INCLUDED__
2 #define __creaImageIOTree_h_INCLUDED__
3
4 #include <creaImageIOTreeNode.h>
5
6 namespace creaImageIO
7 {
8
9   namespace tree
10   {
11     
12     //=====================================================================
13     /// Abstract class to store user data on a tree
14     struct TreeData
15     { 
16       TreeData() {}
17       virtual ~TreeData() {}
18     };
19     //=====================================================================
20     
21     //=====================================================================
22     /// An attributed tree structure
23     /**
24      */
25     class Tree : public Node
26     {
27     public:
28       /// Ctor
29       Tree();
30       /// Virtual destructor
31       virtual ~Tree();
32       
33       /// Returns the descriptor of the tree
34     
35       /// Returns the tree to which the node belongs
36       virtual Tree* GetTree() { return this; }
37       /// Returns the tree to which the node belongs
38       virtual const Tree* GetTree() const { return this; }
39       /// Returns the level of the node in the tree
40       virtual int GetLevel() const { return 0; }
41       
42       /// Returns the Descriptor of the tree (const)
43       const Descriptor& GetDescriptor() const { return mDescriptor; }
44       /// Returns the descriptor of the tree 
45       Descriptor& GetDescriptor() { return mDescriptor; }
46
47      /// Returns the number of levels of the tree
48       unsigned int GetNumberOfLevels() 
49       { return GetDescriptor().GetNumberOfLevels(); }
50
51     /// Returns the LevelDescriptor of a given level (const ref)
52       const LevelDescriptor& GetLevelDescriptor(int level) const
53       { return GetDescriptor().GetLevelDescriptor(level); }
54       /// Returns the LevelDescriptor of a given level (ref)
55       LevelDescriptor& GetLevelDescriptor(int level) 
56       { return GetDescriptor().GetLevelDescriptor(level); }
57
58       /// Returns the AttributeDescriptorList of a given level (const ref)
59       const LevelDescriptor::AttributeDescriptorListType& 
60       GetAttributeDescriptorList(int level) const
61       { return GetDescriptor().GetAttributeDescriptorList(level); }
62       /// Returns the AttributeDescriptorList of a given level (ref)
63       LevelDescriptor::AttributeDescriptorListType& 
64       GetAttributeDescriptorList(int level) 
65       { return GetDescriptor().GetAttributeDescriptorList(level); }
66   
67
68     private:
69       Descriptor mDescriptor;
70
71     };
72     // EO class Tree
73     //=====================================================================
74
75   } // EO namespace tree
76   
77 } // EO namespace creaImageIO
78
79 // EOF
80 #endif