MeVisLabToolboxReference
DCMTree::Value Class Reference

Class to store tag-values. More...

#include <DCMTree_Value.h>

Inheritance diagram for DCMTree::Value:
DCMTree_Serialization::Serializable DCMTree_Serialization::Deserializable

List of all members.

Public Types

enum  SetDataMode { SDM_makeCopy, SDM_takeOwnership }

Public Member Functions

 Value ()
 ctor
 Value (const unsigned int &size)
 create a value with the given size in bytes
 Value (const unsigned int &size, const unsigned char *data)
 create a value with the given size in bytes and memcpy data to it the given data remains owned by the caller
 Value (const Value &other)
 make a deep-copy of other to this uses operator=
virtual ~Value ()
 dtor
Valueoperator= (const Value &other)
 deep-copy all values from other to this handles self-assignment well
bool operator== (const Value &other) const
 return true if the value data are identical
bool operator!= (const Value &other) const
 return true if the value data are not identical
void purge ()
 drop all data
unsigned int size () const
 get the size of the valid part of data
const unsigned char * data () const
 access data
unsigned char * data ()
 access data
boost::shared_array< unsigned
char > 
sharedData () const
 access data
void setSize (const unsigned int &size)
 set the size / capacity of this
void setData (const unsigned int &size, const unsigned char *data)
 set data and capacity the given data remains owned by the caller
void setData (const unsigned int &size, unsigned char *data, SetDataMode setDataMode=SDM_makeCopy)
 set data and capacity
void setData (const std::string &value)
 deep copy the given string as binary data (size is changed accordingly, no type conversion)
bool isNull () const
 check if size of this is 0
void fromStream (std::istream &in)
 extract this instance from the given stream
void toStream (std::ostream &out) const
 copy this instance recursively into the given stream
void serializeX (DCMTree_Serialization::Sink &sink) const
 Writes data of this object to Sink.
void deserializeX (DCMTree_Serialization::Source &source)
 Overwrites data of this object with data from Source.

Detailed Description

Class to store tag-values.

Definition at line 32 of file DCMTree_Value.h.


Member Enumeration Documentation

Enumerator:
SDM_makeCopy 
SDM_takeOwnership 

Definition at line 35 of file DCMTree_Value.h.


Constructor & Destructor Documentation

DCMTree::Value::Value ( )

ctor

DCMTree::Value::Value ( const unsigned int &  size)

create a value with the given size in bytes

DCMTree::Value::Value ( const unsigned int &  size,
const unsigned char *  data 
)

create a value with the given size in bytes and memcpy data to it the given data remains owned by the caller

DCMTree::Value::Value ( const Value other)

make a deep-copy of other to this uses operator=

virtual DCMTree::Value::~Value ( ) [virtual]

dtor


Member Function Documentation

const unsigned char* DCMTree::Value::data ( ) const

access data

unsigned char* DCMTree::Value::data ( )

access data

void DCMTree::Value::deserializeX ( DCMTree_Serialization::Source source) [virtual]

Overwrites data of this object with data from Source.

All the rules stated for SCR::Serializable::serializeX apply correspondingly.

See also:
SCR::Serializable::serializeX

Implements DCMTree_Serialization::Deserializable.

void DCMTree::Value::fromStream ( std::istream &  in)

extract this instance from the given stream

Referenced by DCMTree::operator>>().

bool DCMTree::Value::isNull ( ) const

check if size of this is 0

bool DCMTree::Value::operator!= ( const Value other) const

return true if the value data are not identical

Value& DCMTree::Value::operator= ( const Value other)

deep-copy all values from other to this handles self-assignment well

bool DCMTree::Value::operator== ( const Value other) const

return true if the value data are identical

void DCMTree::Value::purge ( )

drop all data

void DCMTree::Value::serializeX ( DCMTree_Serialization::Sink sink) const [virtual]

Writes data of this object to Sink.

Implementations of Serializable::serializeX should strictly follow this pattern:

class C: public SCR::Serializable { T1 _m1; T2 _m2; T3 _m3; public: void serializeX(SCR::Sink &sink) const { SCR::serializeX(sink, _m1); SCR::serializeX(sink, _m2); SCR::serializeX(sink, _m3); } };

That is you should call some overloading of SCR::serializeX for every member.

If some of the types T1, T2, T3 are not serializable, you should make them serializable.

See also:
SCR

Implements DCMTree_Serialization::Serializable.

void DCMTree::Value::setData ( const unsigned int &  size,
unsigned char *  data,
SetDataMode  setDataMode = SDM_makeCopy 
)

set data and capacity

Parameters:
setDataModeIndicates if the given data remains owned by the caller and has to be copied or not.
void DCMTree::Value::setData ( const unsigned int &  size,
const unsigned char *  data 
)

set data and capacity the given data remains owned by the caller

void DCMTree::Value::setData ( const std::string &  value)

deep copy the given string as binary data (size is changed accordingly, no type conversion)

void DCMTree::Value::setSize ( const unsigned int &  size)

set the size / capacity of this

boost::shared_array<unsigned char> DCMTree::Value::sharedData ( ) const

access data

unsigned int DCMTree::Value::size ( ) const

get the size of the valid part of data

void DCMTree::Value::toStream ( std::ostream &  out) const

copy this instance recursively into the given stream

Referenced by DCMTree::operator<<().


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