MeVisLab Toolbox Reference
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

Public Types

enum  SetDataMode { SDM_makeCopy , SDM_takeOwnership }
 

Public Member Functions

 Value ()
 Constructor. More...
 
 Value (const unsigned int &size)
 Creates a value with the given size in bytes. More...
 
 Value (const unsigned int &size, const unsigned char *data)
 Creates a value with the given size in bytes and memcpy data to it. More...
 
 Value (const Value &other)
 Makes a deep copy of other to this. More...
 
 Value (Value &&) noexcept=default
 
Valueoperator= (Value &&other) noexcept=default
 
 ~Value () override
 Destructor. More...
 
Valueoperator= (const Value &other)
 Deep copies all values from other to this. More...
 
bool operator== (const Value &other) const
 Returns true if the value data are identical. More...
 
bool operator!= (const Value &other) const
 Returns true if the value data are not identical. More...
 
void purge ()
 Drops all data. More...
 
unsigned int size () const
 Returns the size of the valid part of data. More...
 
const unsigned char * data () const
 Accesses data. More...
 
unsigned char * data ()
 Accesses data. More...
 
boost::shared_array< unsigned char > sharedData () const
 Accesses data. More...
 
void setSize (const unsigned int &size)
 Sets the size or capacity of this. More...
 
void setData (const unsigned int &size, const unsigned char *data)
 Sets data and capacity. More...
 
void setData (const unsigned int &size, unsigned char *data, SetDataMode setDataMode=SDM_makeCopy)
 Sets data and capacity. More...
 
void setData (const std::string &value)
 Deep copies the given string as binary data. More...
 
bool isNull () const
 Checks whether size of this is 0. More...
 
void fromStream (std::istream &in)
 Extracts this instance from the given stream. More...
 
void toStream (std::ostream &out) const
 Copies this instance recursively into the given stream. More...
 
void serializeX (DCMTree_Serialization::Sink &sink) const override
 Writes data of this object to sink. More...
 
void deserializeX (DCMTree_Serialization::Source &source) override
 Overwrites data of this object with data from source. More...
 
- Public Member Functions inherited from DCMTree_Serialization::Serializable
virtual ~Serializable ()
 Empty. More...
 
- Public Member Functions inherited from DCMTree_Serialization::Deserializable
virtual ~Deserializable ()
 Empty. More...
 

Detailed Description

Class to store tag values.

Definition at line 44 of file DCMTree_Value.h.

Member Enumeration Documentation

◆ SetDataMode

Enumerator
SDM_makeCopy 
SDM_takeOwnership 

Definition at line 47 of file DCMTree_Value.h.

Constructor & Destructor Documentation

◆ Value() [1/5]

DCMTree::Value::Value ( )

Constructor.

◆ Value() [2/5]

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

Creates a value with the given size in bytes.

◆ Value() [3/5]

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

Creates a value with the given size in bytes and memcpy data to it.

The given data remains owned by the caller.

◆ Value() [4/5]

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

Makes a deep copy of other to this.

Uses operator=

◆ Value() [5/5]

DCMTree::Value::Value ( Value &&  )
defaultnoexcept

◆ ~Value()

DCMTree::Value::~Value ( )
override

Destructor.

Member Function Documentation

◆ data() [1/2]

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

Accesses data.

◆ data() [2/2]

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

Accesses data.

◆ deserializeX()

void DCMTree::Value::deserializeX ( DCMTree_Serialization::Source source)
overridevirtual

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.

◆ fromStream()

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

Extracts this instance from the given stream.

Referenced by DCMTree::operator>>().

◆ isNull()

bool DCMTree::Value::isNull ( ) const

Checks whether size of this is 0.

◆ operator!=()

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

Returns true if the value data are not identical.

◆ operator=() [1/2]

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

Deep copies all values from other to this.

Handles self-assignment well.

◆ operator=() [2/2]

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

◆ operator==()

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

Returns true if the value data are identical.

◆ purge()

void DCMTree::Value::purge ( )

Drops all data.

◆ serializeX()

void DCMTree::Value::serializeX ( DCMTree_Serialization::Sink sink) const
overridevirtual

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.

◆ setData() [1/3]

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

Deep copies the given string as binary data.

The size is adjusted accordingly without type conversion.

◆ setData() [2/3]

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

Sets data and capacity.

The given data remains owned by the caller.

◆ setData() [3/3]

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

Sets data and capacity.

Parameters
setDataModeIndicates whether the given data remains owned by the caller and has to be copied.

◆ setSize()

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

Sets the size or capacity of this.

◆ sharedData()

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

Accesses data.

◆ size()

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

Returns the size of the valid part of data.

◆ toStream()

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

Copies this instance recursively into the given stream.

Referenced by DCMTree::operator<<().


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