]> Creatis software - creaImageIO.git/blob - src2/creaImageIOTreeAttributeDescriptor.h
Starting version 2
[creaImageIO.git] / src2 / creaImageIOTreeAttributeDescriptor.h
1 #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
2 #define __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
3
4 #include <string>
5 //#include <iostream>
6
7 namespace creaImageIO
8 {
9
10   namespace tree
11   {
12     //=====================================================================
13     /// Descriptor of an attribute of a node of a tree (name, dicom group/element)
14     class AttributeDescriptor
15     {    
16     public:
17       /// Flags
18       /// The attribute is hidden (not visible to user)
19       static const unsigned int HIDDEN;
20       /// The attribute enters in unique identifier constitution (KEY)
21       static const unsigned int KEY;
22       /// The attribute enters in label constitution (for printing)
23       static const unsigned int LABEL;
24
25       /// Default ctor
26       AttributeDescriptor()
27         : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
28       {
29       }
30       // Ctor with key and flags
31       // If the key is of the form "0020|000E" 
32       // (Two hex short separated by a pipe at 5th position)
33       // it is interpreted as a Dicom Tag 
34       // The user name is retreived from dicom dictionnary
35       // and the group and elem are filled
36       // Else the name is set to the key
37       AttributeDescriptor(const std::string& key,
38                           unsigned int flags = 0);
39       /// Returns the name of the attribute
40       const std::string& GetName() const { return mName; }
41       /// Returns the DICOM group code of the attribute
42       unsigned short GetGroup() const { return mGroup; }
43       /// Returns the DICOM element code of the attribute
44       unsigned short GetElement() const { return mElement; }
45       /// Returns the flags of the attribute
46       unsigned int GetFlags() const { return mFlags; }
47     
48     private:
49       std::string mKey;
50       std::string mName;
51       unsigned short mGroup;
52       unsigned short mElement;
53       unsigned int mFlags;
54     };
55     // EO class AttributeDescriptor
56     //=====================================================================
57
58    
59
60   } // EO namespace tree
61
62 } // EO namespace creaImageIO
63
64
65 /*
66 //=====================================================================
67 inline std::ostream& operator<<(std::ostream& s, 
68 const creaImageIO::tree::AttributeDescriptor& d)
69 {
70 s << "[" << d.key << ":" << d.name << "]";
71 return s;
72 }
73 //=====================================================================
74 */
75
76
77 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__