📄 dcvrtm.h
字号:
/* * * Copyright (C) 1994-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmdata * * Author: Gerd Ehlers, Joerg Riesmeier * * Purpose: Interface of class DcmTime * * Last Update: $Author: meichel $ * Update Date: $Date: 2005/12/08 16:29:11 $ * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcmtk/dcmdata/dcvrtm.h,v $ * CVS/RCS Revision: $Revision: 1.17 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DCVRTM_H#define DCVRTM_H#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */#include "dcmtk/dcmdata/dctypes.h"#include "dcmtk/dcmdata/dcbytstr.h"#include "dcmtk/ofstd/oftime.h"/** a class representing the DICOM value representation 'Time' (TM) */class DcmTime : public DcmByteString{ public: /** constructor. * Create new element from given tag and length. * @param tag DICOM tag for the new element * @param len value length for the new element */ DcmTime(const DcmTag &tag, const Uint32 len = 0); /** copy constructor * @param old element to be copied */ DcmTime(const DcmTime &old); /** destructor */ virtual ~DcmTime(); /** assignment operator * @param obj element to be assigned/copied * @return reference to this object */ DcmTime &operator=(const DcmTime &obj); /** clone method * @return deep copy of this object */ virtual DcmObject *clone() const { return new DcmTime(*this); } /** get element type identifier * @return type identifier of this class (EVR_TM) */ virtual DcmEVR ident() const; /** get a copy of a particular string component * @param stringValue variable in which the result value is stored * @param pos index of the value in case of multi-valued elements (0..vm-1) * @param normalize delete trailing spaces if OFTrue * @return status, EC_Normal if successful, an error code otherwise */ virtual OFCondition getOFString(OFString &stringValue, const unsigned long pos, OFBool normalize = OFTrue); /** 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. * @param seconds add optional seconds ("SS") if OFTrue * @param fraction add optional fractional part of a second (".FFFFFF") if OFTrue * (requires parameter 'seconds' to be also OFTrue) * @return EC_Normal upon success, an error code otherwise */ OFCondition setCurrentTime(const OFBool seconds = OFTrue, const OFBool fraction = OFFalse); /** set the element value to the given time * @param timeValue time to be set (should be a valid time) * @return EC_Normal upon success, an error code otherwise */ OFCondition setOFTime(const OFTime &timeValue); /** 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. * @param timeValue reference to OFTime variable where the result is stored * @param pos index of the element component in case of value multiplicity (0..vm-1) * @param supportOldFormat if OFTrue support old (prior V3.0) time format (see above) * @return EC_Normal upon success, an error code otherwise */ OFCondition getOFTime(OFTime &timeValue, const unsigned long pos = 0, 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. * @param formattedTime reference to string variable where the result is stored * @param pos index of the element component in case of value multiplicity (0..vm-1) * @param seconds add optional seconds (":SS") if OFTrue * @param fraction add optional fractional part of a second (".FFFFFF") if OFTrue * (requires parameter 'seconds' to be also OFTrue) * @param createMissingPart if OFTrue create optional parts (seconds and/or fractional * part of a seconds) if absent in the element value * @param supportOldFormat if OFTrue support old (prior V3.0) time format (see above) * @return EC_Normal upon success, an error code otherwise */ 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); /* --- static helper functions --- */ /** 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -