DcmTime Class Reference

a class representing the DICOM value representation 'Time' (TM) More...

Inheritance diagram for DcmTime:

DcmByteString DcmElement DcmObject List of all members.

Public Member Functions

 DcmTime (const DcmTag &tag, const Uint32 len=0)
 constructor.
 DcmTime (const DcmTime &old)
 copy constructor
virtual ~DcmTime ()
 destructor
DcmTimeoperator= (const DcmTime &obj)
 assignment operator
virtual DcmObjectclone () const
 clone method
virtual DcmEVR ident () const
 get element type identifier
virtual OFCondition getOFString (OFString &stringValue, const unsigned long pos, OFBool normalize=OFTrue)
 get a copy of a particular string component
OFCondition setCurrentTime (const OFBool seconds=OFTrue, const OFBool fraction=OFFalse)
 set the element value to the current system time.
OFCondition setOFTime (const OFTime &timeValue)
 set the element value to the given time
OFCondition getOFTime (OFTime &timeValue, const unsigned long pos=0, const OFBool supportOldFormat=OFTrue)
 get the current element value in OFTime format.
OFCondition getISOFormattedTime (OFString &formattedTime, const unsigned long pos=0, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool createMissingPart=OFFalse, const OFBool supportOldFormat=OFTrue)
 get the current element value in ISO time format.

Static Public Member Functions

static OFCondition getCurrentTime (OFString &dicomTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse)
 get the current system time.
static OFCondition getDicomTimeFromOFTime (const OFTime &timeValue, OFString &dicomTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse)
 get the specified OFTime value in DICOM format.
static OFCondition getOFTimeFromString (const OFString &dicomTime, OFTime &timeValue, const OFBool supportOldFormat=OFTrue)
 get the specified DICOM time value in OFTime format.
static OFCondition getISOFormattedTimeFromString (const OFString &dicomTime, OFString &formattedTime, const OFBool seconds=OFTrue, const OFBool fraction=OFFalse, const OFBool createMissingPart=OFFalse, const OFBool supportOldFormat=OFTrue)
 get the specified DICOM time value in ISO format.
static OFCondition getTimeZoneFromString (const OFString &dicomTimeZone, double &timeZone)
 get the specified DICOM time zone in number of hours format DICOM standard states that if the "Timezone Offset From UTC" attribute (0008,0201) is present it applies to all TM attributes in the object.

Detailed Description

a class representing the DICOM value representation 'Time' (TM)

Definition at line 46 of file dcvrtm.h.


Constructor & Destructor Documentation

DcmTime::DcmTime const DcmTag tag,
const Uint32  len = 0
 

constructor.

Create new element from given tag and length.

Parameters:
tag DICOM tag for the new element
len value length for the new element

Referenced by clone().

DcmTime::DcmTime const DcmTime old  ) 
 

copy constructor

Parameters:
old element to be copied


Member Function Documentation

virtual DcmObject* DcmTime::clone  )  const [inline, virtual]
 

clone method

Returns:
deep copy of this object

Reimplemented from DcmByteString.

Definition at line 78 of file dcvrtm.h.

References DcmTime().

static OFCondition DcmTime::getCurrentTime OFString dicomTime,
const OFBool  seconds = OFTrue,
const OFBool  fraction = OFFalse
[static]
 

get the current system time.

The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.

Parameters:
dicomTime reference to string variable where the result is stored
seconds add optional seconds ("SS") if OFTrue
fraction add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmTime::getDicomTimeFromOFTime const OFTime timeValue,
OFString dicomTime,
const OFBool  seconds = OFTrue,
const OFBool  fraction = OFFalse
[static]
 

get the specified OFTime value in DICOM format.

The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.

Parameters:
timeValue time to be converted to DICOM format
dicomTime reference to string variable where the result is stored
seconds add optional seconds ("SS") if OFTrue
fraction add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue)
Returns:
EC_Normal upon success, an error code otherwise

OFCondition DcmTime::getISOFormattedTime OFString formattedTime,
const unsigned long  pos = 0,
const OFBool  seconds = OFTrue,
const OFBool  fraction = OFFalse,
const OFBool  createMissingPart = OFFalse,
const OFBool  supportOldFormat = OFTrue
 

get the current element value in ISO time format.

The ISO time format supported by this function is "HH:MM[:SS[.FFFFFF]]" where the brackets enclose optional parts. Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). If this function fails the result variable 'formattedTime' is cleared automatically. Please note that if the "Timezone Offset From UTC" attribute (0008,0201) is present, it applies to all TM attributes in the object. However, the time zone is not taken into account for the creation of the ISO formatted time. See also "getTimeZoneFromString()" below.

Parameters:
formattedTime reference to string variable where the result is stored
pos index of the element component in case of value multiplicity (0..vm-1)
seconds add optional seconds (":SS") if OFTrue
fraction add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue)
createMissingPart if OFTrue create optional parts (seconds and/or fractional part of a seconds) if absent in the element value
supportOldFormat if OFTrue support old (prior V3.0) time format (see above)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmTime::getISOFormattedTimeFromString const OFString dicomTime,
OFString formattedTime,
const OFBool  seconds = OFTrue,
const OFBool  fraction = OFFalse,
const OFBool  createMissingPart = OFFalse,
const OFBool  supportOldFormat = OFTrue
[static]
 

get the specified DICOM time value in ISO format.

The ISO time format supported by this function is "HH:MM[:SS[.FFFFFF]]" where the brackets enclose optional parts. Please note that the specified value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). If this function fails the result variable 'formattedTime' is cleared automatically.

Parameters:
dicomTime string value in DICOM TM format to be converted to ISO format
formattedTime reference to string variable where the result is stored
seconds add optional seconds (":SS") if OFTrue
fraction add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue)
createMissingPart if OFTrue create optional parts (seconds and/or fractional part of a seconds) if absent in the DICOM TM value
supportOldFormat if OFTrue support old (prior V3.0) time format (see above)
Returns:
EC_Normal upon success, an error code otherwise

virtual OFCondition DcmTime::getOFString OFString stringValue,
const unsigned long  pos,
OFBool  normalize = OFTrue
[virtual]
 

get a copy of a particular string component

Parameters:
stringValue variable in which the result value is stored
pos index of the value in case of multi-valued elements (0..vm-1)
normalize delete trailing spaces if OFTrue
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmByteString.

OFCondition DcmTime::getOFTime OFTime timeValue,
const unsigned long  pos = 0,
const OFBool  supportOldFormat = OFTrue
 

get the current element value in OFTime format.

Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). Since there is no time zone for the DICOM TM format local time is assumed (the time zone of 'timeValue' is set automatically). If this function fails the result variable 'timeValue' is cleared automatically.

Parameters:
timeValue reference to OFTime variable where the result is stored
pos index of the element component in case of value multiplicity (0..vm-1)
supportOldFormat if OFTrue support old (prior V3.0) time format (see above)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmTime::getOFTimeFromString const OFString dicomTime,
OFTime timeValue,
const OFBool  supportOldFormat = OFTrue
[static]
 

get the specified DICOM time value in OFTime format.

Please note that the element value is expected to be in valid DICOM TM format ("[HH[MM[SS[.FFFFFF]]]]", "[HH[:MM[:SS[.FFFFFF]]]]" is also supported for reasons of backward compatibility). Since there is no time zone for the DICOM TM format local time is assumed (the time zone of 'timeValue' is set automatically). If this function fails the result variable 'timeValue' is cleared automatically.

Parameters:
dicomTime string value in DICOM TM format to be converted to ISO format
timeValue reference to OFTime variable where the result is stored
supportOldFormat if OFTrue support old (prior V3.0) time format (see above)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmTime::getTimeZoneFromString const OFString dicomTimeZone,
double &  timeZone
[static]
 

get the specified DICOM time zone in number of hours format DICOM standard states that if the "Timezone Offset From UTC" attribute (0008,0201) is present it applies to all TM attributes in the object.

This functions allows to convert the DICOM format ("&ZZZZ" where "&" is "+" or "-" and "ZZZZ" hours and minutes) to a floating point value, e.g. "+1.0" means plus one hour and "-2.5" minus two and a half hour, i.e. 2 hours and 30 minutes. The resulting 'timeZone' value can be used in conjuction with a OFTime object to convert the time to different time zones (e.g. to local time or UTC).

Parameters:
dicomTimeZone string value in DICOM format ("&ZZZZ") to be converted
timeZone reference to floating point variable where the resulting UTC offset is stored
Returns:
EC_Normal upon success, an error code otherwise

virtual DcmEVR DcmTime::ident  )  const [virtual]
 

get element type identifier

Returns:
type identifier of this class (EVR_TM)

Reimplemented from DcmByteString.

DcmTime& DcmTime::operator= const DcmTime obj  ) 
 

assignment operator

Parameters:
obj element to be assigned/copied
Returns:
reference to this object

OFCondition DcmTime::setCurrentTime const OFBool  seconds = OFTrue,
const OFBool  fraction = OFFalse
 

set the element value to the current system time.

The DICOM TM format supported by this function is "HHMM[SS[.FFFFFF]]" where the brackets enclose optional parts. If the current system time or parts of it are unavailable the corresponding values are set to "0" and an error code is returned.

Parameters:
seconds add optional seconds ("SS") if OFTrue
fraction add optional fractional part of a second (".FFFFFF") if OFTrue (requires parameter 'seconds' to be also OFTrue)
Returns:
EC_Normal upon success, an error code otherwise

OFCondition DcmTime::setOFTime const OFTime timeValue  ) 
 

set the element value to the given time

Parameters:
timeValue time to be set (should be a valid time)
Returns:
EC_Normal upon success, an error code otherwise


The documentation for this class was generated from the following file:


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