00001 /* 00002 * 00003 * Copyright (C) 1994-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmdata 00015 * 00016 * Author: Gerd Ehlers 00017 * 00018 * Purpose: Interface of class DcmPersonName 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-11-05 09:34:11 $ 00022 * CVS/RCS Revision: $Revision: 1.26 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DCVRPN_H 00031 #define DCVRPN_H 00032 00033 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00034 00035 #include "dcmtk/dcmdata/dcchrstr.h" 00036 00037 00040 class DcmPersonName 00041 : public DcmCharString 00042 { 00043 00044 public: 00045 00051 DcmPersonName(const DcmTag &tag, 00052 const Uint32 len = 0); 00053 00057 DcmPersonName(const DcmPersonName &old); 00058 00061 virtual ~DcmPersonName(); 00062 00067 DcmPersonName &operator=(const DcmPersonName &obj); 00068 00072 virtual DcmObject *clone() const 00073 { 00074 return new DcmPersonName(*this); 00075 } 00076 00089 virtual OFCondition copyFrom(const DcmObject& rhs); 00090 00094 virtual DcmEVR ident() const; 00095 00103 virtual OFCondition checkValue(const OFString &vm = "1-n", 00104 const OFBool oldFormat = OFFalse); 00105 00112 virtual OFCondition getOFString(OFString &stringVal, 00113 const unsigned long pos, 00114 OFBool normalize = OFTrue); 00115 00136 OFCondition getNameComponents(OFString &lastName, 00137 OFString &firstName, 00138 OFString &middleName, 00139 OFString &namePrefix, 00140 OFString &nameSuffix, 00141 const unsigned long pos = 0, 00142 const unsigned int componentGroup = 0); 00143 00154 OFCondition getFormattedName(OFString &formattedName, 00155 const unsigned long pos = 0, 00156 const unsigned int componentGroup = 0); 00157 00158 00170 OFCondition putNameComponents(const OFString &lastName, 00171 const OFString &firstName, 00172 const OFString &middleName, 00173 const OFString &namePrefix, 00174 const OFString &nameSuffix); 00175 00176 /* --- static helper functions --- */ 00177 00198 static OFCondition getNameComponentsFromString(const OFString &dicomName, 00199 OFString &lastName, 00200 OFString &firstName, 00201 OFString &middleName, 00202 OFString &namePrefix, 00203 OFString &nameSuffix, 00204 const unsigned int componentGroup = 0); 00205 00216 static OFCondition getFormattedNameFromString(const OFString &dicomName, 00217 OFString &formattedName, 00218 const unsigned int componentGroup = 0); 00219 00232 static OFCondition getFormattedNameFromComponents(const OFString &lastName, 00233 const OFString &firstName, 00234 const OFString &middleName, 00235 const OFString &namePrefix, 00236 const OFString &nameSuffix, 00237 OFString &formattedName); 00238 00251 static OFCondition getStringFromNameComponents(const OFString &lastName, 00252 const OFString &firstName, 00253 const OFString &middleName, 00254 const OFString &namePrefix, 00255 const OFString &nameSuffix, 00256 OFString &dicomName); 00257 00267 static OFCondition checkStringValue(const OFString &value, 00268 const OFString &vm = "1-n", 00269 const OFBool oldFormat = OFTrue); 00270 }; 00271 00272 00273 #endif // DCVRPN_H 00274 00275 00276 /* 00277 ** CVS/RCS Log: 00278 ** $Log: dcvrpn.h,v $ 00279 ** Revision 1.26 2010-11-05 09:34:11 joergr 00280 ** Added support for checking the value multiplicity "9" (see Supplement 131). 00281 ** 00282 ** Revision 1.25 2010-10-14 13:15:43 joergr 00283 ** Updated copyright header. Added reference to COPYRIGHT file. 00284 ** 00285 ** Revision 1.24 2010-04-23 15:26:13 joergr 00286 ** Specify an appropriate default value for the "vm" parameter of checkValue(). 00287 ** 00288 ** Revision 1.23 2010-04-23 14:25:27 joergr 00289 ** Added new method to all VR classes which checks whether the stored value 00290 ** conforms to the VR definition and to the specified VM. 00291 ** 00292 ** Revision 1.22 2010-04-22 09:31:30 joergr 00293 ** Revised misleading parameter documentation for the checkValue() method. 00294 ** 00295 ** Revision 1.21 2010-04-22 08:59:10 joergr 00296 ** Added support for further VM values ("1-8", "1-99", "16", "32") to be checked. 00297 ** 00298 ** Revision 1.20 2009-08-03 09:05:30 joergr 00299 ** Added methods that check whether a given string value conforms to the VR and 00300 ** VM definitions of the DICOM standards. 00301 ** 00302 ** Revision 1.19 2008-07-17 11:19:49 onken 00303 ** Updated copyFrom() documentation. 00304 ** 00305 ** Revision 1.18 2008-07-17 10:30:23 onken 00306 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which 00307 ** permits setting an instance's value from an existing object. Implemented 00308 ** assignment operator where necessary. 00309 ** 00310 ** Revision 1.17 2005-12-08 16:29:05 meichel 00311 ** Changed include path schema for all DCMTK header files 00312 ** 00313 ** Revision 1.16 2004/07/01 12:28:25 meichel 00314 ** Introduced virtual clone method for DcmObject and derived classes. 00315 ** 00316 ** Revision 1.15 2003/05/20 08:56:20 joergr 00317 ** Added methods and static functions to compose a DICOM Person Name from five 00318 ** name components. 00319 ** 00320 ** Revision 1.14 2002/12/06 12:49:17 joergr 00321 ** Enhanced "print()" function by re-working the implementation and replacing 00322 ** the boolean "showFullData" parameter by a more general integer flag. 00323 ** Added doc++ documentation. 00324 ** Made source code formatting more consistent with other modules/files. 00325 ** 00326 ** Revision 1.13 2002/04/25 09:56:19 joergr 00327 ** Removed getOFStringArray() implementation. 00328 ** 00329 ** Revision 1.12 2001/10/10 15:17:38 joergr 00330 ** Updated comments. 00331 ** 00332 ** Revision 1.11 2001/10/01 15:01:39 joergr 00333 ** Introduced new general purpose functions to get/set person names, date, time 00334 ** and date/time. 00335 ** 00336 ** Revision 1.10 2001/09/25 17:19:33 meichel 00337 ** Adapted dcmdata to class OFCondition 00338 ** 00339 ** Revision 1.9 2001/06/01 15:48:51 meichel 00340 ** Updated copyright header 00341 ** 00342 ** Revision 1.8 2000/03/08 16:26:25 meichel 00343 ** Updated copyright header. 00344 ** 00345 ** Revision 1.7 1999/03/31 09:25:04 meichel 00346 ** Updated copyright header in module dcmdata 00347 ** 00348 ** Revision 1.6 1998/11/12 16:47:52 meichel 00349 ** Implemented operator= for all classes derived from DcmObject. 00350 ** 00351 ** Revision 1.5 1997/09/11 15:13:16 hewett 00352 ** Modified getOFString method arguments by removing a default value 00353 ** for the pos argument. By requiring the pos argument to be provided 00354 ** ensures that callers realise getOFString only gets one component of 00355 ** a multi-valued string. 00356 ** 00357 ** Revision 1.4 1997/08/29 08:32:43 andreas 00358 ** - Added methods getOFString and getOFStringArray for all 00359 ** string VRs. These methods are able to normalise the value, i. e. 00360 ** to remove leading and trailing spaces. This will be done only if 00361 ** it is described in the standard that these spaces are not relevant. 00362 ** These methods do not test the strings for conformance, this means 00363 ** especially that they do not delete spaces where they are not allowed! 00364 ** getOFStringArray returns the string with all its parts separated by \ 00365 ** and getOFString returns only one value of the string. 00366 ** CAUTION: Currently getString returns a string with trailing 00367 ** spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and 00368 ** truncates the original string (since it is not copied!). If you rely on this 00369 ** behaviour please change your application now. 00370 ** Future changes will ensure that getString returns the original 00371 ** string from the DICOM object (NULL terminated) inclusive padding. 00372 ** Currently, if you call getOF... before calling getString without 00373 ** normalisation, you can get the original string read from the DICOM object. 00374 ** 00375 ** Revision 1.3 1996/01/05 13:23:08 andreas 00376 ** - changed to support new streaming facilities 00377 ** - more cleanups 00378 ** - merged read / write methods for block and file transfer 00379 ** 00380 */