]> Creatis software - creaImageIO.git/blob - src/creaImageIOTreeLevelDescriptor.h
be2a3d81ee955897b1278e849d9a501e4fd8ef22
[creaImageIO.git] / src / creaImageIOTreeLevelDescriptor.h
1 #ifndef __creaImageIOTreeLevelDescriptor_h_INCLUDED__
2 #define __creaImageIOTreeLevelDescriptor_h_INCLUDED__
3
4 #include <creaImageIOTreeAttributeDescriptor.h>
5 #include <vector>
6
7 namespace creaImageIO
8 {
9
10   namespace tree
11   {
12         /**
13         * \ingroup Tree
14         */
15     //=====================================================================
16     /// Descriptor of a level of a Tree (name, attributes, ...)
17     class LevelDescriptor
18     {
19     public:
20       /// Ctor with name
21       LevelDescriptor(const std::string& name) : mName(name) {}
22       /// Destructor
23       ~LevelDescriptor() {} 
24
25       /// Returns the name of the level
26       const std::string& GetName() const { return mName; }
27
28       /// Returns the number of attributes of the level
29       unsigned int GetNumberOfAttributes() const
30       { return mAttributeDescriptorList.size(); }
31
32       /// Adds the AttributeDescriptor to the list
33       void Add(const AttributeDescriptor&);
34
35           /// The type of attribute container
36       typedef std::vector<AttributeDescriptor> AttributeDescriptorListType;
37  
38       /// Returns the list of AttributeDescriptor (const)
39             /// type = 0 all attributes
40           /// type = 1 without ID and PATIENT_ID
41       const AttributeDescriptorListType& GetAttributeDescriptorList(int type = 0) const 
42       { if (type == 0)
43                   return mAttributeDescriptorList; 
44                 else 
45                         return mAttributeDescriptorListWID;
46           }
47
48           /// Copy the original list of attributes
49           void CopyAttributeDescriptorList();
50
51       /// \return The list of attributes with flag IDENTIFIER set
52       const std::vector<std::string>& GetIdentifierList() const 
53       { return mIdentifierList; }
54       /// \return The list of attributes with flag LABEL set
55       const std::vector<std::string>& GetLabelList() const 
56       { return mLabelList; }
57
58     private:
59       std::string mName;
60           // Attributes List for this level
61       AttributeDescriptorListType mAttributeDescriptorList;
62           // Attributes List for this level without ID and PARENT_ID attributes
63           AttributeDescriptorListType mAttributeDescriptorListWID;
64       /// The list of attributes with flag IDENTIFIER set
65       std::vector<std::string> mIdentifierList;
66       /// The list of attributes with flag LABEL set
67       std::vector<std::string> mLabelList;
68
69     };
70     // EO class LevelDescriptor
71     //=====================================================================
72   }// EO namespace tree
73   
74
75 } // EO namespace creaImageIO
76
77 // EOF
78 #endif