OFFIS DCMTK  Version 3.6.0
dcvrdt.h
1 /*
2  *
3  * Copyright (C) 1994-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmdata
15  *
16  * Author: Gerd Ehlers, Joerg Riesmeier
17  *
18  * Purpose: Interface of class DcmDateTime
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-11-05 09:34:11 $
22  * CVS/RCS Revision: $Revision: 1.29 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef DCVRDT_H
30 #define DCVRDT_H
31 
32 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
33 
34 #include "dcmtk/dcmdata/dcbytstr.h"
35 #include "dcmtk/ofstd/ofdatime.h"
36 
37 
41  : public DcmByteString
42 {
43 
44  public:
45 
51  DcmDateTime(const DcmTag &tag,
52  const Uint32 len = 0);
53 
57  DcmDateTime(const DcmDateTime &old);
58 
61  virtual ~DcmDateTime();
62 
67  DcmDateTime &operator=(const DcmDateTime &obj);
68 
72  virtual DcmObject *clone() const
73  {
74  return new DcmDateTime(*this);
75  }
76 
89  virtual OFCondition copyFrom(const DcmObject& rhs);
90 
94  virtual DcmEVR ident() const;
95 
103  virtual OFCondition checkValue(const OFString &vm = "1-n",
104  const OFBool oldFormat = OFFalse);
105 
112  virtual OFCondition getOFString(OFString &stringValue,
113  const unsigned long pos,
114  OFBool normalize = OFTrue);
115 
129  OFCondition setCurrentDateTime(const OFBool seconds = OFTrue,
130  const OFBool fraction = OFFalse,
131  const OFBool timeZone = OFFalse);
132 
137  OFCondition setOFDateTime(const OFDateTime &dateTimeValue);
138 
148  OFCondition getOFDateTime(OFDateTime &dateTimeValue,
149  const unsigned long pos = 0);
150 
169  OFCondition getISOFormattedDateTime(OFString &formattedDateTime,
170  const unsigned long pos = 0,
171  const OFBool seconds = OFTrue,
172  const OFBool fraction = OFFalse,
173  const OFBool timeZone = OFTrue,
174  const OFBool createMissingPart = OFFalse);
175 
194  OFCondition getISOFormattedDateTime(OFString &formattedDateTime,
195  const unsigned long pos /*= 0*/,
196  const OFBool seconds /*= OFTrue*/,
197  const OFBool fraction /*= OFFalse*/,
198  const OFBool timeZone /*= OFTrue*/,
199  const OFBool createMissingPart /*= OFFalse*/,
200  const OFString &dateTimeSeparator /*= " "*/);
201 
202  /* --- static helper functions --- */
203 
218  static OFCondition getCurrentDateTime(OFString &dicomDateTime,
219  const OFBool seconds = OFTrue,
220  const OFBool fraction = OFFalse,
221  const OFBool timeZone = OFFalse);
222 
238  static OFCondition getDicomDateTimeFromOFDateTime(const OFDateTime &dateTimeValue,
239  OFString &dicomDateTime,
240  const OFBool seconds = OFTrue,
241  const OFBool fraction = OFFalse,
242  const OFBool timeZone = OFFalse);
243 
253  static OFCondition getOFDateTimeFromString(const OFString &dicomDateTime,
254  OFDateTime &dateTimeValue);
255 
274  static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime,
275  OFString &formattedDateTime,
276  const OFBool seconds = OFTrue,
277  const OFBool fraction = OFFalse,
278  const OFBool timeZone = OFTrue,
279  const OFBool createMissingPart = OFFalse);
280 
299  static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime,
300  OFString &formattedDateTime,
301  const OFBool seconds /*= OFTrue*/,
302  const OFBool fraction /*= OFFalse*/,
303  const OFBool timeZone /*= OFTrue*/,
304  const OFBool createMissingPart /*= OFFalse*/,
305  const OFString &dateTimeSeparator /*= " "*/);
306 
315  static OFCondition checkStringValue(const OFString &value,
316  const OFString &vm = "1-n");
317 };
318 
319 
320 #endif // DCVRDT_H
321 
322 
323 /*
324 ** CVS/RCS Log:
325 ** $Log: dcvrdt.h,v $
326 ** Revision 1.29 2010-11-05 09:34:11 joergr
327 ** Added support for checking the value multiplicity "9" (see Supplement 131).
328 **
329 ** Revision 1.28 2010-10-14 13:15:42 joergr
330 ** Updated copyright header. Added reference to COPYRIGHT file.
331 **
332 ** Revision 1.27 2010-04-23 15:26:13 joergr
333 ** Specify an appropriate default value for the "vm" parameter of checkValue().
334 **
335 ** Revision 1.26 2010-04-23 14:25:27 joergr
336 ** Added new method to all VR classes which checks whether the stored value
337 ** conforms to the VR definition and to the specified VM.
338 **
339 ** Revision 1.25 2010-04-22 09:31:30 joergr
340 ** Revised misleading parameter documentation for the checkValue() method.
341 **
342 ** Revision 1.24 2010-04-22 08:59:10 joergr
343 ** Added support for further VM values ("1-8", "1-99", "16", "32") to be checked.
344 **
345 ** Revision 1.23 2010-03-01 09:08:45 uli
346 ** Removed some unnecessary include directives in the headers.
347 **
348 ** Revision 1.22 2009-08-03 09:05:30 joergr
349 ** Added methods that check whether a given string value conforms to the VR and
350 ** VM definitions of the DICOM standards.
351 **
352 ** Revision 1.21 2008-07-17 11:19:49 onken
353 ** Updated copyFrom() documentation.
354 **
355 ** Revision 1.20 2008-07-17 10:30:23 onken
356 ** Implemented copyFrom() method for complete DcmObject class hierarchy, which
357 ** permits setting an instance's value from an existing object. Implemented
358 ** assignment operator where necessary.
359 **
360 ** Revision 1.19 2005-12-08 16:28:57 meichel
361 ** Changed include path schema for all DCMTK header files
362 **
363 ** Revision 1.18 2004/07/01 12:28:25 meichel
364 ** Introduced virtual clone method for DcmObject and derived classes.
365 **
366 ** Revision 1.17 2004/04/16 12:49:25 joergr
367 ** Restructured code to avoid default parameter values for "complex types" like
368 ** OFString. Required for Sun CC 2.0.1.
369 **
370 ** Revision 1.16 2004/01/16 14:04:11 joergr
371 ** Introduced new parameter "dateTimeSeparator" in getISOFormattedXXX() methods
372 ** to support ISO 8601 format as required by XML Schema type "dateTime".
373 **
374 ** Revision 1.15 2002/12/06 12:49:15 joergr
375 ** Enhanced "print()" function by re-working the implementation and replacing
376 ** the boolean "showFullData" parameter by a more general integer flag.
377 ** Added doc++ documentation.
378 ** Made source code formatting more consistent with other modules/files.
379 **
380 ** Revision 1.14 2002/04/25 09:51:08 joergr
381 ** Removed getOFStringArray() implementation.
382 **
383 ** Revision 1.13 2002/04/11 12:25:09 joergr
384 ** Enhanced DICOM date, time and date/time classes. Added support for new
385 ** standard date and time functions.
386 **
387 ** Revision 1.12 2001/10/10 15:17:37 joergr
388 ** Updated comments.
389 **
390 ** Revision 1.11 2001/10/01 15:01:39 joergr
391 ** Introduced new general purpose functions to get/set person names, date, time
392 ** and date/time.
393 **
394 ** Revision 1.10 2001/09/25 17:19:31 meichel
395 ** Adapted dcmdata to class OFCondition
396 **
397 ** Revision 1.9 2001/06/01 15:48:49 meichel
398 ** Updated copyright header
399 **
400 ** Revision 1.8 2000/03/08 16:26:23 meichel
401 ** Updated copyright header.
402 **
403 ** Revision 1.7 1999/03/31 09:24:59 meichel
404 ** Updated copyright header in module dcmdata
405 **
406 ** Revision 1.6 1998/11/12 16:47:48 meichel
407 ** Implemented operator= for all classes derived from DcmObject.
408 **
409 ** Revision 1.5 1997/09/11 15:13:14 hewett
410 ** Modified getOFString method arguments by removing a default value
411 ** for the pos argument. By requiring the pos argument to be provided
412 ** ensures that callers realise getOFString only gets one component of
413 ** a multi-valued string.
414 **
415 ** Revision 1.4 1997/08/29 08:32:41 andreas
416 ** - Added methods getOFString and getOFStringArray for all
417 ** string VRs. These methods are able to normalise the value, i. e.
418 ** to remove leading and trailing spaces. This will be done only if
419 ** it is described in the standard that these spaces are not relevant.
420 ** These methods do not test the strings for conformance, this means
421 ** especially that they do not delete spaces where they are not allowed!
422 ** getOFStringArray returns the string with all its parts separated by \
423 ** and getOFString returns only one value of the string.
424 ** CAUTION: Currently getString returns a string with trailing
425 ** spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and
426 ** truncates the original string (since it is not copied!). If you rely on this
427 ** behaviour please change your application now.
428 ** Future changes will ensure that getString returns the original
429 ** string from the DICOM object (NULL terminated) inclusive padding.
430 ** Currently, if you call getOF... before calling getString without
431 ** normalisation, you can get the original string read from the DICOM object.
432 **
433 ** Revision 1.3 1996/01/05 13:23:05 andreas
434 ** - changed to support new streaming facilities
435 ** - more cleanups
436 ** - merged read / write methods for block and file transfer
437 **
438 */
OFCondition setOFDateTime(const OFDateTime &dateTimeValue)
set the element value to the given date and time
OFCondition getISOFormattedDateTime(OFString &formattedDateTime, const unsigned long pos=0, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool timeZone=OFTrue, const OFBool createMissingPart=OFFalse)
get the current element value in ISO date/time format.
virtual DcmEVR ident() const
get element type identifier
static OFCondition getCurrentDateTime(OFString &dicomDateTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool timeZone=OFFalse)
get the current system date and time.
virtual OFCondition checkValue(const OFString &vm="1-n", const OFBool oldFormat=OFFalse)
check whether stored value conforms to the VR and to the specified VM
virtual OFCondition getOFString(OFString &stringValue, const unsigned long pos, OFBool normalize=OFTrue)
get a copy of a particular string component
OFCondition setCurrentDateTime(const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool timeZone=OFFalse)
set the element value to the current system date and time.
DcmDateTime & operator=(const DcmDateTime &obj)
assignment operator
DcmDateTime(const DcmTag &tag, const Uint32 len=0)
constructor.
this class encapsulates an attribute tag (group, element) and a VR.
Definition: dctag.h:50
Abstract base class for most classes in module dcmdata.
Definition: dcobject.h:179
static OFCondition getOFDateTimeFromString(const OFString &dicomDateTime, OFDateTime &dateTimeValue)
get the specified DICOM date and time value in OFDateTime format.
base class for all DICOM value representations storing a character string
Definition: dcbytstr.h:42
virtual ~DcmDateTime()
destructor
This class is a combination of OFDate and OFTime.
Definition: ofdatime.h:46
static OFCondition getISOFormattedDateTimeFromString(const OFString &dicomDateTime, OFString &formattedDateTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool timeZone=OFTrue, const OFBool createMissingPart=OFFalse)
get the specified DICOM datetime value in ISO format.
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
a class representing the DICOM value representation 'Date Time' (DT)
Definition: dcvrdt.h:40
OFCondition getOFDateTime(OFDateTime &dateTimeValue, const unsigned long pos=0)
get the current element value in OFDateTime format.
virtual OFCondition copyFrom(const DcmObject &rhs)
Virtual object copying.
static OFCondition getDicomDateTimeFromOFDateTime(const OFDateTime &dateTimeValue, OFString &dicomDateTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool timeZone=OFFalse)
get the specified OFDateTime value in DICOM format.
virtual DcmObject * clone() const
clone method
Definition: dcvrdt.h:72
static OFCondition checkStringValue(const OFString &value, const OFString &vm="1-n")
check whether given string value conforms to the VR "DT" (Date Time) and to the specified VM...
General purpose class for condition codes.
Definition: ofcond.h:305


Generated on Thu Aug 27 2015 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.9.1