00001 /* 00002 * 00003 * Copyright (C) 1994-2005, 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 DcmTime 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:29:11 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcvrtm.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.17 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef DCVRTM_H 00035 #define DCVRTM_H 00036 00037 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00038 00039 #include "dcmtk/dcmdata/dctypes.h" 00040 #include "dcmtk/dcmdata/dcbytstr.h" 00041 #include "dcmtk/ofstd/oftime.h" 00042 00043 00046 class DcmTime 00047 : public DcmByteString 00048 { 00049 00050 public: 00051 00057 DcmTime(const DcmTag &tag, 00058 const Uint32 len = 0); 00059 00063 DcmTime(const DcmTime &old); 00064 00067 virtual ~DcmTime(); 00068 00073 DcmTime &operator=(const DcmTime &obj); 00074 00078 virtual DcmObject *clone() const 00079 { 00080 return new DcmTime(*this); 00081 } 00082 00086 virtual DcmEVR ident() const; 00087 00094 virtual OFCondition getOFString(OFString &stringValue, 00095 const unsigned long pos, 00096 OFBool normalize = OFTrue); 00097 00108 OFCondition setCurrentTime(const OFBool seconds = OFTrue, 00109 const OFBool fraction = OFFalse); 00110 00115 OFCondition setOFTime(const OFTime &timeValue); 00116 00128 OFCondition getOFTime(OFTime &timeValue, 00129 const unsigned long pos = 0, 00130 const OFBool supportOldFormat = OFTrue); 00131 00152 OFCondition getISOFormattedTime(OFString &formattedTime, 00153 const unsigned long pos = 0, 00154 const OFBool seconds = OFTrue, 00155 const OFBool fraction = OFFalse, 00156 const OFBool createMissingPart = OFFalse, 00157 const OFBool supportOldFormat = OFTrue); 00158 00159 /* --- static helper functions --- */ 00160 00172 static OFCondition getCurrentTime(OFString &dicomTime, 00173 const OFBool seconds = OFTrue, 00174 const OFBool fraction = OFFalse); 00175 00188 static OFCondition getDicomTimeFromOFTime(const OFTime &timeValue, 00189 OFString &dicomTime, 00190 const OFBool seconds = OFTrue, 00191 const OFBool fraction = OFFalse); 00192 00204 static OFCondition getOFTimeFromString(const OFString &dicomTime, 00205 OFTime &timeValue, 00206 const OFBool supportOldFormat = OFTrue); 00207 00224 static OFCondition getISOFormattedTimeFromString(const OFString &dicomTime, 00225 OFString &formattedTime, 00226 const OFBool seconds = OFTrue, 00227 const OFBool fraction = OFFalse, 00228 const OFBool createMissingPart = OFFalse, 00229 const OFBool supportOldFormat = OFTrue); 00230 00243 static OFCondition getTimeZoneFromString(const OFString &dicomTimeZone, 00244 double &timeZone); 00245 }; 00246 00247 00248 #endif // DCVRTM_H 00249 00250 00251 /* 00252 ** CVS/RCS Log: 00253 ** $Log: dcvrtm.h,v $ 00254 ** Revision 1.17 2005/12/08 16:29:11 meichel 00255 ** Changed include path schema for all DCMTK header files 00256 ** 00257 ** Revision 1.16 2004/07/01 12:28:25 meichel 00258 ** Introduced virtual clone method for DcmObject and derived classes. 00259 ** 00260 ** Revision 1.15 2002/12/06 12:49:19 joergr 00261 ** Enhanced "print()" function by re-working the implementation and replacing 00262 ** the boolean "showFullData" parameter by a more general integer flag. 00263 ** Added doc++ documentation. 00264 ** Made source code formatting more consistent with other modules/files. 00265 ** 00266 ** Revision 1.14 2002/04/25 09:58:07 joergr 00267 ** Removed getOFStringArray() implementation. 00268 ** 00269 ** Revision 1.13 2002/04/11 12:25:10 joergr 00270 ** Enhanced DICOM date, time and date/time classes. Added support for new 00271 ** standard date and time functions. 00272 ** 00273 ** Revision 1.12 2001/10/10 15:18:17 joergr 00274 ** Added new flag to date/time routines allowing to choose whether the old 00275 ** prior V3.0 format for the corresponding DICOM VRs is supported or not. 00276 ** 00277 ** Revision 1.11 2001/10/01 15:01:40 joergr 00278 ** Introduced new general purpose functions to get/set person names, date, time 00279 ** and date/time. 00280 ** 00281 ** Revision 1.10 2001/09/25 17:19:34 meichel 00282 ** Adapted dcmdata to class OFCondition 00283 ** 00284 ** Revision 1.9 2001/06/01 15:48:53 meichel 00285 ** Updated copyright header 00286 ** 00287 ** Revision 1.8 2000/03/08 16:26:26 meichel 00288 ** Updated copyright header. 00289 ** 00290 ** Revision 1.7 1999/03/31 09:25:08 meichel 00291 ** Updated copyright header in module dcmdata 00292 ** 00293 ** Revision 1.6 1998/11/12 16:47:56 meichel 00294 ** Implemented operator= for all classes derived from DcmObject. 00295 ** 00296 ** Revision 1.5 1997/09/11 15:13:17 hewett 00297 ** Modified getOFString method arguments by removing a default value 00298 ** for the pos argument. By requiring the pos argument to be provided 00299 ** ensures that callers realise getOFString only gets one component of 00300 ** a multi-valued string. 00301 ** 00302 ** Revision 1.4 1997/08/29 08:32:45 andreas 00303 ** - Added methods getOFString and getOFStringArray for all 00304 ** string VRs. These methods are able to normalise the value, i. e. 00305 ** to remove leading and trailing spaces. This will be done only if 00306 ** it is described in the standard that these spaces are not relevant. 00307 ** These methods do not test the strings for conformance, this means 00308 ** especially that they do not delete spaces where they are not allowed! 00309 ** getOFStringArray returns the string with all its parts separated by \ 00310 ** and getOFString returns only one value of the string. 00311 ** CAUTION: Currently getString returns a string with trailing 00312 ** spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and 00313 ** truncates the original string (since it is not copied!). If you rely on this 00314 ** behaviour please change your application now. 00315 ** Future changes will ensure that getString returns the original 00316 ** string from the DICOM object (NULL terminated) inclusive padding. 00317 ** Currently, if you call getOF... before calling getString without 00318 ** normalisation, you can get the original string read from the DICOM object. 00319 ** 00320 ** Revision 1.3 1996/01/05 13:23:10 andreas 00321 ** - changed to support new streaming facilities 00322 ** - more cleanups 00323 ** - merged read / write methods for block and file transfer 00324 ** 00325 */