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