#ifndef TRealDatum_hxx_seen #define TRealDatum_hxx_seen #include #include #include namespace COMET { class IRealDatum; } /// Save floating point values as a IDatum. This behaves a lot like a /// standard vector, but doesn't implement all of the methods. The type of /// the element is defined by the value_type typedef. class COMET::IRealDatum: public IDatum { public: typedef double value_type; typedef std::vector::iterator iterator; typedef std::vector::const_iterator const_iterator; IRealDatum(); explicit IRealDatum(const char* name, double value=0); IRealDatum(const char* name, const char* title, double value=0); IRealDatum(const IRealDatum& rhs); virtual ~IRealDatum(); /// Get the value of this datum. This returns the value of the first /// element of the vector (if there are more than one elements. double GetValue(void) const; /// Set the value of this datum. This sets the value of the first /// element of the vector (if there are more than one elements. void SetValue(double value); iterator begin() {return fValue.begin();} iterator end() {return fValue.end();} const_iterator begin() const {return fValue.begin();} const_iterator end() const {return fValue.end();} double& operator [] (int i) {return fValue[i];} const double& operator [] (int i) const {return fValue[i];} void clear() {fValue.clear();} double& at(int i) {return fValue.at(i);} const double& at(int i) const {return fValue.at(i);} unsigned int size() const {return fValue.size();} void push_back(double r) {fValue.push_back(r);} void ls(Option_t* opt = "") const; private: std::vector fValue; ClassDef(IRealDatum,2); }; #endif