dcvrdt.h

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 DcmDateTime
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2005/12/08 16:28:57 $
00026  *  CVS/RCS Revision: $Revision: 1.19 $
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 "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00037 
00038 #include "dcmtk/dcmdata/dctypes.h"
00039 #include "dcmtk/dcmdata/dcbytstr.h"
00040 #include "dcmtk/ofstd/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 DcmObject *clone() const
00078     {
00079       return new DcmDateTime(*this);
00080     }
00081 
00085     virtual DcmEVR ident() const;
00086 
00093     virtual OFCondition getOFString(OFString &stringValue,
00094                                     const unsigned long pos,
00095                                     OFBool normalize = OFTrue);
00096 
00110     OFCondition setCurrentDateTime(const OFBool seconds = OFTrue,
00111                                    const OFBool fraction = OFFalse,
00112                                    const OFBool timeZone = OFFalse);
00113 
00118     OFCondition setOFDateTime(const OFDateTime &dateTimeValue);
00119 
00129     OFCondition getOFDateTime(OFDateTime &dateTimeValue,
00130                               const unsigned long pos = 0);
00131 
00150     OFCondition getISOFormattedDateTime(OFString &formattedDateTime,
00151                                         const unsigned long pos = 0,
00152                                         const OFBool seconds = OFTrue,
00153                                         const OFBool fraction = OFFalse,
00154                                         const OFBool timeZone = OFTrue,
00155                                         const OFBool createMissingPart = OFFalse);
00156 
00175     OFCondition getISOFormattedDateTime(OFString &formattedDateTime,
00176                                         const unsigned long pos /*= 0*/,
00177                                         const OFBool seconds /*= OFTrue*/,
00178                                         const OFBool fraction /*= OFFalse*/,
00179                                         const OFBool timeZone /*= OFTrue*/,
00180                                         const OFBool createMissingPart /*= OFFalse*/,
00181                                         const OFString &dateTimeSeparator /*= " "*/);
00182 
00183     /* --- static helper functions --- */
00184 
00199     static OFCondition getCurrentDateTime(OFString &dicomDateTime,
00200                                           const OFBool seconds = OFTrue,
00201                                           const OFBool fraction = OFFalse,
00202                                           const OFBool timeZone = OFFalse);
00203 
00219     static OFCondition getDicomDateTimeFromOFDateTime(const OFDateTime &dateTimeValue,
00220                                                       OFString &dicomDateTime,
00221                                                       const OFBool seconds = OFTrue,
00222                                                       const OFBool fraction = OFFalse,
00223                                                       const OFBool timeZone = OFFalse);
00224 
00234     static OFCondition getOFDateTimeFromString(const OFString &dicomDateTime,
00235                                                OFDateTime &dateTimeValue);
00236 
00255     static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime,
00256                                                          OFString &formattedDateTime,
00257                                                          const OFBool seconds = OFTrue,
00258                                                          const OFBool fraction = OFFalse,
00259                                                          const OFBool timeZone = OFTrue,
00260                                                          const OFBool createMissingPart = OFFalse);
00261 
00280     static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime,
00281                                                          OFString &formattedDateTime,
00282                                                          const OFBool seconds /*= OFTrue*/,
00283                                                          const OFBool fraction /*= OFFalse*/,
00284                                                          const OFBool timeZone /*= OFTrue*/,
00285                                                          const OFBool createMissingPart /*= OFFalse*/,
00286                                                          const OFString &dateTimeSeparator /*= " "*/);
00287 };
00288 
00289 
00290 #endif // DCVRDT_H
00291 
00292 
00293 /*
00294 ** CVS/RCS Log:
00295 ** $Log: dcvrdt.h,v $
00296 ** Revision 1.19  2005/12/08 16:28:57  meichel
00297 ** Changed include path schema for all DCMTK header files
00298 **
00299 ** Revision 1.18  2004/07/01 12:28:25  meichel
00300 ** Introduced virtual clone method for DcmObject and derived classes.
00301 **
00302 ** Revision 1.17  2004/04/16 12:49:25  joergr
00303 ** Restructured code to avoid default parameter values for "complex types" like
00304 ** OFString. Required for Sun CC 2.0.1.
00305 **
00306 ** Revision 1.16  2004/01/16 14:04:11  joergr
00307 ** Introduced new parameter "dateTimeSeparator" in getISOFormattedXXX() methods
00308 ** to support ISO 8601 format as required by XML Schema type "dateTime".
00309 **
00310 ** Revision 1.15  2002/12/06 12:49:15  joergr
00311 ** Enhanced "print()" function by re-working the implementation and replacing
00312 ** the boolean "showFullData" parameter by a more general integer flag.
00313 ** Added doc++ documentation.
00314 ** Made source code formatting more consistent with other modules/files.
00315 **
00316 ** Revision 1.14  2002/04/25 09:51:08  joergr
00317 ** Removed getOFStringArray() implementation.
00318 **
00319 ** Revision 1.13  2002/04/11 12:25:09  joergr
00320 ** Enhanced DICOM date, time and date/time classes. Added support for new
00321 ** standard date and time functions.
00322 **
00323 ** Revision 1.12  2001/10/10 15:17:37  joergr
00324 ** Updated comments.
00325 **
00326 ** Revision 1.11  2001/10/01 15:01:39  joergr
00327 ** Introduced new general purpose functions to get/set person names, date, time
00328 ** and date/time.
00329 **
00330 ** Revision 1.10  2001/09/25 17:19:31  meichel
00331 ** Adapted dcmdata to class OFCondition
00332 **
00333 ** Revision 1.9  2001/06/01 15:48:49  meichel
00334 ** Updated copyright header
00335 **
00336 ** Revision 1.8  2000/03/08 16:26:23  meichel
00337 ** Updated copyright header.
00338 **
00339 ** Revision 1.7  1999/03/31 09:24:59  meichel
00340 ** Updated copyright header in module dcmdata
00341 **
00342 ** Revision 1.6  1998/11/12 16:47:48  meichel
00343 ** Implemented operator= for all classes derived from DcmObject.
00344 **
00345 ** Revision 1.5  1997/09/11 15:13:14  hewett
00346 ** Modified getOFString method arguments by removing a default value
00347 ** for the pos argument.  By requiring the pos argument to be provided
00348 ** ensures that callers realise getOFString only gets one component of
00349 ** a multi-valued string.
00350 **
00351 ** Revision 1.4  1997/08/29 08:32:41  andreas
00352 ** - Added methods getOFString and getOFStringArray for all
00353 **   string VRs. These methods are able to normalise the value, i. e.
00354 **   to remove leading and trailing spaces. This will be done only if
00355 **   it is described in the standard that these spaces are not relevant.
00356 **   These methods do not test the strings for conformance, this means
00357 **   especially that they do not delete spaces where they are not allowed!
00358 **   getOFStringArray returns the string with all its parts separated by \
00359 **   and getOFString returns only one value of the string.
00360 **   CAUTION: Currently getString returns a string with trailing
00361 **   spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and
00362 **   truncates the original string (since it is not copied!). If you rely on this
00363 **   behaviour please change your application now.
00364 **   Future changes will ensure that getString returns the original
00365 **   string from the DICOM object (NULL terminated) inclusive padding.
00366 **   Currently, if you call getOF... before calling getString without
00367 **   normalisation, you can get the original string read from the DICOM object.
00368 **
00369 ** Revision 1.3  1996/01/05 13:23:05  andreas
00370 ** - changed to support new streaming facilities
00371 ** - more cleanups
00372 ** - merged read / write methods for block and file transfer
00373 **
00374 */


Generated on 20 Dec 2005 for OFFIS DCMTK Version 3.5.4 by Doxygen 1.4.5