MeVisLabToolboxReference
MeVis/Foundation/Sources/DicomTree/MLDicomTree/DCMTree_TagId.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 // **InsertLicense** code
00003 //-----------------------------------------------------------------------------
00005 
00010 //-----------------------------------------------------------------------------
00011 
00012 #ifndef CLASS_DCMTREE_TAGID
00013 #define CLASS_DCMTREE_TAGID
00014 
00015 #ifdef _MSC_VER
00016   #pragma warning (push)
00017   #pragma warning (disable : 4350)
00018 #endif
00019 
00020 #include <istream>
00021 #include <ostream>
00022 
00023 #include <string>
00024 
00025 #include "DCMTree_Lib.h"
00026 #include "DCMTree_Serialization.h"
00027 
00028 #ifdef _MSC_VER
00029   #pragma warning (pop)
00030 #endif
00031 
00032 
00033 namespace DCMTree
00034 {
00038     class DCMTREE_EXPORT TagId:public DCMTree_Serialization::Serializable,public DCMTree_Serialization::Deserializable
00039     {
00040     public:
00042         TagId();
00043 
00045         TagId (RawTagId rawid);
00046         
00048         TagId (const TagId &other);
00049 
00051         TagId (unsigned short groupid,unsigned short elementid);
00052 
00059         TagId (std::string tidstr);
00060 
00062         virtual ~TagId();
00063 
00064         // helpers
00065         static TagIdPtr create(RawTagId rawid);
00066         static TagIdPtr create(const TagId &other);
00067         static TagIdPtr create(unsigned short groupid,unsigned short elementid);
00068         static TagIdPtr create(std::string tidstr);
00069 
00071         TagId &operator= (const TagId &other);
00072 
00074         bool operator==(const TagId &other) const;
00075 
00077         bool operator!=(const TagId &other) const;
00078 
00080         bool operator>(const TagId &other) const;
00081 
00083         bool operator<(const TagId &other) const;
00084 
00086         bool operator>=(const TagId &other) const;
00087 
00089         bool operator<=(const TagId &other) const;
00090 
00092         operator RawTagId() const;
00093 
00095         operator RawTagId&();
00096 
00098         unsigned short groupId() const;
00099 
00101         unsigned short elementId() const;
00102 
00104         bool isPrivate() const;
00105 
00107         bool isPrivateCreator() const;
00108 
00113         RawTagId privateTag( unsigned short slot ) const;
00114 
00116         RawTagId rawId() const;
00117 
00119         RawTagId &rawId();
00120 
00122         std::string toString() const;
00123 
00127         void fromStream (std::istream &in);
00128 
00132         void toStream (std::ostream &out) const;
00133 
00134         virtual void serializeX (DCMTree_Serialization::Sink &sink) const;
00135         virtual void deserializeX (DCMTree_Serialization::Source &source);
00136 
00140         static inline bool isPrivateTag( RawTagId id );
00141 
00142     private:
00143         RawTagId _id;
00144     };
00145 
00146     inline bool TagId::isPrivateTag( RawTagId id )
00147     {
00148       return (id & 0x10000) != 0;
00149     }
00150 
00151     inline std::ostream &operator << (std::ostream &out,const TagId &t)
00152     {
00153         t.toStream (out);
00154         return out;
00155     }
00156 
00157     inline std::istream &operator >> (std::istream &in,TagId &t)
00158     {
00159         t.fromStream (in);
00160         return in;
00161     }
00162 }
00163 
00164 #endif
00165