]> 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         * \ingroup Model
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     /**
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       /// Returns the LevelDescriptor of a given level (ref)
57       LevelDescriptor& GetLevelDescriptor(int level) 
58       { return GetDescriptor().GetLevelDescriptor(level); }
59
60       /// Returns the AttributeDescriptorList of a given level (const ref)
61       const LevelDescriptor::AttributeDescriptorListType& 
62       GetAttributeDescriptorList(int level) const
63       { return GetDescriptor().GetAttributeDescriptorList(level); }
64       /// Returns the AttributeDescriptorList of a given level (ref)
65       //LevelDescriptor::AttributeDescriptorListType& 
66       //GetAttributeDescriptorList(int level) 
67       //{ return GetDescriptor().GetAttributeDescriptorList(level); }
68   
69       virtual void Print() const;
70
71     private:
72       Descriptor mDescriptor;
73
74     };
75     // EO class Tree
76     //=====================================================================
77
78   } // EO namespace tree
79   
80 } // EO namespace creaImageIO
81
82 // EOF
83 #endif