#include <metadataHolder.h>
Public Types | |
enum | MetadataType { INT, STRING, BOOL, POINTER, NOTHING } |
A metadata entry type. More... | |
Public Member Functions | |
Metadata () | |
Initializes the metadata to the NOTHING MetadataType. | |
Metadata (int value) | |
Initializes the metadata with an integer value. | |
Metadata (const std::string &value) | |
Initializes the metadata with a string value. | |
Metadata (const char *value) | |
Initializes the metadata with a string value. | |
Metadata (bool value) | |
Initializes the metadata with a boolean value. | |
Metadata (void *value) | |
Initializes the metadata with a pointer value. | |
void | setIntValue (int value) |
Changes the value and type of the metadata. | |
void | setStringValue (const std::string &value) |
Changes the value and type of the metadata. | |
void | setBoolValue (bool value) |
Changes the value and type of the metadata. | |
void | setPointerValue (void *value) |
Changes the value and type of the metadata. | |
int | getIntValue () const |
Returns the metadata value. | |
std::string | getStringValue () const |
Returns the metadata value. | |
bool | getBoolValue () const |
Returns the metadata value. | |
void * | getPointerValue () const |
Returns the metadata value. | |
bool | isEmpty () const |
Returns true if the metadata type is Metadata::NOTHING. | |
std::string | toString () const |
Returns a string representation of the metadata value. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Metadata &m) |
Instance of this class represents a single metadata value. Values of the data types listed in Metadata::MetadataType can be represented by instances of this class. This class can be used as a value type.
The class is not thread-safe.
int iopc::Metadata::getIntValue | ( | ) | const [inline] |
Returns the metadata value.
IopcIncorrectUsageException | if the metadata is not of the Metadata::INT type |
std::string iopc::Metadata::getStringValue | ( | ) | const [inline] |
Returns the metadata value.
IopcIncorrectUsageException | if the metadata is not of the Metadata::STRING type |
bool iopc::Metadata::getBoolValue | ( | ) | const [inline] |
Returns the metadata value.
IopcIncorrectUsageException | if the metadata is not of the Metadata::BOOL type |
void* iopc::Metadata::getPointerValue | ( | ) | const [inline] |
Returns the metadata value.
IopcIncorrectUsageException | if the metadata is not of the Metadata::POINTER type |
std::ostream& operator<< | ( | std::ostream & | out, | |
const Metadata & | m | |||
) | [friend] |
Outputs a string representation of the metadata type and value into a stream.