1 /* 2 * 3 * Copyright (C) 2008-2012, OFFIS e.V. and ICSMED AG, Oldenburg, Germany 4 * Copyright (C) 2013-2017, J. Riesmeier, Oldenburg, Germany 5 * All rights reserved. See COPYRIGHT file for details. 6 * 7 * Header file for class DRTPhysiciansOfRecordIdentificationSequence 8 * 9 * Generated automatically from DICOM PS 3.3-2017e 10 * File created on 2017-12-05 09:30:54 11 * 12 */ 13 14 15 #ifndef DRTPORIS_H 16 #define DRTPORIS_H 17 18 #include "dcmtk/config/osconfig.h" // make sure OS specific configuration is included first 19 20 #include "dcmtk/ofstd/oflist.h" // for standard list class 21 #include "dcmtk/dcmrt/drttypes.h" // module-specific helper class 22 #include "dcmtk/dcmrt/seq/drtics.h" // for InstitutionCodeSequence 23 #include "dcmtk/dcmrt/seq/drtpics.h" // for PersonIdentificationCodeSequence 24 25 26 /** Interface class for PhysiciansOfRecordIdentificationSequence (0008,1049) 27 */ 28 class DCMTK_DCMRT_EXPORT DRTPhysiciansOfRecordIdentificationSequence 29 : protected DRTTypes 30 { 31 32 public: 33 34 /** Item class 35 */ 36 class DCMTK_DCMRT_EXPORT Item 37 : protected DRTTypes 38 { 39 40 public: 41 42 // --- constructors, destructor and operators --- 43 44 /** (default) constructor 45 * @param emptyDefaultItem flag used to mark the empty default item 46 */ 47 Item(const OFBool emptyDefaultItem = OFFalse); 48 49 /** copy constructor 50 * @param copy item object to be copied 51 */ 52 Item(const Item ©); 53 54 /** destructor 55 */ 56 virtual ~Item(); 57 58 /** assigment operator 59 * @param copy item object to be copied 60 * @return reference to this object 61 */ 62 Item &operator=(const Item ©); 63 64 // --- general methods --- 65 66 /** clear all internal member variables 67 */ 68 void clear(); 69 70 /** check if item is empty 71 * @return OFTrue if item is empty, OFFalse otherwise 72 */ 73 OFBool isEmpty(); 74 75 /** check if item is valid, i.e.\ not the empty default item 76 * @return OFTrue if item is valid, OFFalse otherwise 77 */ 78 OFBool isValid() const; 79 80 // --- input/output methods --- 81 82 /** read elements from sequence item 83 * @param item reference to DICOM sequence item from which the elements should be read 84 * @return status, EC_Normal if successful, an error code otherwise 85 */ 86 OFCondition read(DcmItem &item); 87 88 /** write elements to sequence item 89 * @param item reference to DICOM sequence item to which the elements should be written 90 * @return status, EC_Normal if successful, an error code otherwise 91 */ 92 OFCondition write(DcmItem &item); 93 94 // --- get DICOM attribute values --- 95 96 /** get InstitutionAddress (0008,0081) 97 * @param value reference to variable in which the value should be stored 98 * @param pos index of the value to get (0..vm-1), -1 for all components 99 * @return status, EC_Normal if successful, an error code otherwise 100 */ 101 OFCondition getInstitutionAddress(OFString &value, const signed long pos = 0) const; 102 103 /** get InstitutionName (0008,0080) 104 * @param value reference to variable in which the value should be stored 105 * @param pos index of the value to get (0..vm-1), -1 for all components 106 * @return status, EC_Normal if successful, an error code otherwise 107 */ 108 OFCondition getInstitutionName(OFString &value, const signed long pos = 0) const; 109 110 /** get PersonAddress (0040,1102) 111 * @param value reference to variable in which the value should be stored 112 * @param pos index of the value to get (0..vm-1), -1 for all components 113 * @return status, EC_Normal if successful, an error code otherwise 114 */ 115 OFCondition getPersonAddress(OFString &value, const signed long pos = 0) const; 116 117 /** get PersonTelecomInformation (0040,1104) 118 * @param value reference to variable in which the value should be stored 119 * @param pos index of the value to get (0..vm-1), -1 for all components 120 * @return status, EC_Normal if successful, an error code otherwise 121 */ 122 OFCondition getPersonTelecomInformation(OFString &value, const signed long pos = 0) const; 123 124 /** get PersonTelephoneNumbers (0040,1103) 125 * @param value reference to variable in which the value should be stored 126 * @param pos index of the value to get (0..vm-1), -1 for all components 127 * @return status, EC_Normal if successful, an error code otherwise 128 */ 129 OFCondition getPersonTelephoneNumbers(OFString &value, const signed long pos = 0) const; 130 131 // --- get DICOM sequence attributes --- 132 133 /** get InstitutionCodeSequence (0008,0082) 134 * @return reference to sequence element 135 */ getInstitutionCodeSequence()136 DRTInstitutionCodeSequence &getInstitutionCodeSequence() 137 { return InstitutionCodeSequence; } 138 139 /** get InstitutionCodeSequence (0008,0082) 140 * @return const reference to sequence element 141 */ getInstitutionCodeSequence()142 const DRTInstitutionCodeSequence &getInstitutionCodeSequence() const 143 { return InstitutionCodeSequence; } 144 145 /** get PersonIdentificationCodeSequence (0040,1101) 146 * @return reference to sequence element 147 */ getPersonIdentificationCodeSequence()148 DRTPersonIdentificationCodeSequence &getPersonIdentificationCodeSequence() 149 { return PersonIdentificationCodeSequence; } 150 151 /** get PersonIdentificationCodeSequence (0040,1101) 152 * @return const reference to sequence element 153 */ getPersonIdentificationCodeSequence()154 const DRTPersonIdentificationCodeSequence &getPersonIdentificationCodeSequence() const 155 { return PersonIdentificationCodeSequence; } 156 157 // --- set DICOM attribute values --- 158 159 /** set InstitutionAddress (0008,0081) 160 * @param value value to be set (single value only) or "" for no value 161 * @param check check 'value' for conformance with VR (ST) and VM (1) if enabled 162 * @return status, EC_Normal if successful, an error code otherwise 163 */ 164 OFCondition setInstitutionAddress(const OFString &value, const OFBool check = OFTrue); 165 166 /** set InstitutionName (0008,0080) 167 * @param value value to be set (single value only) or "" for no value 168 * @param check check 'value' for conformance with VR (LO) and VM (1) if enabled 169 * @return status, EC_Normal if successful, an error code otherwise 170 */ 171 OFCondition setInstitutionName(const OFString &value, const OFBool check = OFTrue); 172 173 /** set PersonAddress (0040,1102) 174 * @param value value to be set (single value only) or "" for no value 175 * @param check check 'value' for conformance with VR (ST) and VM (1) if enabled 176 * @return status, EC_Normal if successful, an error code otherwise 177 */ 178 OFCondition setPersonAddress(const OFString &value, const OFBool check = OFTrue); 179 180 /** set PersonTelecomInformation (0040,1104) 181 * @param value value to be set (single value only) or "" for no value 182 * @param check check 'value' for conformance with VR (LT) and VM (1) if enabled 183 * @return status, EC_Normal if successful, an error code otherwise 184 */ 185 OFCondition setPersonTelecomInformation(const OFString &value, const OFBool check = OFTrue); 186 187 /** set PersonTelephoneNumbers (0040,1103) 188 * @param value value to be set (possibly multi-valued) or "" for no value 189 * @param check check 'value' for conformance with VR (LO) and VM (1-n) if enabled 190 * @return status, EC_Normal if successful, an error code otherwise 191 */ 192 OFCondition setPersonTelephoneNumbers(const OFString &value, const OFBool check = OFTrue); 193 194 private: 195 196 /// internal flag used to mark the empty default item 197 /*const*/ OFBool EmptyDefaultItem; 198 199 /// InstitutionAddress (0008,0081) vr=ST, vm=1, type=3 200 DcmShortText InstitutionAddress; 201 /// InstitutionCodeSequence (0008,0082) vr=SQ, vm=1, type=1C 202 DRTInstitutionCodeSequence InstitutionCodeSequence; 203 /// InstitutionName (0008,0080) vr=LO, vm=1, type=1C 204 DcmLongString InstitutionName; 205 /// PersonAddress (0040,1102) vr=ST, vm=1, type=3 206 DcmShortText PersonAddress; 207 /// PersonIdentificationCodeSequence (0040,1101) vr=SQ, vm=1, type=1 208 DRTPersonIdentificationCodeSequence PersonIdentificationCodeSequence; 209 /// PersonTelecomInformation (0040,1104) vr=LT, vm=1, type=3 210 DcmLongText PersonTelecomInformation; 211 /// PersonTelephoneNumbers (0040,1103) vr=LO, vm=1-n, type=3 212 DcmLongString PersonTelephoneNumbers; 213 214 }; 215 216 // --- constructors, destructor and operators --- 217 218 /** (default) constructor 219 * @param emptyDefaultSequence internal flag used to mark the empty default sequence 220 */ 221 DRTPhysiciansOfRecordIdentificationSequence(const OFBool emptyDefaultSequence = OFFalse); 222 223 /** copy constructor 224 * @param copy sequence object to be copied 225 */ 226 DRTPhysiciansOfRecordIdentificationSequence(const DRTPhysiciansOfRecordIdentificationSequence ©); 227 228 /** destructor 229 */ 230 virtual ~DRTPhysiciansOfRecordIdentificationSequence(); 231 232 /** assigment operator 233 * @param copy sequence object to be copied 234 * @return reference to this object 235 */ 236 DRTPhysiciansOfRecordIdentificationSequence &operator=(const DRTPhysiciansOfRecordIdentificationSequence ©); 237 238 // --- general methods --- 239 240 /** clear all internal member variables 241 */ 242 void clear(); 243 244 /** check if sequence is empty 245 * @return OFTrue if sequence is empty, OFFalse otherwise 246 */ 247 OFBool isEmpty(); 248 249 /** check if sequence is valid, i.e.\ not the empty default sequence 250 * @return OFTrue if sequence is valid, OFFalse otherwise 251 */ 252 OFBool isValid() const; 253 254 /** get number of items in the sequence 255 * @return number of items 256 */ 257 size_t getNumberOfItems() const; 258 259 /** goto first item in the sequence 260 * @return status, EC_Normal if successful, an error code otherwise 261 */ 262 OFCondition gotoFirstItem(); 263 264 /** goto next item in the sequence 265 * @return status, EC_Normal if successful, an error code otherwise 266 */ 267 OFCondition gotoNextItem(); 268 269 /** goto particular item in the sequence 270 * @param num number of the item to be selected (0..num-1) 271 * @return status, EC_Normal if successful, an error code otherwise 272 */ 273 OFCondition gotoItem(const size_t num); 274 275 /** get current item in the sequence 276 * @param item reference to item pointer (result variable) 277 * @return status, EC_Normal if successful, an error code otherwise 278 */ 279 OFCondition getCurrentItem(Item *&item) const; 280 281 /** get current item in the sequence 282 * @return reference to specified item if successful, empty default item otherwise 283 */ 284 Item &getCurrentItem(); 285 286 /** get current item in the sequence 287 * @return const reference to specified item if successful, empty default item otherwise 288 */ 289 const Item &getCurrentItem() const; 290 291 /** get particular item in the sequence 292 * @param num number of the item to be retrieved (0..num-1) 293 * @param item reference to item pointer (result variable) 294 * @return status, EC_Normal if successful, an error code otherwise 295 */ 296 OFCondition getItem(const size_t num, Item *&item); 297 298 /** get particular item in the sequence 299 * @param num number of the item to be retrieved (0..num-1) 300 * @return reference to specified item if successful, empty default item otherwise 301 */ 302 Item &getItem(const size_t num); 303 304 /** get particular item in the sequence 305 * @param num number of the item to be retrieved (0..num-1) 306 * @return const reference to specified item if successful, empty default item otherwise 307 */ 308 const Item &getItem(const size_t num) const; 309 310 /** get particular item in the sequence 311 * @param num number of the item to be retrieved (0..num-1) 312 * @return reference to specified item if successful, empty default item otherwise 313 */ 314 Item &operator[](const size_t num); 315 316 /** get particular item in the sequence 317 * @param num number of the item to be retrieved (0..num-1) 318 * @return const reference to specified item if successful, empty default item otherwise 319 */ 320 const Item &operator[](const size_t num) const; 321 322 /** add new item to the end of this sequence 323 * @param item reference to new item pointer (result variable) 324 * @return status, EC_Normal if successful, an error code otherwise 325 */ 326 OFCondition addItem(Item *&item); 327 328 /** insert new item into the sequence 329 * @param pos position where the new item is to be inserted (0..num) 330 * @param item reference to new item pointer (result variable) 331 * @return status, EC_Normal if successful, an error code otherwise 332 */ 333 OFCondition insertItem(const size_t pos, Item *&item); 334 335 /** remove particular item from the sequence 336 * @param pos position of the item to be removed (0..num-1) 337 * @return status, EC_Normal if successful, an error code otherwise 338 */ 339 OFCondition removeItem(const size_t pos); 340 341 // --- input/output methods --- 342 343 /** read sequence of items from dataset 344 * @param dataset reference to DICOM dataset from which the sequence should be read 345 * @param card cardinality (valid range for number of items) 346 * @param type value type (valid value: "1", "1C", "2" or something else which is not checked) 347 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 348 * @return status, EC_Normal if successful, an error code otherwise 349 */ 350 OFCondition read(DcmItem &dataset, 351 const OFString &card, 352 const OFString &type, 353 const char *moduleName = NULL); 354 355 /** write sequence of items to dataset 356 * @param dataset reference to DICOM dataset to which the sequence should be written 357 * @param card cardinality (valid range for number of items) 358 * @param type value type (valid value: "1", "2" or something else which is not checked) 359 * @param moduleName optional module/sequence name to be printed (default: "RT object" if NULL) 360 * @return status, EC_Normal if successful, an error code otherwise 361 */ 362 OFCondition write(DcmItem &dataset, 363 const OFString &card, 364 const OFString &type, 365 const char *moduleName = NULL); 366 367 protected: 368 369 /** goto particular item in the sequence 370 * @param num number of the item to be selected (0..num-1) 371 * @param iterator list iterator storing the position of the item 372 * @return status, EC_Normal if successful, an error code otherwise 373 */ 374 OFCondition gotoItem(const size_t num, 375 OFListIterator(Item *) &iterator); 376 377 /** goto particular item in the sequence 378 * @param num number of the item to be selected (0..num-1) 379 * @param iterator list iterator storing the position of the item 380 * @return status, EC_Normal if successful, an error code otherwise 381 */ 382 OFCondition gotoItem(const size_t num, 383 OFListConstIterator(Item *) &iterator) const; 384 385 private: 386 387 /// internal flag used to mark the empty default sequence 388 /*const*/ OFBool EmptyDefaultSequence; 389 390 /// list of items in this sequence 391 OFList<Item *> SequenceOfItems; 392 /// currently selected item 393 OFListIterator(Item *) CurrentItem; 394 /// empty default item 395 Item EmptyItem; 396 397 }; 398 399 400 #endif 401