DcmByteString Class Reference

base class for all DICOM value representations storing a character string More...

Inheritance diagram for DcmByteString:

DcmElement DcmObject DcmAgeString DcmApplicationEntity DcmCharString DcmCodeString DcmDate DcmDateTime DcmDecimalString DcmIntegerString DcmTime DcmUniqueIdentifier List of all members.

Public Member Functions

 DcmByteString (const DcmTag &tag, const Uint32 len=0)
 constructor.
 DcmByteString (const DcmByteString &old)
 copy constructor
virtual ~DcmByteString ()
 destructor
DcmByteStringoperator= (const DcmByteString &obj)
 assignment operator
virtual DcmObjectclone () const
 clone method
virtual DcmEVR ident () const
 get element type identifier
virtual OFCondition clear ()
 clear the currently stored value
virtual unsigned long getVM ()
 get value multiplicity
Uint32 getRealLength ()
 get length of the stored value.
virtual Uint32 getLength (const E_TransferSyntax xfer=EXS_LittleEndianImplicit, const E_EncodingType enctype=EET_UndefinedLength)
 get DICOM length of the stored value.
virtual void print (ostream &out, const size_t flags=0, const int level=0, const char *pixelFileName=NULL, size_t *pixelCounter=NULL)
 print element to a stream.
virtual OFCondition write (DcmOutputStream &outStream, const E_TransferSyntax writeXfer, const E_EncodingType encodingType=EET_UndefinedLength)
 write data element to a stream
virtual OFCondition writeSignatureFormat (DcmOutputStream &outStream, const E_TransferSyntax writeXfer, const E_EncodingType encodingType=EET_UndefinedLength)
 write data element to a stream as required for the creation of digital signatures
virtual OFCondition getOFString (OFString &stringVal, const unsigned long pos, OFBool normalize=OFTrue)
 get a copy of a particular string component
virtual OFCondition getString (char *&stringVal)
 get a pointer to the current string value.
virtual OFCondition putString (const char *stringVal)
 set element value from the given character string
virtual OFCondition putOFStringArray (const OFString &stringVal)
 set element value from the given character string.
virtual OFCondition verify (const OFBool autocorrect=OFFalse)
 check the currently stored string value.

Protected Member Functions

virtual Uint8 * newValueField ()
 create a new value field (string buffer) of the previously defined size (member variable 'Length').
virtual void postLoadValue ()
 method is called after the element value has been loaded.
virtual OFCondition makeMachineByteString ()
 convert currently stored string value to internal representation.
OFCondition makeDicomByteString ()
 convert currently stored string value to DICOM representation.
OFCondition getStringValue (OFString &stringVal)
 get a copy of the current string value.

Protected Attributes

char paddingChar
 padding character used to adjust odd value length (space)
Uint32 maxLength
 maximum number of characters for each string component

Private Types

enum  E_StringMode { DCM_MachineString, DCM_DicomString, DCM_UnknownString }
 internal type used to specify the current string representation More...

Private Attributes

Uint32 realLength
 number of characters of the internal string representation
E_StringMode fStringMode
 current representation of the string value

Detailed Description

base class for all DICOM value representations storing a character string

Definition at line 49 of file dcbytstr.h.


Member Enumeration Documentation

enum DcmByteString::E_StringMode [private]
 

internal type used to specify the current string representation

Enumerator:
DCM_MachineString  string has internal representation (no padding)
DCM_DicomString  string has DICOM representation (even length)
DCM_UnknownString  string has unknown representation (maybe multiple padding chars?)

Definition at line 54 of file dcbytstr.h.


Constructor & Destructor Documentation

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

DcmByteString::DcmByteString const DcmByteString old  ) 
 

copy constructor

Parameters:
old element to be copied


Member Function Documentation

virtual OFCondition DcmByteString::clear  )  [virtual]
 

clear the currently stored value

Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmElement.

Referenced by DVPSStoredPrint::clearInstanceUID().

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

clone method

Returns:
deep copy of this object

Implements DcmObject.

Reimplemented in DcmCharString, DcmApplicationEntity, DcmAgeString, DcmCodeString, DcmDate, DcmDecimalString, DcmDateTime, DcmIntegerString, DcmLongString, DcmLongText, DcmPersonName, DcmShortString, DcmShortText, DcmTime, DcmUniqueIdentifier, and DcmUnlimitedText.

Definition at line 93 of file dcbytstr.h.

References DcmByteString().

virtual Uint32 DcmByteString::getLength const E_TransferSyntax  xfer = EXS_LittleEndianImplicit,
const E_EncodingType  enctype = EET_UndefinedLength
[virtual]
 

get DICOM length of the stored value.

The string value is padded if required. Therefore, the returned length always has an even value.

Parameters:
xfer not used
enctype not used
Returns:
number of characters stored in DICOM representation

Reimplemented from DcmElement.

virtual OFCondition DcmByteString::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 not used since string normalization depends on value representation
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmElement.

Reimplemented in DcmApplicationEntity, DcmCodeString, DcmDate, DcmDecimalString, DcmDateTime, DcmIntegerString, DcmLongString, DcmLongText, DcmPersonName, DcmShortString, DcmShortText, DcmTime, and DcmUnlimitedText.

Uint32 DcmByteString::getRealLength  ) 
 

get length of the stored value.

Trailing spaces (padding characters) are ignored for the "real" length.

Returns:
number of characters stored for the string value

virtual OFCondition DcmByteString::getString char *&  stringVal  )  [virtual]
 

get a pointer to the current string value.

This includes all string components and separators. NB: this method does not copy the stored value.

Parameters:
stringVal reference to the pointer variable
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmElement.

OFCondition DcmByteString::getStringValue OFString stringVal  )  [protected]
 

get a copy of the current string value.

This includes all string components and separators.

Parameters:
stringVal variable in which the result is stored
Returns:
status, EC_Normal if successful, an error code otherwise

virtual unsigned long DcmByteString::getVM  )  [virtual]
 

get value multiplicity

Returns:
number of string components (separated by a backslash)

Implements DcmObject.

Reimplemented in DcmLongText, DcmShortText, and DcmUnlimitedText.

virtual DcmEVR DcmByteString::ident  )  const [virtual]
 

get element type identifier

Returns:
type identifier of this class (EVR_UNKNOWN)

Implements DcmObject.

Reimplemented in DcmApplicationEntity, DcmAgeString, DcmCodeString, DcmDate, DcmDecimalString, DcmDateTime, DcmIntegerString, DcmLongString, DcmLongText, DcmPersonName, DcmShortString, DcmShortText, DcmTime, and DcmUniqueIdentifier.

OFCondition DcmByteString::makeDicomByteString  )  [protected]
 

convert currently stored string value to DICOM representation.

It removes trailing spaces apart from a possibly required single padding character (in case of odd string length).

Returns:
status, EC_Normal if successful, an error code otherwise

virtual OFCondition DcmByteString::makeMachineByteString  )  [protected, virtual]
 

convert currently stored string value to internal representation.

It removes any trailing space character and recomputes the string length.

Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented in DcmUniqueIdentifier.

virtual Uint8* DcmByteString::newValueField  )  [protected, virtual]
 

create a new value field (string buffer) of the previously defined size (member variable 'Length').

Also handles odd value length by allocating extra space for the padding character. This method is used by derived classes only.

Returns:
pointer to the newly created value field

Reimplemented from DcmElement.

DcmByteString& DcmByteString::operator= const DcmByteString obj  ) 
 

assignment operator

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

virtual void DcmByteString::postLoadValue  )  [protected, virtual]
 

method is called after the element value has been loaded.

Can be used to correct the value before it is used for the first time.

Reimplemented from DcmElement.

virtual void DcmByteString::print ostream &  out,
const size_t  flags = 0,
const int  level = 0,
const char *  pixelFileName = NULL,
size_t *  pixelCounter = NULL
[virtual]
 

print element to a stream.

The output format of the value is a backslash separated sequence of string components (if any).

Parameters:
out output stream
flags optional flag used to customize the output (see DCMTypes::PF_xxx)
level current level of nested items. Used for indentation.
pixelFileName not used
pixelCounter not used

Implements DcmObject.

Reimplemented in DcmUniqueIdentifier.

virtual OFCondition DcmByteString::putOFStringArray const OFString stringVal  )  [virtual]
 

set element value from the given character string.

Parameters:
stringVal input character string (possibly multi-valued)
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmElement.

virtual OFCondition DcmByteString::putString const char *  stringVal  )  [virtual]
 

set element value from the given character string

Parameters:
stringVal input character string (possibly multi-valued)
Returns:
status, EC_Normal if successful, an error code otherwise

Reimplemented from DcmElement.

Reimplemented in DcmUniqueIdentifier.

virtual OFCondition DcmByteString::verify const OFBool  autocorrect = OFFalse  )  [virtual]
 

check the currently stored string value.

Checks every string component for the maximum length specified for the particular value representation.

Parameters:
autocorrect correct value and value component length if OFTrue
Returns:
status, EC_Normal if value length is correct, an error code otherwise

Implements DcmObject.

virtual OFCondition DcmByteString::write DcmOutputStream outStream,
const E_TransferSyntax  writeXfer,
const E_EncodingType  encodingType = EET_UndefinedLength
[virtual]
 

write data element to a stream

Parameters:
outStream output stream
writeXfer transfer syntax used to write the data
encodingType flag, specifying the encoding with undefined or explicit length

Reimplemented from DcmElement.

virtual OFCondition DcmByteString::writeSignatureFormat DcmOutputStream outStream,
const E_TransferSyntax  writeXfer,
const E_EncodingType  encodingType = EET_UndefinedLength
[virtual]
 

write data element to a stream as required for the creation of digital signatures

Parameters:
outStream output stream
writeXfer transfer syntax used to write the data
encodingType flag, specifying the encoding with undefined or explicit length

Reimplemented from DcmElement.


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