|
MeVisLab Toolbox Reference
|
Class to store tag values. More...
#include <DCMTree_Value.h>
Public Types | |
| enum | SetDataMode { SDM_makeCopy , SDM_takeOwnership } |
Public Member Functions | |
| Value () | |
| Constructor. | |
| Value (const unsigned int &size) | |
| Creates a value with the given size in bytes. | |
| Value (const unsigned int &size, const unsigned char *data) | |
| Creates a value with the given size in bytes and memcpy data to it. | |
| Value (const Value &other) | |
| Makes a deep copy of other to this. | |
| Value (Value &&) noexcept=default | |
| Value & | operator= (Value &&other) noexcept=default |
| ~Value () override | |
| Destructor. | |
| Value & | operator= (const Value &other) |
| Deep copies all values from other to this. | |
| bool | operator== (const Value &other) const |
Returns true if the value data are identical. | |
| bool | operator!= (const Value &other) const |
Returns true if the value data are not identical. | |
| void | purge () |
| Drops all data. | |
| unsigned int | size () const |
| Returns the size of the valid part of data. | |
| const unsigned char * | data () const |
| Accesses data. | |
| unsigned char * | data () |
| Accesses data. | |
| boost::shared_array< unsigned char > | sharedData () const |
| Accesses data. | |
| void | setSize (const unsigned int &size) |
| Sets the size or capacity of this. | |
| void | setData (const unsigned int &size, const unsigned char *data) |
| Sets data and capacity. | |
| void | setData (const unsigned int &size, unsigned char *data, SetDataMode setDataMode=SDM_makeCopy) |
| Sets data and capacity. | |
| void | setData (const std::string &value) |
| Deep copies the given string as binary data. | |
| bool | isNull () const |
| Checks whether size of this is 0. | |
| void | fromStream (std::istream &in) |
| Extracts this instance from the given stream. | |
| void | toStream (std::ostream &out) const |
| Copies this instance recursively into the given stream. | |
| void | serializeX (DCMTree_Serialization::Sink &sink) const override |
Writes data of this object to sink. | |
| void | deserializeX (DCMTree_Serialization::Source &source) override |
Overwrites data of this object with data from source. | |
Public Member Functions inherited from DCMTree_Serialization::Serializable | |
| virtual | ~Serializable () |
| Empty. | |
Public Member Functions inherited from DCMTree_Serialization::Deserializable | |
| virtual | ~Deserializable () |
| Empty. | |
Class to store tag values.
Definition at line 44 of file DCMTree_Value.h.
| Enumerator | |
|---|---|
| SDM_makeCopy | |
| SDM_takeOwnership | |
Definition at line 47 of file DCMTree_Value.h.
| DCMTree::Value::Value | ( | ) |
Constructor.
| DCMTree::Value::Value | ( | const unsigned int & | size | ) |
Creates a value with the given size in bytes.
| 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.
| DCMTree::Value::Value | ( | const Value & | other | ) |
Makes a deep copy of other to this.
Uses operator=
|
defaultnoexcept |
|
override |
Destructor.
| unsigned char * DCMTree::Value::data | ( | ) |
Accesses data.
| const unsigned char * DCMTree::Value::data | ( | ) | const |
Accesses data.
|
overridevirtual |
Overwrites data of this object with data from source.
All the rules stated for SCR::Serializable::serializeX apply correspondingly.
Implements DCMTree_Serialization::Deserializable.
| void DCMTree::Value::fromStream | ( | std::istream & | in | ) |
Extracts this instance from the given stream.
Referenced by DCMTree::operator>>().
| bool DCMTree::Value::isNull | ( | ) | const |
Checks whether size of this is 0.
| bool DCMTree::Value::operator!= | ( | const Value & | other | ) | const |
Returns true if the value data are not identical.
Deep copies all values from other to this.
Handles self-assignment well.
| bool DCMTree::Value::operator== | ( | const Value & | other | ) | const |
Returns true if the value data are identical.
| void DCMTree::Value::purge | ( | ) |
Drops all data.
|
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.
Implements DCMTree_Serialization::Serializable.
| void DCMTree::Value::setData | ( | const std::string & | value | ) |
Deep copies the given string as binary data.
The size is adjusted accordingly without type conversion.
| void DCMTree::Value::setData | ( | const unsigned int & | size, |
| const unsigned char * | data | ||
| ) |
Sets data and capacity.
The given data remains owned by the caller.
| void DCMTree::Value::setData | ( | const unsigned int & | size, |
| unsigned char * | data, | ||
| SetDataMode | setDataMode = SDM_makeCopy |
||
| ) |
Sets data and capacity.
| setDataMode | Indicates whether the given data remains owned by the caller and has to be copied. |
| void DCMTree::Value::setSize | ( | const unsigned int & | size | ) |
Sets the size or capacity of this.
| boost::shared_array< unsigned char > DCMTree::Value::sharedData | ( | ) | const |
Accesses data.
| unsigned int DCMTree::Value::size | ( | ) | const |
Returns the size of the valid part of data.
| void DCMTree::Value::toStream | ( | std::ostream & | out | ) | const |
Copies this instance recursively into the given stream.