00001 #ifndef __INSTANTIO_DATA_H
00002 #define __INSTANTIO_DATA_H
00003
00004 #ifdef _MSC_VER
00005 # pragma once
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "InstantIODef.h"
00027 #include "BasicData.h"
00028
00029
00030 namespace InstantIO
00031 {
00032
00033
00071 template <class T> class Data: public BasicData
00072 {
00073 public:
00074
00079 inline Data(): BasicData(), value_() {}
00080
00086 inline Data(const T &value): BasicData(), value_(value)
00087 { setTimeStamp(); }
00088
00095 inline Data(const Data &other): BasicData(other.timeStamp_), value_(other.value_)
00096 {}
00097
00104 inline const Data<T> &operator=(const Data<T> &other)
00105 {
00106 if (this != &other)
00107 {
00108 value_ = other.value_;
00109 timeStamp_ = other.timeStamp_;
00110 }
00111 return *this;
00112 }
00113
00120 inline const T &operator=(const T &value)
00121 {
00122 value_ = value;
00123 setTimeStamp();
00124 return value;
00125 }
00126
00132 inline operator const T&() const
00133 { return value_; }
00134
00140 inline operator T&()
00141 { return value_; }
00142
00147 inline const T &getValue() const
00148 { return value_; }
00149
00154 inline T &getValue()
00155 { return value_; }
00156
00161 inline void setValue(const T &value)
00162 { value_ = value; }
00163
00164 private:
00165
00167 T value_;
00168 };
00169
00170
00171 }
00172
00173
00174 #endif // __INSTANTIO_DATA_H