creaImageIOTreeAttributeDescriptor.h

Go to the documentation of this file.
00001 #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
00002 #define __creaImageIOTreeAttributeDescriptor_h_INCLUDED__
00003 
00004 #include <string>
00005 //#include <iostream>
00006 
00007 namespace creaImageIO
00008 {
00009 
00010   namespace tree
00011   {
00015     //=====================================================================
00017     class AttributeDescriptor
00018     {    
00019     public:
00022       static const unsigned int PRIVATE;
00024       static const unsigned int IDENTIFIER;
00026       static const unsigned int LABEL;
00028       static const unsigned int EDITABLE;
00029 
00032       static const int NUMBER=1;
00034       static const int STRING=2;
00036       static const int UNKNOWN=0;
00037 
00039       AttributeDescriptor()
00040         : mKey(""), mName(""), mGroup(0), mElement(0), mFlags(0)
00041       {
00042       }
00044       AttributeDescriptor(const std::string& key,
00045                           const std::string& name,
00046                           unsigned short group,
00047                           unsigned short element,
00048                           unsigned int flags)
00049         : mKey(key), mName(name), mGroup(group), mElement(element), 
00050           mFlags(flags)
00051       {
00052       }
00053 
00054       // Ctor with key, name and flags
00055       AttributeDescriptor(const std::string& key,
00056                           const std::string& name,
00057                           unsigned int flags = 0);
00058       // Ctor with dicom group, elem and flags
00059       // The key is built as 'Dgroup_elem'
00060       // The user name is retreived from dicom dictionnary
00061       AttributeDescriptor(unsigned short group,
00062                           unsigned short element,
00063                           unsigned int flags = 0);
00065       const std::string& GetKey() const { return mKey; }
00067       const std::string& GetName() const { return mName; }
00069       unsigned short GetGroup() const { return mGroup; }
00071       unsigned short GetElement() const { return mElement; }
00073       unsigned int GetFlags() const { return mFlags; }
00074           
00076       static void GetDicomGroupElementFromKey(const std::string& key,
00077                                               unsigned short& group,
00078                                               unsigned short& elem);
00082       void CleanName(std::string& str) const;
00084           void DecodeType(unsigned int& type) const;
00085 
00087           bool isDateEntry() const;
00088 
00090           bool isTimeEntry() const;
00091 
00092     private:
00093       std::string mKey;
00094       std::string mName;
00095       unsigned short mGroup;
00096       unsigned short mElement;
00097       unsigned int mFlags;
00098     };
00099     // EO class AttributeDescriptor
00100     //=====================================================================
00101 
00102    
00103 
00104   } // EO namespace tree
00105 
00106 } // EO namespace creaImageIO
00107 
00108 
00109 
00110 
00111 
00112 #endif // #ifndef __creaImageIOTreeAttributeDescriptor_h_INCLUDED__