dcmdata/include/dcmtk/dcmdata/dcvrtm.h

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, Joerg Riesmeier
00017  *
00018  *  Purpose: Interface of class DcmTime
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 #ifndef DCVRTM_H
00030 #define DCVRTM_H
00031 
00032 #include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */
00033 
00034 #include "dcmtk/dcmdata/dctypes.h"
00035 #include "dcmtk/dcmdata/dcbytstr.h"
00036 #include "dcmtk/ofstd/oftime.h"
00037 
00038 
00041 class DcmTime
00042   : public DcmByteString
00043 {
00044 
00045   public:
00046 
00052     DcmTime(const DcmTag &tag,
00053             const Uint32 len = 0);
00054 
00058     DcmTime(const DcmTime &old);
00059 
00062     virtual ~DcmTime();
00063 
00068     DcmTime &operator=(const DcmTime &obj);
00069 
00073     virtual DcmObject *clone() const
00074     {
00075       return new DcmTime(*this);
00076     }
00077 
00090     virtual OFCondition copyFrom(const DcmObject& rhs);
00091 
00095     virtual DcmEVR ident() const;
00096 
00104     virtual OFCondition checkValue(const OFString &vm = "1-n",
00105                                    const OFBool oldFormat = OFFalse);
00106 
00113     virtual OFCondition getOFString(OFString &stringValue,
00114                                     const unsigned long pos,
00115                                     OFBool normalize = OFTrue);
00116 
00127     OFCondition setCurrentTime(const OFBool seconds = OFTrue,
00128                                const OFBool fraction = OFFalse);
00129 
00134     OFCondition setOFTime(const OFTime &timeValue);
00135 
00147     OFCondition getOFTime(OFTime &timeValue,
00148                           const unsigned long pos = 0,
00149                           const OFBool supportOldFormat = OFTrue);
00150 
00171     OFCondition getISOFormattedTime(OFString &formattedTime,
00172                                     const unsigned long pos = 0,
00173                                     const OFBool seconds = OFTrue,
00174                                     const OFBool fraction = OFFalse,
00175                                     const OFBool createMissingPart = OFFalse,
00176                                     const OFBool supportOldFormat = OFTrue);
00177 
00178     /* --- static helper functions --- */
00179 
00191     static OFCondition getCurrentTime(OFString &dicomTime,
00192                                       const OFBool seconds = OFTrue,
00193                                       const OFBool fraction = OFFalse);
00194 
00207     static OFCondition getDicomTimeFromOFTime(const OFTime &timeValue,
00208                                               OFString &dicomTime,
00209                                               const OFBool seconds = OFTrue,
00210                                               const OFBool fraction = OFFalse);
00211 
00223     static OFCondition getOFTimeFromString(const OFString &dicomTime,
00224                                            OFTime &timeValue,
00225                                            const OFBool supportOldFormat = OFTrue);
00226 
00243     static OFCondition getISOFormattedTimeFromString(const OFString &dicomTime,
00244                                                      OFString &formattedTime,
00245                                                      const OFBool seconds = OFTrue,
00246                                                      const OFBool fraction = OFFalse,
00247                                                      const OFBool createMissingPart = OFFalse,
00248                                                      const OFBool supportOldFormat = OFTrue);
00249 
00262     static OFCondition getTimeZoneFromString(const OFString &dicomTimeZone,
00263                                              double &timeZone);
00264 
00274     static OFCondition checkStringValue(const OFString &value,
00275                                         const OFString &vm = "1-n",
00276                                         const OFBool oldFormat = OFFalse);
00277 };
00278 
00279 
00280 #endif // DCVRTM_H
00281 
00282 
00283 /*
00284 ** CVS/RCS Log:
00285 ** $Log: dcvrtm.h,v $
00286 ** Revision 1.26  2010-11-05 09:34:11  joergr
00287 ** Added support for checking the value multiplicity "9" (see Supplement 131).
00288 **
00289 ** Revision 1.25  2010-10-14 13:15:43  joergr
00290 ** Updated copyright header. Added reference to COPYRIGHT file.
00291 **
00292 ** Revision 1.24  2010-04-23 15:26:13  joergr
00293 ** Specify an appropriate default value for the "vm" parameter of checkValue().
00294 **
00295 ** Revision 1.23  2010-04-23 14:25:27  joergr
00296 ** Added new method to all VR classes which checks whether the stored value
00297 ** conforms to the VR definition and to the specified VM.
00298 **
00299 ** Revision 1.22  2010-04-22 09:31:30  joergr
00300 ** Revised misleading parameter documentation for the checkValue() method.
00301 **
00302 ** Revision 1.21  2010-04-22 08:59:10  joergr
00303 ** Added support for further VM values ("1-8", "1-99", "16", "32") to be checked.
00304 **
00305 ** Revision 1.20  2009-08-03 09:05:30  joergr
00306 ** Added methods that check whether a given string value conforms to the VR and
00307 ** VM definitions of the DICOM standards.
00308 **
00309 ** Revision 1.19  2008-07-17 11:19:49  onken
00310 ** Updated copyFrom() documentation.
00311 **
00312 ** Revision 1.18  2008-07-17 10:30:23  onken
00313 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which
00314 ** permits setting an instance's value from an existing object. Implemented
00315 ** assignment operator where necessary.
00316 **
00317 ** Revision 1.17  2005-12-08 16:29:11  meichel
00318 ** Changed include path schema for all DCMTK header files
00319 **
00320 ** Revision 1.16  2004/07/01 12:28:25  meichel
00321 ** Introduced virtual clone method for DcmObject and derived classes.
00322 **
00323 ** Revision 1.15  2002/12/06 12:49:19  joergr
00324 ** Enhanced "print()" function by re-working the implementation and replacing
00325 ** the boolean "showFullData" parameter by a more general integer flag.
00326 ** Added doc++ documentation.
00327 ** Made source code formatting more consistent with other modules/files.
00328 **
00329 ** Revision 1.14  2002/04/25 09:58:07  joergr
00330 ** Removed getOFStringArray() implementation.
00331 **
00332 ** Revision 1.13  2002/04/11 12:25:10  joergr
00333 ** Enhanced DICOM date, time and date/time classes. Added support for new
00334 ** standard date and time functions.
00335 **
00336 ** Revision 1.12  2001/10/10 15:18:17  joergr
00337 ** Added new flag to date/time routines allowing to choose whether the old
00338 ** prior V3.0 format for the corresponding DICOM VRs is supported or not.
00339 **
00340 ** Revision 1.11  2001/10/01 15:01:40  joergr
00341 ** Introduced new general purpose functions to get/set person names, date, time
00342 ** and date/time.
00343 **
00344 ** Revision 1.10  2001/09/25 17:19:34  meichel
00345 ** Adapted dcmdata to class OFCondition
00346 **
00347 ** Revision 1.9  2001/06/01 15:48:53  meichel
00348 ** Updated copyright header
00349 **
00350 ** Revision 1.8  2000/03/08 16:26:26  meichel
00351 ** Updated copyright header.
00352 **
00353 ** Revision 1.7  1999/03/31 09:25:08  meichel
00354 ** Updated copyright header in module dcmdata
00355 **
00356 ** Revision 1.6  1998/11/12 16:47:56  meichel
00357 ** Implemented operator= for all classes derived from DcmObject.
00358 **
00359 ** Revision 1.5  1997/09/11 15:13:17  hewett
00360 ** Modified getOFString method arguments by removing a default value
00361 ** for the pos argument.  By requiring the pos argument to be provided
00362 ** ensures that callers realise getOFString only gets one component of
00363 ** a multi-valued string.
00364 **
00365 ** Revision 1.4  1997/08/29 08:32:45  andreas
00366 ** - Added methods getOFString and getOFStringArray for all
00367 **   string VRs. These methods are able to normalise the value, i. e.
00368 **   to remove leading and trailing spaces. This will be done only if
00369 **   it is described in the standard that these spaces are not relevant.
00370 **   These methods do not test the strings for conformance, this means
00371 **   especially that they do not delete spaces where they are not allowed!
00372 **   getOFStringArray returns the string with all its parts separated by \
00373 **   and getOFString returns only one value of the string.
00374 **   CAUTION: Currently getString returns a string with trailing
00375 **   spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and
00376 **   truncates the original string (since it is not copied!). If you rely on this
00377 **   behaviour please change your application now.
00378 **   Future changes will ensure that getString returns the original
00379 **   string from the DICOM object (NULL terminated) inclusive padding.
00380 **   Currently, if you call getOF... before calling getString without
00381 **   normalisation, you can get the original string read from the DICOM object.
00382 **
00383 ** Revision 1.3  1996/01/05 13:23:10  andreas
00384 ** - changed to support new streaming facilities
00385 ** - more cleanups
00386 ** - merged read / write methods for block and file transfer
00387 **
00388 */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1