00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef DCMTAGKEY_H
00034 #define DCMTAGKEY_H 1
00035
00036 #include "dcmtk/config/osconfig.h"
00037
00038 #include "dcmtk/ofstd/ofstream.h"
00039 #include "dcmtk/dcmdata/dctypes.h"
00040 #include "dcmtk/ofstd/ofstring.h"
00041
00042
00043
00044
00045
00046 #define DCM_UndefinedTagKey DcmTagKey(0xffff, 0xffff)
00047
00048
00049
00050
00051
00052
00053 class DcmTagKey {
00054 private:
00055 Uint16 group;
00056 Uint16 element;
00057
00058 protected:
00059 int groupLT(const DcmTagKey& key) const;
00060 int groupGT(const DcmTagKey& key) const;
00061 int groupEQ(const DcmTagKey& key) const;
00062 int elementLT(const DcmTagKey& key) const;
00063 int elementGT(const DcmTagKey& key) const;
00064 int elementEQ(const DcmTagKey& key) const;
00065
00066 public:
00067 DcmTagKey();
00068 DcmTagKey(const DcmTagKey& key);
00069 DcmTagKey(Uint16 g, Uint16 e);
00070
00071 void set(const DcmTagKey& key);
00072 void set(Uint16 g, Uint16 e);
00073 void setGroup(Uint16 g);
00074 void setElement(Uint16 e);
00075 Uint16 getGroup() const;
00076 Uint16 getElement() const;
00077
00078 Uint32 hash() const;
00079
00080 DcmTagKey& operator = (const DcmTagKey& key);
00081 int operator == (const DcmTagKey& key) const;
00082 int operator != (const DcmTagKey& key) const;
00083 int operator < (const DcmTagKey& key) const;
00084 int operator > (const DcmTagKey& key) const;
00085 int operator <= (const DcmTagKey& key) const;
00086 int operator >= (const DcmTagKey& key) const;
00087
00088 friend ostream& operator<<(ostream& s, const DcmTagKey& k);
00089
00090 OFString toString() const;
00091
00096 OFBool isSignableTag() const;
00097 };
00098
00104 ostream& operator<<(ostream& s, const DcmTagKey& k);
00105
00106
00107
00108
00109
00110
00111
00112 inline
00113 DcmTagKey::DcmTagKey()
00114 : group(0xffff),
00115 element(0xffff)
00116 {
00117 }
00118
00119 inline
00120 DcmTagKey::DcmTagKey(const DcmTagKey& key)
00121 : group(key.group),
00122 element(key.element)
00123 {
00124 }
00125
00126 inline
00127 DcmTagKey::DcmTagKey(Uint16 g, Uint16 e)
00128 : group(g),
00129 element(e)
00130 {
00131 }
00132
00133
00134
00135 inline void
00136 DcmTagKey::set(const DcmTagKey& key)
00137 {
00138 group = key.group;
00139 element = key.element;
00140 }
00141
00142 inline void
00143 DcmTagKey::set(Uint16 g, Uint16 e)
00144 {
00145 group = g;
00146 element = e;
00147 }
00148
00149 inline void
00150 DcmTagKey::setGroup(Uint16 g)
00151 {
00152 group = g;
00153 }
00154
00155 inline void
00156 DcmTagKey::setElement(Uint16 e)
00157 {
00158 element = e;
00159 }
00160
00161 inline Uint16
00162 DcmTagKey::getGroup() const
00163 {
00164 return group;
00165 }
00166
00167 inline Uint16
00168 DcmTagKey::getElement() const
00169 {
00170 return element;
00171 }
00172
00173 inline DcmTagKey&
00174 DcmTagKey::operator=(const DcmTagKey& key)
00175 {
00176 set(key);
00177 return *this;
00178 }
00179
00180
00181
00182 inline Uint32
00183 DcmTagKey::hash() const
00184 {
00185
00186 return (((getGroup() << 16) & 0xffff0000) | (getElement() & 0xffff));
00187 }
00188
00189
00190
00191 inline int
00192 DcmTagKey::groupLT(const DcmTagKey& key) const
00193 {
00194 return (getGroup() < key.getGroup());
00195 }
00196
00197 inline int
00198 DcmTagKey::groupGT(const DcmTagKey& key) const
00199 {
00200 return (getGroup() > key.getGroup());
00201 }
00202
00203 inline int
00204 DcmTagKey::groupEQ(const DcmTagKey& key) const
00205 {
00206 return getGroup() == key.getGroup();
00207 }
00208
00209 inline int
00210 DcmTagKey::elementLT(const DcmTagKey& key) const
00211 {
00212 return (getElement() < key.getElement());
00213 }
00214
00215 inline int
00216 DcmTagKey::elementGT(const DcmTagKey& key) const
00217 {
00218 return (getElement() > key.getElement());
00219 }
00220
00221 inline int
00222 DcmTagKey::elementEQ(const DcmTagKey& key) const
00223 {
00224 return getElement() == key.getElement();
00225 }
00226
00227 inline int
00228 DcmTagKey::operator == (const DcmTagKey& key) const
00229 {
00230 return ( groupEQ(key) && elementEQ(key) );
00231 }
00232
00233 inline int
00234 DcmTagKey::operator != (const DcmTagKey& key) const
00235 {
00236 return !(*this == key);
00237 }
00238
00239 inline int
00240 DcmTagKey::operator < (const DcmTagKey& key) const
00241 {
00242 return (groupLT(key) || (groupEQ(key) && elementLT(key)));
00243 }
00244
00245 inline int
00246 DcmTagKey::operator > (const DcmTagKey& key) const
00247 {
00248 return (groupGT(key) || (groupEQ(key) && elementGT(key)));
00249 }
00250
00251 inline int
00252 DcmTagKey::operator <= (const DcmTagKey& key) const
00253 {
00254 return (*this < key) || (*this == key);
00255 }
00256
00257 inline int
00258 DcmTagKey::operator >= (const DcmTagKey& key) const
00259 {
00260 return (*this > key) || (*this == key);
00261 }
00262
00263 #endif
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323