Descriptor< T > Class Template Reference
#include <descriptor.h>
List of all members.
Detailed Description
template<class T>
class Descriptor< T >
Template class for storing scientific values - Author:
- Dr Jean-Luc Perret (luc@kuicr.kyoto-u.ac.jp), Kyoto University, Japan
- Version:
- 0.3
- Date:
- 17 Jan 2004
CLASS NAME: Descriptor
FOR: SNSF SPONSORED PROJECT
PURPOSE: Storage type for a general scientific descriptor with label, value, unit and comment
This template class implements the storage of a general scientific measurment It not only stores a value with its label, but also the units used, and a comment.
the label, unit and comment are all strings. The value however can be of any type since its type is a tamplate T. Creating a new descriptor can be done in that way:
(in this example we are interested in a descriptor for body temperature and we initialize its value to 37.5)
Descriptor<float> myDescriptor = new Descriptor<float>("temperature", 37.5, "degrees C", "body temperature");
If we don't want the descriptor to contain any value we can give it any value and call the setEmpty() function. After that any call to getValue() will throw an exception, until a value is assigned with setValue(T)
Descriptors of type int, float and string are used by the DataContainer class.
Constructor & Destructor Documentation
template<class T> |
Descriptor< T >::Descriptor |
( |
string |
aLabel, |
|
|
T |
aValue, |
|
|
string |
aUnit, |
|
|
string |
aComment |
|
) |
|
|
Member Function Documentation
template<class T> |
void Descriptor< T >::describe |
( |
|
) |
|
|
|
prints a description of the descriptor to cout. |
template<class T> |
void Descriptor< T >::describeShort |
( |
|
) |
|
|
|
prints a description of the descriptor to cout omiting the comment. |
template<class T> |
string Descriptor< T >::getComment |
( |
|
) |
[inline] |
|
|
returns the comment string. |
template<class T> |
string Descriptor< T >::getLabel |
( |
|
) |
[inline] |
|
|
returns the label string. |
template<class T> |
string Descriptor< T >::getUnit |
( |
|
) |
[inline] |
|
template<class T> |
T Descriptor< T >::getValue |
( |
bool |
silentError = false |
) |
throw ( CError ) |
|
|
returns the value. Throws a CError exception if the descriptor has been setEmpty(). |
template<class T> |
bool Descriptor< T >::isEmpty |
( |
|
) |
[inline] |
|
|
returns true is the value was not set, false otherwise. |
template<class T> |
void Descriptor< T >::setComment |
( |
string |
aComment |
) |
[inline] |
|
|
sets the comment of the descriptor. |
template<class T> |
void Descriptor< T >::setEmpty |
( |
|
) |
[inline] |
|
template<class T> |
void Descriptor< T >::setLabel |
( |
string |
aLabel |
) |
[inline] |
|
|
sets the label of the descriptor. |
template<class T> |
void Descriptor< T >::setUnit |
( |
string |
aUnit |
) |
[inline] |
|
|
sets the unit of the descriptor. |
template<class T> |
void Descriptor< T >::setValue |
( |
T |
|
) |
|
|
|
sets the value of the descriptor. |
template<class T> |
string Descriptor< T >::toString |
( |
|
) |
|
|
|
returns a string description of the descriptor. |
template<class T> |
string Descriptor< T >::toStringShort |
( |
|
) |
|
|
|
returns a string description of the descriptor omiting the comment. |
Member Data Documentation
|
string representing a comment for the descriptor, example: body temperature. |
|
string representing the descriptor name, example: temperature. |
|
string representing the descriptor unit, example: degree C. |
|
variable representing the value of the descriptor, exemple: <float> 37.5. |
The documentation for this class was generated from the following file:
Generated on Wed Nov 28 12:12:51 2007 for ChemCpp by
1.4.6