iopc::Metadata Class Reference
[iopccommon]

A metadata entry. More...

#include <metadataHolder.h>

List of all members.

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)


Detailed Description

A metadata entry.

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.


Member Enumeration Documentation

A metadata entry type.

Enumerator:
INT  Integer value
STRING  String value
BOOL  Boolean value
POINTER  A void* value
NOTHING  This type represents empty metadata


Member Function Documentation

int iopc::Metadata::getIntValue (  )  const [inline]

Returns the metadata value.

Exceptions:
IopcIncorrectUsageException if the metadata is not of the Metadata::INT type

std::string iopc::Metadata::getStringValue (  )  const [inline]

Returns the metadata value.

Exceptions:
IopcIncorrectUsageException if the metadata is not of the Metadata::STRING type

bool iopc::Metadata::getBoolValue (  )  const [inline]

Returns the metadata value.

Exceptions:
IopcIncorrectUsageException if the metadata is not of the Metadata::BOOL type

void* iopc::Metadata::getPointerValue (  )  const [inline]

Returns the metadata value.

Exceptions:
IopcIncorrectUsageException if the metadata is not of the Metadata::POINTER type


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Metadata m 
) [friend]

Outputs a string representation of the metadata type and value into a stream.


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

Generated on Tue Apr 14 16:46:35 2009 for IOPC 2 by  doxygen 1.5.6