OFFIS DCMTK
Version 3.6.0
Main Page
Related Pages
Classes
Files
File List
File Members
dcmdata
include
dcmtk
dcmdata
dctagkey.h
1
/*
2
*
3
* Copyright (C) 1994-2010, OFFIS e.V.
4
* All rights reserved. See COPYRIGHT file for details.
5
*
6
* This software and supporting documentation were developed by
7
*
8
* OFFIS e.V.
9
* R&D Division Health
10
* Escherweg 2
11
* D-26121 Oldenburg, Germany
12
*
13
*
14
* Module: dcmdata
15
*
16
* Author: Andrew Hewett
17
*
18
* Purpose: Basis class for dicom tags.
19
*
20
* Last Update: $Author: joergr $
21
* Update Date: $Date: 2010-10-21 07:52:40 $
22
* CVS/RCS Revision: $Revision: 1.23 $
23
* Status: $State: Exp $
24
*
25
* CVS/RCS Log at end of file
26
*
27
*/
28
29
#ifndef DCMTAGKEY_H
30
#define DCMTAGKEY_H 1
31
32
#include "dcmtk/config/osconfig.h"
/* make sure OS specific configuration is included first */
33
34
#include "dcmtk/ofstd/ofstream.h"
35
#include "dcmtk/ofstd/ofstring.h"
36
37
/*
38
** Defines
39
*/
40
42
#define DCM_UndefinedTagKey DcmTagKey(0xffff, 0xffff)
43
46
class
DcmTagKey
47
{
48
public
:
49
52
DcmTagKey
();
53
57
DcmTagKey
(
const
DcmTagKey
& key);
58
63
DcmTagKey
(Uint16 g, Uint16 e);
64
67
virtual
~DcmTagKey
();
68
72
void
set
(
const
DcmTagKey
& key);
73
78
void
set
(Uint16 g, Uint16 e);
79
83
void
setGroup
(Uint16 g);
84
88
void
setElement
(Uint16 e);
89
93
Uint16
getGroup
()
const
;
94
98
Uint16
getElement
()
const
;
99
104
OFBool
isGroupLength
()
const
;
105
110
OFBool
isPrivate
()
const
;
111
117
OFBool
isPrivateReservation
()
const
;
118
123
OFBool
hasValidGroup
()
const
;
124
129
Uint32
hash
()
const
;
// generate simple hash code
130
136
DcmTagKey
&
operator =
(
const
DcmTagKey
& key);
137
143
int
operator ==
(
const
DcmTagKey
& key)
const
;
144
150
int
operator !=
(
const
DcmTagKey
& key)
const
;
151
157
int
operator <
(
const
DcmTagKey
& key)
const
;
158
164
int
operator >
(
const
DcmTagKey
& key)
const
;
165
171
int
operator <=
(
const
DcmTagKey
& key)
const
;
172
178
int
operator >=
(
const
DcmTagKey
& key)
const
;
179
180
friend
STD_NAMESPACE ostream&
operator<<
(STD_NAMESPACE ostream& s,
const
DcmTagKey
& k);
181
185
OFString
toString
()
const
;
186
191
OFBool
isSignableTag
()
const
;
192
193
protected
:
194
196
int
groupLT
(
const
DcmTagKey
& key)
const
;
197
199
int
groupGT
(
const
DcmTagKey
& key)
const
;
200
202
int
groupEQ
(
const
DcmTagKey
& key)
const
;
203
205
int
elementLT
(
const
DcmTagKey
& key)
const
;
206
208
int
elementGT
(
const
DcmTagKey
& key)
const
;
209
211
int
elementEQ
(
const
DcmTagKey
& key)
const
;
212
213
private
:
214
216
Uint16
group
;
218
Uint16
element
;
219
220
};
221
227
STD_NAMESPACE ostream& operator<<(STD_NAMESPACE ostream& s,
const
DcmTagKey
& k);
228
229
/*
230
** inline versions of functions
231
*/
232
233
/* constructors and destructor */
234
235
inline
236
DcmTagKey::DcmTagKey
()
237
: group(0xffff),
238
element(0xffff)
239
{
240
}
241
242
inline
243
DcmTagKey::DcmTagKey
(
const
DcmTagKey
& key)
244
: group(key.group),
245
element(key.element)
246
{
247
}
248
249
inline
250
DcmTagKey::DcmTagKey
(Uint16 g, Uint16 e)
251
: group(g),
252
element(e)
253
{
254
}
255
256
inline
257
DcmTagKey::~DcmTagKey
()
258
{
259
}
260
261
/* access methods */
262
263
inline
void
264
DcmTagKey::set
(
const
DcmTagKey
& key)
265
{
266
group
= key.
group
;
267
element
= key.
element
;
268
}
269
270
inline
void
271
DcmTagKey::set
(Uint16 g, Uint16 e)
272
{
273
group
= g;
274
element
= e;
275
}
276
277
inline
void
278
DcmTagKey::setGroup
(Uint16 g)
279
{
280
group
= g;
281
}
282
283
inline
void
284
DcmTagKey::setElement
(Uint16 e)
285
{
286
element
= e;
287
}
288
289
inline
Uint16
290
DcmTagKey::getGroup
()
const
291
{
292
return
group
;
293
}
294
295
inline
Uint16
296
DcmTagKey::getElement
()
const
297
{
298
return
element
;
299
}
300
301
inline
OFBool
302
DcmTagKey::isGroupLength
()
const
303
{
304
return
(
element
== 0) &&
hasValidGroup
();
305
}
306
307
inline
OFBool
308
DcmTagKey::isPrivate
()
const
309
{
310
return
((
group
& 1) != 0 ) &&
hasValidGroup
();
311
}
312
313
inline
OFBool
314
DcmTagKey::isPrivateReservation
()
const
315
{
316
// private reservation has element number ranging from 0x0010 to 0x00FF
317
return
isPrivate
() && (
element
>= 0x10) && (
element
<= 0xFF);
318
}
319
320
inline
OFBool
321
DcmTagKey::hasValidGroup
()
const
322
{
323
// group numbers 1, 3, 5, 7 and 0xFFFF are illegal in DICOM
324
if
(((
group
& 1) != 0) && ((
group
<= 7) || (
group
== 0xFFFF)))
325
return
OFFalse;
326
else
327
return
OFTrue;
328
}
329
330
inline
DcmTagKey
&
331
DcmTagKey::operator=
(
const
DcmTagKey
& key)
332
{
333
set
(key);
334
return
*
this
;
335
}
336
337
/* Simple Hash Function */
338
339
inline
Uint32
340
DcmTagKey::hash
()
const
341
{
342
// generate simple hash code
343
return
(((
getGroup
() << 16) & 0xffff0000) | (
getElement
() & 0xffff));
344
}
345
346
/* Comparisons */
347
348
inline
int
349
DcmTagKey::groupLT
(
const
DcmTagKey
& key)
const
350
{
351
return
(
getGroup
() < key.
getGroup
());
352
}
353
354
inline
int
355
DcmTagKey::groupGT
(
const
DcmTagKey
& key)
const
356
{
357
return
(
getGroup
() > key.
getGroup
());
358
}
359
360
inline
int
361
DcmTagKey::groupEQ
(
const
DcmTagKey
& key)
const
362
{
363
return
getGroup
() == key.
getGroup
();
364
}
365
366
inline
int
367
DcmTagKey::elementLT
(
const
DcmTagKey
& key)
const
368
{
369
return
(
getElement
() < key.
getElement
());
370
}
371
372
inline
int
373
DcmTagKey::elementGT
(
const
DcmTagKey
& key)
const
374
{
375
return
(
getElement
() > key.
getElement
());
376
}
377
378
inline
int
379
DcmTagKey::elementEQ
(
const
DcmTagKey
& key)
const
380
{
381
return
getElement
() == key.
getElement
();
382
}
383
384
inline
int
385
DcmTagKey::operator ==
(
const
DcmTagKey
& key)
const
386
{
387
return
(
groupEQ
(key) &&
elementEQ
(key) );
388
}
389
390
inline
int
391
DcmTagKey::operator !=
(
const
DcmTagKey
& key)
const
392
{
393
return
!(*
this
== key);
394
}
395
396
inline
int
397
DcmTagKey::operator <
(
const
DcmTagKey
& key)
const
398
{
399
return
(
groupLT
(key) || (
groupEQ
(key) &&
elementLT
(key)));
400
}
401
402
inline
int
403
DcmTagKey::operator >
(
const
DcmTagKey
& key)
const
404
{
405
return
(
groupGT
(key) || (
groupEQ
(key) &&
elementGT
(key)));
406
}
407
408
inline
int
409
DcmTagKey::operator <=
(
const
DcmTagKey
& key)
const
410
{
411
return
(*
this
< key) || (*
this
== key);
412
}
413
414
inline
int
415
DcmTagKey::operator >=
(
const
DcmTagKey
& key)
const
416
{
417
return
(*
this
> key) || (*
this
== key);
418
}
419
420
#endif
421
422
423
/*
424
** CVS/RCS Log:
425
** $Log: dctagkey.h,v $
426
** Revision 1.23 2010-10-21 07:52:40 joergr
427
** Added virtual destructor in order to avoid warnings reported by gcc with
428
** additional flags.
429
**
430
** Revision 1.22 2010-10-14 13:15:42 joergr
431
** Updated copyright header. Added reference to COPYRIGHT file.
432
**
433
** Revision 1.21 2010-03-01 09:08:44 uli
434
** Removed some unnecessary include directives in the headers.
435
**
436
** Revision 1.20 2009-04-20 16:00:08 joergr
437
** Added method that checks whether the tag key is a valid group length element.
438
**
439
** Revision 1.19 2009-01-15 16:06:27 onken
440
** Added convenience methods for private tag handling. Added doxygen
441
** documentation for not or badly documented member functions.
442
**
443
** Revision 1.18 2007-11-29 14:30:35 meichel
444
** Updated doxygen API documentation
445
**
446
** Revision 1.17 2006/08/15 15:49:56 meichel
447
** Updated all code in module dcmdata to correctly compile when
448
** all standard C++ classes remain in namespace std.
449
**
450
** Revision 1.16 2005/12/08 16:28:45 meichel
451
** Changed include path schema for all DCMTK header files
452
**
453
** Revision 1.15 2004/01/16 14:08:00 joergr
454
** Removed acknowledgements with e-mail addresses from CVS log.
455
**
456
** Revision 1.14 2003/11/13 14:06:36 meichel
457
** Fixed definition of DCM_UndefinedTagKey
458
**
459
** Revision 1.13 2003/11/05 15:56:31 meichel
460
** Added declaration of operator<< for DcmTagKeys.
461
** Fixes compilation issue on Visual C++ 6.0 SP 0.
462
**
463
** Revision 1.12 2002/04/16 13:41:44 joergr
464
** Added configurable support for C++ ANSI standard includes (e.g. streams).
465
**
466
** Revision 1.11 2001/11/19 15:23:11 meichel
467
** Cleaned up signature code to avoid some gcc warnings.
468
**
469
** Revision 1.10 2001/11/16 15:54:40 meichel
470
** Adapted digital signature code to final text of supplement 41.
471
**
472
** Revision 1.9 2001/06/01 15:48:45 meichel
473
** Updated copyright header
474
**
475
** Revision 1.8 2000/11/07 16:56:10 meichel
476
** Initial release of dcmsign module for DICOM Digital Signatures
477
**
478
** Revision 1.7 2000/03/08 16:26:19 meichel
479
** Updated copyright header.
480
**
481
** Revision 1.6 2000/02/07 14:45:16 meichel
482
** Removed const qualifier from DcmTagKey::toString(), avoids warning on Irix.
483
**
484
** Revision 1.5 1999/03/31 09:24:49 meichel
485
** Updated copyright header in module dcmdata
486
**
487
** Revision 1.4 1999/03/17 11:08:54 meichel
488
** added method DcmTagKey::toString()
489
**
490
** Revision 1.3 1998/07/15 15:48:54 joergr
491
** Removed several compiler warnings reported by gcc 2.8.1 with
492
** additional options, e.g. missing copy constructors and assignment
493
** operators, initialization of member variables in the body of a
494
** constructor instead of the member initialization list, hiding of
495
** methods by use of identical names, uninitialized member variables,
496
** missing const declaration of char pointers. Replaced tabs by spaces.
497
**
498
** Revision 1.2 1997/08/26 13:45:54 hewett
499
** Added simple hash function method.
500
**
501
** Revision 1.1 1995/11/23 16:38:04 hewett
502
** Updated for loadable data dictionary + some cleanup (more to do).
503
**
504
*/
Generated on Thu Dec 20 2012 for
OFFIS DCMTK
Version 3.6.0 by
Doxygen
1.8.2