MeVisLab Toolbox Reference
ml::MLImageFormatTag Class Reference

Class defining a tag used in the MLImageFormat class. More...

#include <mlImageFormatTag.h>

Public Member Functions

Basic class stuff, constructor, destructor, assignment etc.
 MLImageFormatTag ()
 Default constructor, setting name and value to empty strings. More...
 
 MLImageFormatTag (const MLImageFormatTag &tag)
 Copy constructor. More...
 
 MLImageFormatTag (const std::string &name, const std::string &value)
 Constructor from name and value. More...
 
 MLImageFormatTag (const std::string &name, MLint value)
 Constructor from name and MLint. More...
 
 MLImageFormatTag (const std::string &name, MLdouble value)
 Constructor from name and MLdouble. More...
 
 MLImageFormatTag (const std::string &name, MLldouble value)
 Constructor from name and MLldouble. More...
 
MLImageFormatTagoperator= (const MLImageFormatTag &tag)
 Assignment operator. More...
 
Methods to set the value from different types.
const std::string & getName () const
 Returns the tag name as string. More...
 
const std::string & getValue () const
 Returns the value as string. More...
 
void setName (const std::string &newName)
 Method to set the value from an MLint64. More...
 
void setValue (const std::string &newVal)
 Method to set the value from a string. More...
 
void setValue (MLint newVal)
 Method to set the value from an MLint64. More...
 
void setValue (MLdouble newVal)
 Method to set the value from a double. More...
 
void setValue (MLldouble newVal)
 Method to set the value from a long double. More...
 
size_t getTagSize () const
 Return the size of name and value strings + 2 for the two terminating nulls. More...
 
void writeNameAndValueIntoMemory (char *memPos) const
 Write name and tag terminated with null characters to the memory position memPos. More...
 
const char * setNameAndValueFromMemory (const char *mem, const char *lastValidMemByte)
 Set tag and value from a memory buffer which is assumed to contain two null-terminated strings directly after another, separated by a null terminating character, the first describing the name of the tag, the second describing the value string of the tag. More...
 
Methods to get the value as different types.
const std::string & getStringValue () const
 Method to set the value from an MLint64. More...
 
MLint getMLintValue () const
 Method to get the value as an MLint or 0 on failure. More...
 
MLdouble getDoubleValue () const
 Method to get the value as a double or 0 on failure. More...
 
MLldouble getLongDoubleValue () const
 Method to get the value as a long double or 0 on failure. More...
 

Protected Attributes

std::string _name
 The name of the tag to be stored in a file; default is "". More...
 
std::string _value
 The value of the tag to be stored in a file; default is "". More...
 

Detailed Description

Class defining a tag used in the MLImageFormat class.

Definition at line 30 of file mlImageFormatTag.h.

Constructor & Destructor Documentation

◆ MLImageFormatTag() [1/6]

ml::MLImageFormatTag::MLImageFormatTag ( )
inline

Default constructor, setting name and value to empty strings.

Definition at line 38 of file mlImageFormatTag.h.

◆ MLImageFormatTag() [2/6]

ml::MLImageFormatTag::MLImageFormatTag ( const MLImageFormatTag tag)
inline

Copy constructor.

Definition at line 44 of file mlImageFormatTag.h.

◆ MLImageFormatTag() [3/6]

ml::MLImageFormatTag::MLImageFormatTag ( const std::string &  name,
const std::string &  value 
)
inline

Constructor from name and value.

Definition at line 50 of file mlImageFormatTag.h.

◆ MLImageFormatTag() [4/6]

ml::MLImageFormatTag::MLImageFormatTag ( const std::string &  name,
MLint  value 
)
inline

Constructor from name and MLint.

Definition at line 57 of file mlImageFormatTag.h.

◆ MLImageFormatTag() [5/6]

ml::MLImageFormatTag::MLImageFormatTag ( const std::string &  name,
MLdouble  value 
)
inline

Constructor from name and MLdouble.

Definition at line 64 of file mlImageFormatTag.h.

◆ MLImageFormatTag() [6/6]

ml::MLImageFormatTag::MLImageFormatTag ( const std::string &  name,
MLldouble  value 
)
inline

Constructor from name and MLldouble.

Definition at line 71 of file mlImageFormatTag.h.

Member Function Documentation

◆ getDoubleValue()

MLdouble ml::MLImageFormatTag::getDoubleValue ( ) const
inline

Method to get the value as a double or 0 on failure.

Definition at line 242 of file mlImageFormatTag.h.

◆ getLongDoubleValue()

MLldouble ml::MLImageFormatTag::getLongDoubleValue ( ) const
inline

Method to get the value as a long double or 0 on failure.

Definition at line 251 of file mlImageFormatTag.h.

◆ getMLintValue()

MLint ml::MLImageFormatTag::getMLintValue ( ) const
inline

Method to get the value as an MLint or 0 on failure.

Definition at line 233 of file mlImageFormatTag.h.

◆ getName()

const std::string& ml::MLImageFormatTag::getName ( ) const
inline

Returns the tag name as string.

Definition at line 95 of file mlImageFormatTag.h.

Referenced by ml::operator!=(), and ml::operator==().

◆ getStringValue()

const std::string& ml::MLImageFormatTag::getStringValue ( ) const
inline

Method to set the value from an MLint64.

Definition at line 227 of file mlImageFormatTag.h.

◆ getTagSize()

size_t ml::MLImageFormatTag::getTagSize ( ) const
inline

Return the size of name and value strings + 2 for the two terminating nulls.

Definition at line 152 of file mlImageFormatTag.h.

◆ getValue()

const std::string& ml::MLImageFormatTag::getValue ( ) const
inline

Returns the value as string.

Definition at line 98 of file mlImageFormatTag.h.

Referenced by ml::operator!=(), and ml::operator==().

◆ operator=()

MLImageFormatTag& ml::MLImageFormatTag::operator= ( const MLImageFormatTag tag)
inline

Assignment operator.

Definition at line 78 of file mlImageFormatTag.h.

References _name, and _value.

◆ setName()

void ml::MLImageFormatTag::setName ( const std::string &  newName)
inline

Method to set the value from an MLint64.

Definition at line 101 of file mlImageFormatTag.h.

◆ setNameAndValueFromMemory()

const char* ml::MLImageFormatTag::setNameAndValueFromMemory ( const char *  mem,
const char *  lastValidMemByte 
)
inline

Set tag and value from a memory buffer which is assumed to contain two null-terminated strings directly after another, separated by a null terminating character, the first describing the name of the tag, the second describing the value string of the tag.

Note that this function also supports empty name and value strings, that means that two null terminating characters after each other are parsed correctly. In case of failure name and value of *this are not modified.

Parameters
memis the pointer to the first character of the name of the tag to be parsed from memory.
lastValidMemBytemust be a pointer to the last byte of the memory buffer which may be parsed by this function. It will not be exceeded while reading the name and value. It must be equal or larger than the pointer to the null terminating character of the value string.
Returns
the pointer to the second string termination character on success and NULL on failure.

Definition at line 186 of file mlImageFormatTag.h.

◆ setValue() [1/4]

void ml::MLImageFormatTag::setValue ( const std::string &  newVal)
inline

Method to set the value from a string.

Definition at line 110 of file mlImageFormatTag.h.

◆ setValue() [2/4]

void ml::MLImageFormatTag::setValue ( MLdouble  newVal)
inline

Method to set the value from a double.

Definition at line 124 of file mlImageFormatTag.h.

◆ setValue() [3/4]

void ml::MLImageFormatTag::setValue ( MLint  newVal)
inline

Method to set the value from an MLint64.

Definition at line 116 of file mlImageFormatTag.h.

◆ setValue() [4/4]

void ml::MLImageFormatTag::setValue ( MLldouble  newVal)
inline

Method to set the value from a long double.

Definition at line 138 of file mlImageFormatTag.h.

◆ writeNameAndValueIntoMemory()

void ml::MLImageFormatTag::writeNameAndValueIntoMemory ( char *  memPos) const
inline

Write name and tag terminated with null characters to the memory position memPos.

It is assumed that at memPos at least getTagSize() bytes of accessible memory is available.

Definition at line 160 of file mlImageFormatTag.h.

Member Data Documentation

◆ _name

std::string ml::MLImageFormatTag::_name
protected

The name of the tag to be stored in a file; default is "".

Definition at line 262 of file mlImageFormatTag.h.

Referenced by operator=().

◆ _value

std::string ml::MLImageFormatTag::_value
protected

The value of the tag to be stored in a file; default is "".

Definition at line 265 of file mlImageFormatTag.h.

Referenced by operator=().


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