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, Andreas Barth 00017 * 00018 * Purpose: Interface of class DcmCodeString 00019 * 00020 * Last Update: $Author: joergr $ 00021 * Update Date: $Date: 2010-11-05 09:34:11 $ 00022 * CVS/RCS Revision: $Revision: 1.25 $ 00023 * Status: $State: Exp $ 00024 * 00025 * CVS/RCS Log at end of file 00026 * 00027 */ 00028 00029 00030 #ifndef DCVRCS_H 00031 #define DCVRCS_H 00032 00033 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00034 00035 #include "dcmtk/dcmdata/dcbytstr.h" 00036 00037 00040 class DcmCodeString 00041 : public DcmByteString 00042 { 00043 00044 public: 00045 00051 DcmCodeString(const DcmTag &tag, 00052 const Uint32 len = 0); 00053 00057 DcmCodeString(const DcmCodeString &old); 00058 00061 virtual ~DcmCodeString(); 00062 00067 DcmCodeString &operator=(const DcmCodeString &obj); 00068 00072 virtual DcmObject *clone() const 00073 { 00074 return new DcmCodeString(*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 00116 /* --- static helper functions --- */ 00117 00128 static OFBool checkVR(const OFString &value, 00129 size_t *pos = NULL, 00130 const OFBool checkLength = OFTrue); 00131 00140 static OFCondition checkStringValue(const OFString &value, 00141 const OFString &vm = "1-n"); 00142 }; 00143 00144 00145 #endif // DCVRCS_H 00146 00147 00148 /* 00149 ** CVS/RCS Log: 00150 ** $Log: dcvrcs.h,v $ 00151 ** Revision 1.25 2010-11-05 09:34:11 joergr 00152 ** Added support for checking the value multiplicity "9" (see Supplement 131). 00153 ** 00154 ** Revision 1.24 2010-10-14 13:15:42 joergr 00155 ** Updated copyright header. Added reference to COPYRIGHT file. 00156 ** 00157 ** Revision 1.23 2010-04-23 15:26:12 joergr 00158 ** Specify an appropriate default value for the "vm" parameter of checkValue(). 00159 ** 00160 ** Revision 1.22 2010-04-23 14:25:27 joergr 00161 ** Added new method to all VR classes which checks whether the stored value 00162 ** conforms to the VR definition and to the specified VM. 00163 ** 00164 ** Revision 1.21 2010-04-22 09:31:30 joergr 00165 ** Revised misleading parameter documentation for the checkValue() method. 00166 ** 00167 ** Revision 1.20 2010-04-22 08:59:10 joergr 00168 ** Added support for further VM values ("1-8", "1-99", "16", "32") to be checked. 00169 ** 00170 ** Revision 1.19 2009-08-03 09:05:30 joergr 00171 ** Added methods that check whether a given string value conforms to the VR and 00172 ** VM definitions of the DICOM standards. 00173 ** 00174 ** Revision 1.18 2008-07-17 11:19:49 onken 00175 ** Updated copyFrom() documentation. 00176 ** 00177 ** Revision 1.17 2008-07-17 10:30:23 onken 00178 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which 00179 ** permits setting an instance's value from an existing object. Implemented 00180 ** assignment operator where necessary. 00181 ** 00182 ** Revision 1.16 2005-12-08 16:28:54 meichel 00183 ** Changed include path schema for all DCMTK header files 00184 ** 00185 ** Revision 1.15 2004/07/01 12:28:25 meichel 00186 ** Introduced virtual clone method for DcmObject and derived classes. 00187 ** 00188 ** Revision 1.14 2003/06/12 13:30:58 joergr 00189 ** Added static function checkVR(). 00190 ** 00191 ** Revision 1.13 2002/12/06 12:49:14 joergr 00192 ** Enhanced "print()" function by re-working the implementation and replacing 00193 ** the boolean "showFullData" parameter by a more general integer flag. 00194 ** Added doc++ documentation. 00195 ** Made source code formatting more consistent with other modules/files. 00196 ** 00197 ** Revision 1.12 2002/04/25 09:48:10 joergr 00198 ** Removed getOFStringArray() implementation. 00199 ** 00200 ** Revision 1.11 2001/09/25 17:19:30 meichel 00201 ** Adapted dcmdata to class OFCondition 00202 ** 00203 ** Revision 1.10 2001/06/01 15:48:48 meichel 00204 ** Updated copyright header 00205 ** 00206 ** Revision 1.9 2000/03/08 16:26:22 meichel 00207 ** Updated copyright header. 00208 ** 00209 ** Revision 1.8 1999/03/31 09:24:57 meichel 00210 ** Updated copyright header in module dcmdata 00211 ** 00212 ** Revision 1.7 1998/11/12 16:47:46 meichel 00213 ** Implemented operator= for all classes derived from DcmObject. 00214 ** 00215 ** Revision 1.6 1997/09/11 15:13:12 hewett 00216 ** Modified getOFString method arguments by removing a default value 00217 ** for the pos argument. By requiring the pos argument to be provided 00218 ** ensures that callers realise getOFString only gets one component of 00219 ** a multi-valued string. 00220 ** 00221 ** Revision 1.5 1997/08/29 08:32:40 andreas 00222 ** - Added methods getOFString and getOFStringArray for all 00223 ** string VRs. These methods are able to normalise the value, i. e. 00224 ** to remove leading and trailing spaces. This will be done only if 00225 ** it is described in the standard that these spaces are not relevant. 00226 ** These methods do not test the strings for conformance, this means 00227 ** especially that they do not delete spaces where they are not allowed! 00228 ** getOFStringArray returns the string with all its parts separated by \ 00229 ** and getOFString returns only one value of the string. 00230 ** CAUTION: Currently getString returns a string with trailing 00231 ** spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and 00232 ** truncates the original string (since it is not copied!). If you rely on this 00233 ** behaviour please change your application now. 00234 ** Future changes will ensure that getString returns the original 00235 ** string from the DICOM object (NULL terminated) inclusive padding. 00236 ** Currently, if you call getOF... before calling getString without 00237 ** normalisation, you can get the original string read from the DICOM object. 00238 ** 00239 ** Revision 1.4 1996/01/09 11:06:17 andreas 00240 ** New Support for Visual C++ 00241 ** Correct problems with inconsistent const declarations 00242 ** 00243 ** Revision 1.3 1996/01/05 13:23:03 andreas 00244 ** - changed to support new streaming facilities 00245 ** - more cleanups 00246 ** - merged read / write methods for block and file transfer 00247 ** 00248 */