Value.h
, there are three classes: Value
,
bValue
and tmValue
. Value
is the base
abstract class for the other two classes. Value
has two
virtual functions: Clone()
makes a copy,
STR()
returns a string of a derived class's status.
class Value { protected: Value(){} public: virtual Value* Clone() const {return NULL;} virtual string STR() const {return string(); } };
bValue
is a concrete class derived from Value
.
bValue
is a template class, and it has a field v
whose type is the template augment V
. Thus we can define
bValue<bool>
, bValue<char>
, bValue<int>
,
bValue<double>
whose value types are bool
,
char
, int
, and double
, respectively.
template<class V> class bValue: public Value { public: V v; //-- public value field ... };
tmValue
is a concrete class derived from Value
. This
class has a map from a string to a double-precision floating
number that can be used to identify an event as a string
and to specify its occurrence time.
class tmValue: public Value { public: map<string, double> TimeMap; ... };
You can see how to use this tmValue
in Section
4.2.1 and
4.3.