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 elements, constructor, destructor, assignment, etc.
 MLImageFormatTag ()=default
 Default constructor, setting name and value to empty strings.
 MLImageFormatTag (std::string name, std::string value)
 Constructor from name and value.
 MLImageFormatTag (std::string name, MLint value)
 Constructor from name and MLint.
 MLImageFormatTag (std::string name, MLdouble value)
 Constructor from name and MLdouble.
 MLImageFormatTag (std::string name, MLldouble value)
 Constructor from name and MLldouble.
Methods to set the value from different types.
const std::string & getName () const
 Returns the tag name as string.
const std::string & getValue () const
 Returns the value as string.
void setName (const std::string &newName)
 Sets the value from an MLint64.
void setValue (const std::string &newVal)
 Sets the value from a string.
void setValue (MLint newVal)
 Sets the value from an MLint64.
void setValue (MLdouble newVal)
 Sets the value from a double.
void setValue (MLldouble newVal)
 Sets the value from a long double.
size_t getTagSize () const
 Returns the size of name and value strings + 2 for the two terminating nulls.
void writeNameAndValueIntoMemory (char *memPos) const
const char * setNameAndValueFromMemory (const char *mem, const char *lastValidMemByte)
Methods to get the value as different types.
const std::string & getStringValue () const
 Sets the value from an MLint64.
MLint getMLintValue () const
 Sets the value as an MLint or 0 on failure.
MLdouble getDoubleValue () const
 Returns the value as a double or 0 on failure.
MLldouble getLongDoubleValue () const
 Returns the value as a long double or 0 on failure.

Protected Attributes

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

Detailed Description

Class defining a tag used in the MLImageFormat class.

Definition at line 32 of file mlImageFormatTag.h.

Constructor & Destructor Documentation

◆ MLImageFormatTag() [1/5]

ml::MLImageFormatTag::MLImageFormatTag ( )
default

Default constructor, setting name and value to empty strings.

◆ MLImageFormatTag() [2/5]

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

Constructor from name and value.

Definition at line 43 of file mlImageFormatTag.h.

References _name, and _value.

◆ MLImageFormatTag() [3/5]

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

Constructor from name and MLint.

Definition at line 49 of file mlImageFormatTag.h.

References _name, and setValue().

◆ MLImageFormatTag() [4/5]

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

Constructor from name and MLdouble.

Definition at line 56 of file mlImageFormatTag.h.

References _name, and setValue().

◆ MLImageFormatTag() [5/5]

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

Constructor from name and MLldouble.

Definition at line 63 of file mlImageFormatTag.h.

References _name, and setValue().

Member Function Documentation

◆ getDoubleValue()

MLdouble ml::MLImageFormatTag::getDoubleValue ( ) const

Returns the value as a double or 0 on failure.

◆ getLongDoubleValue()

MLldouble ml::MLImageFormatTag::getLongDoubleValue ( ) const

Returns the value as a long double or 0 on failure.

◆ getMLintValue()

MLint ml::MLImageFormatTag::getMLintValue ( ) const

Sets the value as an MLint or 0 on failure.

◆ getName()

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

Returns the tag name as string.

Definition at line 75 of file mlImageFormatTag.h.

References _name.

◆ getStringValue()

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

Sets the value from an MLint64.

Definition at line 140 of file mlImageFormatTag.h.

References _value.

◆ getTagSize()

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

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

Definition at line 102 of file mlImageFormatTag.h.

References _name, and _value.

◆ getValue()

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

Returns the value as string.

Definition at line 78 of file mlImageFormatTag.h.

References _value.

◆ setName()

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

Sets the value from an MLint64.

Definition at line 81 of file mlImageFormatTag.h.

References _name.

◆ setNameAndValueFromMemory()

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

Sets 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 describes the name of the tag, the second describes 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
memThe 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.

◆ setValue() [1/4]

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

Sets the value from a string.

Definition at line 90 of file mlImageFormatTag.h.

References _value.

Referenced by MLImageFormatTag(), MLImageFormatTag(), and MLImageFormatTag().

◆ setValue() [2/4]

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

Sets the value from a double.

◆ setValue() [3/4]

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

Sets the value from an MLint64.

◆ setValue() [4/4]

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

Sets the value from a long double.

◆ writeNameAndValueIntoMemory()

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

Writes 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.

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 154 of file mlImageFormatTag.h.

Referenced by getName(), getTagSize(), MLImageFormatTag(), MLImageFormatTag(), MLImageFormatTag(), MLImageFormatTag(), and setName().

◆ _value

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

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

Definition at line 157 of file mlImageFormatTag.h.

Referenced by getStringValue(), getTagSize(), getValue(), MLImageFormatTag(), and setValue().


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