DcmDate Class Reference

a class representing the DICOM value representation 'Date' (DA) More...

Inheritance diagram for DcmDate:

DcmByteString DcmElement DcmObject List of all members.

Public Member Functions

 DcmDate (const DcmTag &tag, const Uint32 len=0)
 constructor.
 DcmDate (const DcmDate &old)
 copy constructor
virtual ~DcmDate ()
 destructor
DcmDateoperator= (const DcmDate &obj)
 assignment operator
virtual DcmObjectclone () const
 clone method
virtual DcmEVR ident () const
 get element type identifier
virtual OFCondition getOFString (OFString &stringVal, const unsigned long pos, OFBool normalize=OFTrue)
 get a copy of a particular string component
OFCondition setCurrentDate ()
 set the element value to the current system date.
OFCondition setOFDate (const OFDate &dateValue)
 set the element value to the given date
OFCondition getOFDate (OFDate &dateValue, const unsigned long pos=0, const OFBool supportOldFormat=OFTrue)
 get the current element value in OFDate format.
OFCondition getISOFormattedDate (OFString &formattedDate, const unsigned long pos=0, const OFBool supportOldFormat=OFTrue)
 get the current element value in ISO date format.

Static Public Member Functions

static OFCondition getCurrentDate (OFString &dicomDate)
 get the current system date.
static OFCondition getDicomDateFromOFDate (const OFDate &dateValue, OFString &dicomDate)
 get the specified OFDate value in DICOM format.
static OFCondition getOFDateFromString (const OFString &dicomDate, OFDate &dateValue, const OFBool supportOldFormat=OFTrue)
 get the specified DICOM date value in OFDate format.
static OFCondition getISOFormattedDateFromString (const OFString &dicomDate, OFString &formattedDate, const OFBool supportOldFormat=OFTrue)
 get the specified DICOM date value in ISO format.

Detailed Description

a class representing the DICOM value representation 'Date' (DA)

Definition at line 46 of file dcvrda.h.


Constructor & Destructor Documentation

DcmDate::DcmDate 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().

DcmDate::DcmDate const DcmDate old  ) 
 

copy constructor

Parameters:
old element to be copied


Member Function Documentation

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

clone method

Returns:
deep copy of this object

Reimplemented from DcmByteString.

Definition at line 78 of file dcvrda.h.

References DcmDate().

static OFCondition DcmDate::getCurrentDate OFString dicomDate  )  [static]
 

get the current system date.

The DICOM DA format supported by this function is "YYYYMMDD". If the current system date is unavailable the date is set to "19000101" and an error code is returned.

Parameters:
dicomDate reference to string variable where the result is stored
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmDate::getDicomDateFromOFDate const OFDate dateValue,
OFString dicomDate
[static]
 

get the specified OFDate value in DICOM format.

The DICOM DA format supported by this function is "YYYYMMDD". If the specified date is invalid the date is set to "19000101" and an error code is returned.

Parameters:
dateValue date to be converted to DICOM format
dicomDate reference to string variable where the result is stored
Returns:
EC_Normal upon success, an error code otherwise

OFCondition DcmDate::getISOFormattedDate OFString formattedDate,
const unsigned long  pos = 0,
const OFBool  supportOldFormat = OFTrue
 

get the current element value in ISO date format.

The ISO date format supported by this function is "YYYY-MM-DD". Please note that the element value is expected to be in valid DICOM DA format ("YYYYMMDD", "YYYY.MM.DD" is also supported for reasons of backward compatibility). If this function fails the result variable 'formattedDate' is cleared automatically.

Parameters:
formattedDate reference to string 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) date format (see above)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmDate::getISOFormattedDateFromString const OFString dicomDate,
OFString formattedDate,
const OFBool  supportOldFormat = OFTrue
[static]
 

get the specified DICOM date value in ISO format.

The ISO date format supported by this function is "YYYY-MM-DD". Please note that the specified value is expected to be in valid DICOM DA format ("YYYYMMDD", "YYYY.MM.DD" is also supported for reasons of backward compatibility). If this function fails the result variable 'formattedDate' is cleared automatically.

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

OFCondition DcmDate::getOFDate OFDate dateValue,
const unsigned long  pos = 0,
const OFBool  supportOldFormat = OFTrue
 

get the current element value in OFDate format.

Please note that the element value is expected to be in valid DICOM DA format ("YYYYMMDD", "YYYY.MM.DD" is also supported for reasons of backward compatibility). If this function fails the result variable 'dateValue' is cleared automatically.

Parameters:
dateValue reference to OFDate 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) date format (see above)
Returns:
EC_Normal upon success, an error code otherwise

static OFCondition DcmDate::getOFDateFromString const OFString dicomDate,
OFDate dateValue,
const OFBool  supportOldFormat = OFTrue
[static]
 

get the specified DICOM date value in OFDate format.

Please note that the specified value is expected to be in valid DICOM DA format ("YYYYMMDD", "YYYY.MM.DD" is also supported for reasons of backward compatibility). If this function fails the result variable 'dateValue' is cleared automatically.

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

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

get a copy of a particular string component

Parameters:
stringVal 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.

virtual DcmEVR DcmDate::ident  )  const [virtual]
 

get element type identifier

Returns:
type identifier of this class (EVR_DA)

Reimplemented from DcmByteString.

DcmDate& DcmDate::operator= const DcmDate obj  ) 
 

assignment operator

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

OFCondition DcmDate::setCurrentDate  ) 
 

set the element value to the current system date.

The DICOM DA format supported by this function is "YYYYMMDD". If the current system date is unavailable the date is set to "19000101" and an error code is returned.

Returns:
EC_Normal upon success, an error code otherwise

OFCondition DcmDate::setOFDate const OFDate dateValue  ) 
 

set the element value to the given date

Parameters:
dateValue date to be set (should be a valid date)
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