#ifndef TIntegerDatum_hxx_seen #define TIntegerDatum_hxx_seen #include #include #include namespace COMET { class IIntegerDatum; } /// Save integer 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 /// (int) is defined by the value_type typedef. class COMET::IIntegerDatum: public IDatum { public: typedef int value_type; typedef std::vector::iterator iterator; typedef std::vector::const_iterator const_iterator; IIntegerDatum(); explicit IIntegerDatum(const char* name, int value=0); IIntegerDatum(const char* name, const char* title, int value=0); IIntegerDatum(const IIntegerDatum&); virtual ~IIntegerDatum(); /// Get the value of this datum. This returns the value of the first /// element of the vector (if there are more than one elements. int 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(int 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();} int& operator [] (int i) {return fValue[i];} const int& operator [] (int i) const {return fValue[i];} void clear() {fValue.clear();} int& at(int i) {return fValue.at(i);} const int& at(int i) const {return fValue.at(i);} unsigned int size() const {return fValue.size();} void push_back(int i) {fValue.push_back(i);} void ls(Option_t* opt = "") const; /// Do not use this method. std::vector& GetVector(void) METHOD_DEPRECATED; /// Do not use this method. const std::vector& GetVector(void) const METHOD_DEPRECATED; /// Do not use this method. int At(int i) const METHOD_DEPRECATED {return fValue.at(i);} private: std::vector fValue; ClassDef(IIntegerDatum,2); }; #endif