Atlas::Message::Element

Section: C Library Functions (3)
Updated: 24 Jul 2009
Index Return to Main Contents
 

NAME

Atlas::Message::Element - Multi-type container.

 

SYNOPSIS


#include <Element.h>

 

Classes


class DataType
 

Public Types


enum Type { TYPE_NONE, TYPE_INT, TYPE_FLOAT, TYPE_PTR, TYPE_STRING, TYPE_MAP, TYPE_LIST }
 

Public Member Functions


Element ()
Construct an empty object.
Element (const Element &obj)
Copy an existing object.
Element (int v)
Set type to int, and value to v.
Element (bool v)
Set type to int, and value to v.
Element (IntType v)
Set type to int, and value to v.
Element (float v)
Set type to double, and value to v.
Element (FloatType v)
Set type to double, and value to v.
Element (PtrType v)
Set type to PtrType, and value to v.
Element (const char *v)
Set type to std::string, and value to v.
Element (const StringType &v)
Set type to std::string, and value to v.
Element (const MapType &v)
Set type to MapType, and value to v.
Element (const ListType &v)
Set type to ListType, and value to v.
Element & operator= (const Element &obj)
overload assignment operator !
Element & operator= (int v)

Element & operator= (bool v)

Element & operator= (IntType v)

Element & operator= (float v)

Element & operator= (FloatType v)

Element & operator= (PtrType v)

Element & operator= (const char *v)

Element & operator= (const StringType &v)

Element & operator= (const MapType &v)

Element & operator= (const ListType &v)

bool operator== (const Element &o) const
Check for equality with another Element.
template<class C > bool operator!= (C c) const
Check for inequality with anything we can check equality with.
bool operator== (IntType v) const
Check for equality with a int.
bool operator== (FloatType v) const
Check for equality with a double.
bool operator== (PtrType v) const
Check for equality with a pointer.
bool operator== (const char *v) const
Check for equality with a const char *.
bool operator== (const StringType &v) const
Check for equality with a std::string.
bool operator== (const MapType &v) const
Check for equality with a MapType.
bool operator== (const ListType &v) const
Check for equality with a ListType.
Type getType () const
Get the current type.
bool isNone () const
Check whether the current type is nothing.
bool isInt () const
Check whether the current type is int.
bool isFloat () const
Check whether the current type is double.
bool isPtr () const
Check whether the current type is pointer.
bool isNum () const
Check whether the current type is numeric.
bool isString () const
Check whether the current type is std::string.
bool isMap () const
Check whether the current type is MapType.
bool isList () const
Check whether the current type is ListType.
IntType asInt () const throw (WrongTypeException)
Retrieve the current value as a int.
IntType Int () const

FloatType asFloat () const throw (WrongTypeException)
Retrieve the current value as a double.
FloatType Float () const

PtrType asPtr () const throw (WrongTypeException)
Retrieve the current value as a pointer.
PtrType Ptr () const

FloatType asNum () const throw (WrongTypeException)
Retrieve the current value as a number.
const std::string & asString () const throw (WrongTypeException)
Retrieve the current value as a const std::string reference.
std::string & asString () throw (WrongTypeException)
Retrieve the current value as a non-const std::string reference.
const StringType & String () const

StringType & String ()

const MapType & asMap () const throw (WrongTypeException)
Retrieve the current value as a const MapType reference.
MapType & asMap () throw (WrongTypeException)
Retrieve the current value as a non-const MapType reference.
const MapType & Map () const

MapType & Map ()

const ListType & asList () const throw (WrongTypeException)
Retrieve the current value as a const ListType reference.
ListType & asList () throw (WrongTypeException)
Retrieve the current value as a non-const ListType reference.
const ListType & List () const

ListType & List ()
 

Static Public Member Functions


static const char * typeName (Type)
 

Protected Attributes


Type t

union {

IntType i

FloatType f

void * p

DataType< StringType > * s

DataType< MapType > * m

DataType< ListType > * l

};
 

Detailed Description

Multi-type container.

FIXME: Document this

Author:

Stefanus Du Toit <sdt@gmx.net>

Changes:

2003/04/02 Al Riddcoh <alriddoch@zepler.org> Add in some assignment operators for efficiency 2002/11/07 Al Riddcoh <alriddoch@zepler.org> Changed the name to Element as Object is a stupid name for a class. 2000/08/05 Karsten-O. Laux <klaux@rhrk.uni-kl.de> Changed the members to pointers which only get created when really needed. This is a major speedup for passing Object as parameter or when copying it. Because copying of unused members is omitted. All pointers are stored as a union, so we save memory ! Changed IntType to long and added convinience Constructors for float, int and bool

 

Author

Generated automatically by Doxygen for Atlas-C++ from the source code.