#include <GenericValues.h>
Public Member Functions | |
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 |
Definition at line 79 of file GenericValues.h.
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.
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 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.
const char * GenericValueT::getName | ( | ) |
Get method for the 'm_strName' member variable.
Definition at line 94 of file GenericValues.cpp.
References m_strName.
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.
strValue | a string denoting the value to which the variable associated with this GenericValueT object must be set |
Definition at line 108 of file GenericValues.cpp.
References GENERIC_VALUE_BOOLEAN, GENERIC_VALUE_DOUBLE, GENERIC_VALUE_INTEGER, GENERIC_VALUE_STRING, m_type, and m_vAddress.
Referenced by GenericValues::setValue().
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'.
strValue | a string which after the method call will contain 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, m_type, and m_vAddress.
Referenced by GenericValues::getValue().
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'.
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, m_type, and m_vAddress.
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(), getName(), show(), and ~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().
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(), getValue(), setValue(), and show().