00001 /* 00002 * 00003 * Copyright (C) 1994-2004, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmdata 00019 * 00020 * Author: Gerd Ehlers, Joerg Riesmeier 00021 * 00022 * Purpose: Interface of class DcmDateTime 00023 * 00024 * Last Update: $Author: joergr $ 00025 * Update Date: $Date: 2004/04/16 12:49:25 $ 00026 * CVS/RCS Revision: $Revision: 1.17 $ 00027 * Status: $State: Exp $ 00028 * 00029 * CVS/RCS Log at end of file 00030 * 00031 */ 00032 00033 #ifndef DCVRDT_H 00034 #define DCVRDT_H 00035 00036 #include "osconfig.h" /* make sure OS specific configuration is included first */ 00037 00038 #include "dctypes.h" 00039 #include "dcbytstr.h" 00040 #include "ofdatime.h" 00041 00042 00045 class DcmDateTime 00046 : public DcmByteString 00047 { 00048 00049 public: 00050 00056 DcmDateTime(const DcmTag &tag, 00057 const Uint32 len = 0); 00058 00062 DcmDateTime(const DcmDateTime &old); 00063 00066 virtual ~DcmDateTime(); 00067 00072 DcmDateTime &operator=(const DcmDateTime &obj); 00073 00077 virtual DcmEVR ident() const; 00078 00085 virtual OFCondition getOFString(OFString &stringValue, 00086 const unsigned long pos, 00087 OFBool normalize = OFTrue); 00088 00102 OFCondition setCurrentDateTime(const OFBool seconds = OFTrue, 00103 const OFBool fraction = OFFalse, 00104 const OFBool timeZone = OFFalse); 00105 00110 OFCondition setOFDateTime(const OFDateTime &dateTimeValue); 00111 00121 OFCondition getOFDateTime(OFDateTime &dateTimeValue, 00122 const unsigned long pos = 0); 00123 00142 OFCondition getISOFormattedDateTime(OFString &formattedDateTime, 00143 const unsigned long pos = 0, 00144 const OFBool seconds = OFTrue, 00145 const OFBool fraction = OFFalse, 00146 const OFBool timeZone = OFTrue, 00147 const OFBool createMissingPart = OFFalse); 00148 00167 OFCondition getISOFormattedDateTime(OFString &formattedDateTime, 00168 const unsigned long pos /*= 0*/, 00169 const OFBool seconds /*= OFTrue*/, 00170 const OFBool fraction /*= OFFalse*/, 00171 const OFBool timeZone /*= OFTrue*/, 00172 const OFBool createMissingPart /*= OFFalse*/, 00173 const OFString &dateTimeSeparator /*= " "*/); 00174 00175 /* --- static helper functions --- */ 00176 00191 static OFCondition getCurrentDateTime(OFString &dicomDateTime, 00192 const OFBool seconds = OFTrue, 00193 const OFBool fraction = OFFalse, 00194 const OFBool timeZone = OFFalse); 00195 00211 static OFCondition getDicomDateTimeFromOFDateTime(const OFDateTime &dateTimeValue, 00212 OFString &dicomDateTime, 00213 const OFBool seconds = OFTrue, 00214 const OFBool fraction = OFFalse, 00215 const OFBool timeZone = OFFalse); 00216 00226 static OFCondition getOFDateTimeFromString(const OFString &dicomDateTime, 00227 OFDateTime &dateTimeValue); 00228 00247 static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime, 00248 OFString &formattedDateTime, 00249 const OFBool seconds = OFTrue, 00250 const OFBool fraction = OFFalse, 00251 const OFBool timeZone = OFTrue, 00252 const OFBool createMissingPart = OFFalse); 00253 00272 static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime, 00273 OFString &formattedDateTime, 00274 const OFBool seconds /*= OFTrue*/, 00275 const OFBool fraction /*= OFFalse*/, 00276 const OFBool timeZone /*= OFTrue*/, 00277 const OFBool createMissingPart /*= OFFalse*/, 00278 const OFString &dateTimeSeparator /*= " "*/); 00279 }; 00280 00281 00282 #endif // DCVRDT_H 00283 00284 00285 /* 00286 ** CVS/RCS Log: 00287 ** $Log: dcvrdt.h,v $ 00288 ** Revision 1.17 2004/04/16 12:49:25 joergr 00289 ** Restructured code to avoid default parameter values for "complex types" like 00290 ** OFString. Required for Sun CC 2.0.1. 00291 ** 00292 ** Revision 1.16 2004/01/16 14:04:11 joergr 00293 ** Introduced new parameter "dateTimeSeparator" in getISOFormattedXXX() methods 00294 ** to support ISO 8601 format as required by XML Schema type "dateTime". 00295 ** 00296 ** Revision 1.15 2002/12/06 12:49:15 joergr 00297 ** Enhanced "print()" function by re-working the implementation and replacing 00298 ** the boolean "showFullData" parameter by a more general integer flag. 00299 ** Added doc++ documentation. 00300 ** Made source code formatting more consistent with other modules/files. 00301 ** 00302 ** Revision 1.14 2002/04/25 09:51:08 joergr 00303 ** Removed getOFStringArray() implementation. 00304 ** 00305 ** Revision 1.13 2002/04/11 12:25:09 joergr 00306 ** Enhanced DICOM date, time and date/time classes. Added support for new 00307 ** standard date and time functions. 00308 ** 00309 ** Revision 1.12 2001/10/10 15:17:37 joergr 00310 ** Updated comments. 00311 ** 00312 ** Revision 1.11 2001/10/01 15:01:39 joergr 00313 ** Introduced new general purpose functions to get/set person names, date, time 00314 ** and date/time. 00315 ** 00316 ** Revision 1.10 2001/09/25 17:19:31 meichel 00317 ** Adapted dcmdata to class OFCondition 00318 ** 00319 ** Revision 1.9 2001/06/01 15:48:49 meichel 00320 ** Updated copyright header 00321 ** 00322 ** Revision 1.8 2000/03/08 16:26:23 meichel 00323 ** Updated copyright header. 00324 ** 00325 ** Revision 1.7 1999/03/31 09:24:59 meichel 00326 ** Updated copyright header in module dcmdata 00327 ** 00328 ** Revision 1.6 1998/11/12 16:47:48 meichel 00329 ** Implemented operator= for all classes derived from DcmObject. 00330 ** 00331 ** Revision 1.5 1997/09/11 15:13:14 hewett 00332 ** Modified getOFString method arguments by removing a default value 00333 ** for the pos argument. By requiring the pos argument to be provided 00334 ** ensures that callers realise getOFString only gets one component of 00335 ** a multi-valued string. 00336 ** 00337 ** Revision 1.4 1997/08/29 08:32:41 andreas 00338 ** - Added methods getOFString and getOFStringArray for all 00339 ** string VRs. These methods are able to normalise the value, i. e. 00340 ** to remove leading and trailing spaces. This will be done only if 00341 ** it is described in the standard that these spaces are not relevant. 00342 ** These methods do not test the strings for conformance, this means 00343 ** especially that they do not delete spaces where they are not allowed! 00344 ** getOFStringArray returns the string with all its parts separated by \ 00345 ** and getOFString returns only one value of the string. 00346 ** CAUTION: Currently getString returns a string with trailing 00347 ** spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and 00348 ** truncates the original string (since it is not copied!). If you rely on this 00349 ** behaviour please change your application now. 00350 ** Future changes will ensure that getString returns the original 00351 ** string from the DICOM object (NULL terminated) inclusive padding. 00352 ** Currently, if you call getOF... before calling getString without 00353 ** normalisation, you can get the original string read from the DICOM object. 00354 ** 00355 ** Revision 1.3 1996/01/05 13:23:05 andreas 00356 ** - changed to support new streaming facilities 00357 ** - more cleanups 00358 ** - merged read / write methods for block and file transfer 00359 ** 00360 */