/usr/include/dcmtk/dcmdata/dcdicent.h is in libdcmtk-dev 3.6.1~20150924-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | /*
*
* Copyright (C) 1994-2011, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
*
* OFFIS e.V.
* R&D Division Health
* Escherweg 2
* D-26121 Oldenburg, Germany
*
*
* Module: dcmdata
*
* Author: Andrew Hewett
*
* Purpose: Interface for a dictionary entry in the loadable DICOM data dictionary
*
*/
#ifndef DCDICENT_H
#define DCDICENT_H
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dctagkey.h"
#include "dcmtk/dcmdata/dcvr.h"
#define INCLUDE_CSTRING /* for strcmp() */
#include "dcmtk/ofstd/ofstdinc.h"
/// constant describing an unlimited VM
#define DcmVariableVM -1
#define DCM_INRANGE(x,a,b) (((x) >= (a)) && ((x) <= (b)))
#define DCM_IS_ODD(x) (((x) % 2) == 1)
#define DCM_IS_EVEN(x) (((x) % 2) == 0)
/** attribute tag group/element range restrictions
*/
enum DcmDictRangeRestriction
{
/// integer range
DcmDictRange_Unspecified,
/// odd range
DcmDictRange_Odd,
/// even range
DcmDictRange_Even
};
/** each object of this class manages one entry of the
* global DICOM data dictionary.
*/
class DCMTK_DCMDATA_EXPORT DcmDictEntry: public DcmTagKey
{
public:
/** constructor
* @param g attribute tag group
* @param e attribute tag element
* @param vr value representation
* @param nam attribute name
* @param vmMin lower limit for value multiplicity
* @param vmMax upper limit for value multiplicity, DcmVariableVM for unlimited
* @param vers standard version name, may be NULL
* @param doCopyStrings true if strings should be copied, false if only referenced
* @param pcreator private creator name, may be NULL (for standard tags)
*/
DcmDictEntry(Uint16 g, Uint16 e, DcmVR vr,
const char* nam, int vmMin, int vmMax,
const char* vers, OFBool doCopyStrings,
const char* pcreator);
/** constructor for repeating tags
* @param g attribute tag group lower limit
* @param e attribute tag element lower limit
* @param ug attribute tag group upper limit
* @param ue attribute tag element upper limit
* @param vr value representation
* @param nam attribute name
* @param vmMin lower limit for value multiplicity
* @param vmMax upper limit for value multiplicity, DcmVariableVM for unlimited
* @param vers standard version name, may be NULL
* @param doCopyStrings true if strings should be copied, false if only referenced
* @param pcreator private creator name, may be NULL (for standard tags)
*/
DcmDictEntry(Uint16 g, Uint16 e, Uint16 ug, Uint16 ue, DcmVR vr,
const char* nam, int vmMin, int vmMax,
const char* vers, OFBool doCopyStrings,
const char* pcreator);
/// copy constructor
DcmDictEntry(const DcmDictEntry& e);
/// destructor
~DcmDictEntry();
/* access methods */
/// returns VR object by value
DcmVR getVR() const
{
return valueRepresentation;
}
/// returns VR code
DcmEVR getEVR() const
{
return valueRepresentation.getEVR();
}
/// returns standard version string, may be NULL
const char* getStandardVersion() const
{
return standardVersion;
}
/// returns tag name
const char* getTagName() const
{
return tagName;
}
/// returns private creator code, may be NULL
const char* getPrivateCreator() const
{
return privateCreator;
}
/** checks if the private creator code equals the given string
* @param c string to compare with, may be NULL
* @return true if equal, false otherwise
*/
int privateCreatorMatch(const char *c) const
{
return
(
((privateCreator == NULL) && (c == NULL)) ||
(privateCreator && c && (0 == strcmp(privateCreator, c)))
);
}
/** checks if the private creator code of this object matches
* the one of the given object.
* @param arg dictionary entry to compare with
* @return true if private creators are equal, false otherwise
*/
int privateCreatorMatch(const DcmDictEntry& arg) const
{
return privateCreatorMatch(arg.privateCreator);
}
/// returns lower limit for VM (value multiplicity)
int getVMMin() const
{
return valueMultiplicityMin;
}
/// returns upper limit for VM (value multiplicity), DcmVariableVM for unlimited
int getVMMax() const
{
return valueMultiplicityMax;
}
/// returns true if element has a single valid VM value
OFBool isFixedSingleVM() const
{
return ((valueMultiplicityMin != DcmVariableVM) &&
(valueMultiplicityMin == valueMultiplicityMax));
}
/// returns true if element has a fixed VM range
OFBool isFixedRangeVM() const
{
return ((valueMultiplicityMin != DcmVariableVM) &&
(valueMultiplicityMax != DcmVariableVM));
}
/// returns true if element has a variable VM range (no upper limit)
OFBool isVariableRangeVM() const
{
return ((valueMultiplicityMin != DcmVariableVM) &&
(valueMultiplicityMax == DcmVariableVM));
}
/** converts entry into repeating tag entry by defining an upper limit
* for group and element, taken from the given tag key.
* @param key tag key containing upper limit for group and element
*/
void setUpper(const DcmTagKey& key)
{
upperKey = key;
}
/** converts entry into repeating tag entry by defining an upper limit
* for tag group
* @param ug upper limit for tag group
*/
void setUpperGroup(Uint16 ug)
{
upperKey.setGroup(ug);
}
/** converts entry into repeating tag entry by defining an upper limit
* for tag element
* @param ue upper limit for tag element
*/
void setUpperElement(Uint16 ue)
{
upperKey.setElement(ue);
}
/// returns upper limit for tag group
Uint16 getUpperGroup() const
{
return upperKey.getGroup();
}
/// returns upper limit for tag element
Uint16 getUpperElement() const
{
return upperKey.getElement();
}
/// returns attribute tag as DcmTagKey object by value
DcmTagKey getKey() const
{
return * OFstatic_cast(const DcmTagKey *, this);
}
/// returns upper limits for attribute tag as DcmTagKey object by value
DcmTagKey getUpperKey() const
{
return upperKey;
}
/// returns true if entry is has a repeating group
int isRepeatingGroup() const
{
return (getGroup() != getUpperGroup());
}
/// returns true if entry is has a repeating element
int isRepeatingElement() const
{
return (getElement() != getUpperElement());
}
/// returns true if entry is repeating (group or element)
int isRepeating() const
{
return (isRepeatingGroup() || isRepeatingElement());
}
/// returns group range restriction
DcmDictRangeRestriction getGroupRangeRestriction() const
{
return groupRangeRestriction;
}
/// sets group range restriction
void setGroupRangeRestriction(DcmDictRangeRestriction rr)
{
groupRangeRestriction = rr;
}
/// returns element range restriction
DcmDictRangeRestriction getElementRangeRestriction() const
{
return elementRangeRestriction;
}
/// sets element range restriction
void setElementRangeRestriction(DcmDictRangeRestriction rr)
{
elementRangeRestriction = rr;
}
/* containment */
/** checks if the given tag key and private creator code are covered
* by this object.
* @param key tag key
* @param privCreator private creator, may be NULL
* @return true if this entry contains the given tag for the given private creator
*/
int contains(const DcmTagKey& key, const char *privCreator) const /* this contains key */
{
if ((getGroupRangeRestriction() == DcmDictRange_Even) &&
DCM_IS_ODD(key.getGroup()))
return OFFalse;
else if ((getGroupRangeRestriction() == DcmDictRange_Odd) &&
DCM_IS_EVEN(key.getGroup()))
return OFFalse;
else if ((getElementRangeRestriction() == DcmDictRange_Even) &&
DCM_IS_ODD(key.getElement()))
return OFFalse;
else if ((getElementRangeRestriction() == DcmDictRange_Odd) &&
DCM_IS_EVEN(key.getElement()))
return OFFalse;
else if (! privateCreatorMatch(privCreator))
return OFFalse;
else
{
const OFBool groupMatches=DCM_INRANGE(key.getGroup(), getGroup(), getUpperGroup());
OFBool found=groupMatches && DCM_INRANGE(key.getElement(), getElement(), getUpperElement());
if (!found && groupMatches && privCreator)
found=DCM_INRANGE(key.getElement() & 0xFF, getElement(), getUpperElement());
return found;
}
}
/** checks if this entry contains the given name
* @param name attribute name, must not be NULL
* @return true if tagName matches the given string
*/
int contains(const char *name) const /* this contains named key */
{
return !strcmp( tagName, name );
}
/* set relations */
/** checks if this entry describes a true subset of tag range
* described by the given entry.
* @param e entry to compare with
* @return true if this object is subset of e
*/
int subset(const DcmDictEntry& e) const /* this is a subset of key */
{
return ( (getGroup() >= e.getGroup()) &&
(getUpperGroup() <= e.getUpperGroup()) &&
(getElement() >= e.getElement()) &&
(getUpperElement() <= e.getUpperElement()) &&
privateCreatorMatch(e.privateCreator)
);
}
/** checks if this entry describes the same tag range as the given entry.
* @param e entry to compare with
* @return true if objects describe the same tag range
*/
int setEQ(const DcmDictEntry& e) const /* this is set equal to key */
{
return ( (getGroup() == e.getGroup()) &&
(getUpperGroup() == e.getUpperGroup()) &&
(getElement() == e.getElement()) &&
(getUpperElement() == e.getUpperElement()) &&
(getGroupRangeRestriction() == e.getGroupRangeRestriction()) &&
(getElementRangeRestriction() == e.getElementRangeRestriction()) &&
privateCreatorMatch(e.privateCreator)
);
}
/// friend operator<<
friend DCMTK_DCMDATA_EXPORT STD_NAMESPACE ostream& operator<<(STD_NAMESPACE ostream& s, const DcmDictEntry& e);
private:
/// private undefined copy assignment operator
DcmDictEntry &operator=(const DcmDictEntry &);
/** upper limit of repeating group and element (lower limit is inherited
* from DcmTagKey)
*/
DcmTagKey upperKey;
/// value representation
DcmVR valueRepresentation;
/// attribute name
const char *tagName;
/// lower limit for VM
int valueMultiplicityMin;
/// upper limit for VM
int valueMultiplicityMax;
/// standard version name, may be NULL
const char *standardVersion;
/// true if strings are copies (i.e. should be deleted upon destruction)
OFBool stringsAreCopies;
/// restriction (even, odd, unrestricted) for group range
DcmDictRangeRestriction groupRangeRestriction;
/// restriction (even, odd, unrestricted) for element range
DcmDictRangeRestriction elementRangeRestriction;
/// private creator name, may be NULL
const char *privateCreator;
};
#endif /* !DCDICENT_H */
|