MeVisLabToolboxReference
|
00001 //----------------------------------------------------------------------------- 00002 // **InsertLicense** code 00003 //----------------------------------------------------------------------------- 00005 00010 //----------------------------------------------------------------------------- 00011 00012 #ifndef CLASS_DCMTREE_TAGID 00013 #define CLASS_DCMTREE_TAGID 00014 00015 #include <istream> 00016 #include <ostream> 00017 00018 #include <string> 00019 00020 #include "DCMTree_Lib.h" 00021 #include "DCMTree_Serialization.h" 00022 00023 00024 namespace DCMTree 00025 { 00029 class DCMTREE_EXPORT TagId:public DCMTree_Serialization::Serializable,public DCMTree_Serialization::Deserializable 00030 { 00031 public: 00033 TagId(); 00034 00036 TagId (RawTagId rawid); 00037 00039 TagId (const TagId &other); 00040 00042 TagId (unsigned short groupid,unsigned short elementid); 00043 00050 TagId (std::string tidstr); 00051 00053 virtual ~TagId(); 00054 00055 // helpers 00056 static TagIdPtr create(RawTagId rawid); 00057 static TagIdPtr create(const TagId &other); 00058 static TagIdPtr create(unsigned short groupid,unsigned short elementid); 00059 static TagIdPtr create(std::string tidstr); 00060 00062 TagId &operator= (const TagId &other); 00063 00065 bool operator==(const TagId &other) const; 00066 00068 bool operator!=(const TagId &other) const; 00069 00071 bool operator>(const TagId &other) const; 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 operator RawTagId() const; 00084 00086 operator RawTagId&(); 00087 00089 unsigned short groupId() const; 00090 00092 unsigned short elementId() const; 00093 00095 bool isPrivate() const; 00096 00098 bool isPrivateCreator() const; 00099 00104 RawTagId privateTag( unsigned short slot ) const; 00105 00107 RawTagId rawId() const; 00108 00110 RawTagId &rawId(); 00111 00113 std::string toString() const; 00114 00118 void fromStream (std::istream &in); 00119 00123 void toStream (std::ostream &out) const; 00124 00125 virtual void serializeX (DCMTree_Serialization::Sink &sink) const; 00126 virtual void deserializeX (DCMTree_Serialization::Source &source); 00127 00131 static inline bool isPrivateTag( RawTagId id ); 00132 00133 private: 00134 RawTagId _id; 00135 }; 00136 00137 inline bool TagId::isPrivateTag( RawTagId id ) 00138 { 00139 return (id & 0x10000) != 0; 00140 } 00141 00142 inline std::ostream &operator << (std::ostream &out,const TagId &t) 00143 { 00144 t.toStream (out); 00145 return out; 00146 } 00147 00148 inline std::istream &operator >> (std::istream &in,TagId &t) 00149 { 00150 t.fromStream (in); 00151 return in; 00152 } 00153 } 00154 00155 #endif 00156