DCMTK  Version 3.6.1 20120515
OFFIS DICOM Toolkit
Public Member Functions | Static Public Member Functions
DcmDate Class Reference

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

+ Inheritance diagram for DcmDate:

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 OFCondition copyFrom (const DcmObject &rhs)
 Virtual object copying.
virtual DcmEVR ident () const
 get element type identifier
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 &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.
static OFCondition checkStringValue (const OFString &value, const OFString &vm="1-n", const OFBool oldFormat=OFFalse)
 check whether given string value conforms to the VR "DA" (Date) and to the specified VM.

Detailed Description

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


Constructor & Destructor Documentation

DcmDate::DcmDate ( const DcmTag tag,
const Uint32  len = 0 
)

constructor.

Create new element from given tag and length.

Parameters:
tagDICOM tag for the new element
lenvalue length for the new element
DcmDate::DcmDate ( const DcmDate old)

copy constructor

Parameters:
oldelement to be copied

Member Function Documentation

static OFCondition DcmDate::checkStringValue ( const OFString value,
const OFString vm = "1-n",
const OFBool  oldFormat = OFFalse 
) [static]

check whether given string value conforms to the VR "DA" (Date) and to the specified VM.

Parameters:
valuestring value to be checked (possibly multi-valued)
vmvalue multiplicity (according to the data dictionary) to be checked for. (See DcmElement::checkVM() for a list of valid values.)
oldFormatsupport old ACR/NEMA date format if OFTrue (i.e. with "." delimiters)
Returns:
status of the check, EC_Normal if value is correct, an error code otherwise
virtual OFCondition DcmDate::checkValue ( const OFString vm = "1-n",
const OFBool  oldFormat = OFFalse 
) [virtual]

check whether stored value conforms to the VR and to the specified VM

Parameters:
vmvalue multiplicity (according to the data dictionary) to be checked for. (See DcmElement::checkVM() for a list of valid values.)
oldFormatsupport old ACR/NEMA format if OFTrue ('.' as a separator)
Returns:
status of the check, EC_Normal if value is correct, an error code otherwise

Reimplemented from DcmElement.

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

clone method

Returns:
deep copy of this object

Reimplemented from DcmByteString.

virtual OFCondition DcmDate::copyFrom ( const DcmObject rhs) [virtual]

Virtual object copying.

This method can be used for DcmObject and derived classes to get a deep copy of an object. Internally the assignment operator is called if the given DcmObject parameter is of the same type as "this" object instance. If not, an error is returned. This function permits copying an object by value in a virtual way which therefore is different to just calling the assignment operator of DcmElement which could result in slicing the object.

Parameters:
rhs- [in] The instance to copy from. Has to be of the same class type as "this" object
Returns:
EC_Normal if copying was successful, error otherwise

Reimplemented from DcmByteString.

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:
dicomDatereference 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:
dateValuedate to be converted to DICOM format
dicomDatereference 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 or the current element value is empty, the result variable 'formattedDate' is cleared automatically.

Parameters:
formattedDatereference to string variable where the result is stored
posindex of the element component in case of value multiplicity (0..vm-1)
supportOldFormatif 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 or the specified DICOM date value is empty, the result variable 'formattedDate' is cleared automatically.

Parameters:
dicomDatestring value in DICOM DA format to be converted to ISO format
formattedDatereference to string variable where the result is stored
supportOldFormatif 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:
dateValuereference to OFDate variable where the result is stored
posindex of the element component in case of value multiplicity (0..vm-1)
supportOldFormatif 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:
dicomDatestring value in DICOM DA format to be converted to ISO format. An empty string is not regarded as valid input, since the date would be unknown.
dateValuereference to OFDate variable where the result is stored
supportOldFormatif 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:
stringValvariable in which the result value is stored
posindex of the value in case of multi-valued elements (0..vm-1)
normalizedelete 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:
objelement to be assigned/copied
Returns:
reference to this object

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:
dateValuedate 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 Tue May 15 2012 for DCMTK Version 3.6.1 20120515 by Doxygen 1.7.5.1-20111027