Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

GenericValueT Class Reference

#include <GenericValues.h>

List of all members.

Public Methods

 GenericValueT (const char *strName, void *vAddress, GenericValueKind type)
 ~GenericValueT ()
const char * getName ()
bool setValue (const char *strValue)
char * getValue (char *strValue)
void show (ostream &out, const char *strSeparator)

Private Attributes

const char * m_strName
void * m_vAddress
GenericValueKind m_type


Detailed Description

This class contains a pointer to a variable of a generic type (double, char*, bool, int) and this pointer is associated with a string by which the variable can be reached. Several methods are defined which enable one to access the name and value of the variable.

Definition at line 79 of file GenericValues.h.


Constructor & Destructor Documentation

GenericValueT::GenericValueT const char *    str,
void *    vAddr,
GenericValueKind    t
 

Constructor for the GenericValueT class. It creates a GenericValueT object by setting all the private member variables to the values passed to the constructor.

Parameters:
strName  a string denoting the name associated with the generic variable to which the class pointer will point (the variable can be reached through this name)
vAdress  a (void) pointer to the actual generic variable
t  the (generic) type of the variable associated with the class pointer

Definition at line 76 of file GenericValues.cpp.

References GenericValueKind, m_strName, m_type, and m_vAddress.

GenericValueT::~GenericValueT  
 

Destructor for the GenericValueT class. It destroys a GenericValueT object by freeing all memory allocated to it.

Definition at line 85 of file GenericValues.cpp.

References m_strName.


Member Function Documentation

const char * GenericValueT::getName  
 

Get method for the 'm_strName' member variable.

Returns:
the name associated with the variable to which the class pointer points

Definition at line 94 of file GenericValues.cpp.

char * GenericValueT::getValue char *    strValue
 

This method determines the value of the variable associated with this GenericValueT object. The result is converted to a string which is put into the argument to the method (note that enough memory must be allocated for this char*). This same string is also returned by the method. This enables you to use the method as an argument to a function such as 'strcpy'.

Parameters:
strValue  a string which after the method call will contain the value of the variable associated with this GenericValueT object
Returns:
a string containing the value of the variable associated with this GenericValueT object.

Definition at line 164 of file GenericValues.cpp.

References GENERIC_VALUE_BOOLEAN, GENERIC_VALUE_DOUBLE, GENERIC_VALUE_INTEGER, GENERIC_VALUE_STRING, and m_vAddress.

Referenced by GenericValues::getValue().

bool GenericValueT::setValue const char *    strValue
 

This method sets the variable associated with this GenericValueT object to the value indicated by the given string argument. The value is always supplied as a string which is then converted into the right type for this GenericValueT object.

Parameters:
strValue  a string denoting the value to which the variable associated with this GenericValueT object must be set
Returns:
a boolean indicating whether the update was successful

Definition at line 108 of file GenericValues.cpp.

References GENERIC_VALUE_BOOLEAN, GENERIC_VALUE_DOUBLE, GENERIC_VALUE_INTEGER, GENERIC_VALUE_STRING, and m_vAddress.

Referenced by GenericValues::setValue().

void GenericValueT::show ostream &    out,
const char *    strSeparator
 

This display method writes the name associated with the variable in this GenericValueT object together with its value to the output stream indicated by the first argument to the method. Name and value are separated by the separator given as the second argument. Note that boolean values are written as 'true' and 'false'.

Parameters:
out  the output stream to which the information should be written
strSeparator  a string representing the separator which should be written between the name associated with the variable and its value

Definition at line 202 of file GenericValues.cpp.

References GENERIC_VALUE_BOOLEAN, GENERIC_VALUE_DOUBLE, GENERIC_VALUE_INTEGER, GENERIC_VALUE_STRING, m_strName, and m_vAddress.

Referenced by GenericValues::show().


Member Data Documentation

const char* GenericValueT::m_strName [private]
 

the name associated with the variable to which the class pointer points

Definition at line 84 of file GenericValues.h.

Referenced by GenericValueT(), show(), and ~GenericValueT().

GenericValueKind GenericValueT::m_type [private]
 

the (generic) type of the variable to which the class pointer points

Definition at line 87 of file GenericValues.h.

Referenced by GenericValueT().

void* GenericValueT::m_vAddress [private]
 

a pointer to a variable of a generic type

Definition at line 86 of file GenericValues.h.

Referenced by GenericValueT(), getValue(), setValue(), and show().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 11:46:03 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001