00001 00011 #ifndef __Q_EVENT_AUXDATA_HH_ 00012 #define __Q_EVENT_AUXDATA_HH_ 00013 00014 #include <map> 00015 #include <string> 00016 00017 #include "QCuore.hh" 00018 00019 class TObject; 00020 00021 Q_BEGIN_NAMESPACE 00022 00023 class QObject; 00024 00025 class QEventAuxData { 00026 00027 public: 00028 template<class T> class Datum { 00029 public: 00030 T obj; 00031 const char* option; 00032 }; 00033 00035 QEventAuxData() {} 00037 virtual ~QEventAuxData(); 00044 void SetTObject(const std::string& key, TObject* obj, const char* option = "") {fTObjectMap[key].obj = obj; fTObjectMap[key].option = option;} 00051 void SetQObject(const std::string& key, QObject* obj, const char* option = "") {fQObjectMap[key].obj = obj ; fQObjectMap[key].option = option;} 00058 void SetBool(const std::string& key, bool obj, const char* option = "") {fBoolMap[key].obj = obj ;fBoolMap[key].option = option;} 00065 void SetFloat(const std::string& key, float obj, const char* option = "") {fFloatMap[key].obj = obj ;fFloatMap[key].option = option;} 00072 void SetInt(const std::string& key, int obj, const char* option = "") {fIntMap[key].obj = obj ;fIntMap[key].option = option; } 00079 void SetDouble(const std::string& key, double obj, const char* option = "") {fDoubleMap[key].obj = obj ; fDoubleMap[key].option = option;} 00086 void SetString(const std::string& key, const std::string &obj, const char* option = "") {fStringMap[key].obj = obj ; fStringMap[key].option = option;} 00092 const TObject* GetTObject(const std::string& key) const {return fTObjectMap.find(key)->second.obj;} 00098 const QObject* GetQObject(const std::string& key) const {return fQObjectMap.find(key)->second.obj;} 00104 int GetInt(const std::string& key) const {return fIntMap.find(key)->second.obj;} 00110 bool GetBool(const std::string& key) const {return fBoolMap.find(key)->second.obj;} 00116 float GetFloat(const std::string& key) const {return fFloatMap.find(key)->second.obj;} 00117 00123 double GetDouble(const std::string& key) const {return fDoubleMap.find(key)->second.obj;} 00129 std::string GetString(const std::string& key) const {return fStringMap.find(key)->second.obj;} 00130 00131 const std::map<std::string, Datum<TObject*> >& GetTObjectMap() const { return fTObjectMap; } 00132 00133 const std::map<std::string, Datum<QObject*> >& GetQObjectMap() const { return fQObjectMap; } 00134 00135 const std::map<std::string, Datum<bool> >& GetBoolMap() const { return fBoolMap; } 00136 00137 const std::map<std::string, Datum<float> >& GetFloatMap() const { return fFloatMap; } 00138 00139 const std::map<std::string, Datum<double> >& GetDoubleMap() const { return fDoubleMap; } 00140 00141 const std::map<std::string, Datum<int> >& GetIntMap() const { return fIntMap; } 00142 00143 const std::map<std::string, Datum<std::string> >& GetStringMap() const { return fStringMap; } 00144 00145 void Clear(); 00146 00147 private: 00149 std::map<std::string, Datum<TObject*> > fTObjectMap; 00150 std::map<std::string, Datum<TObject*> >::iterator fTObjIter; 00152 std::map<std::string, Datum<QObject*> > fQObjectMap; 00153 std::map<std::string, Datum<QObject*> >::iterator fQObjIter; 00155 std::map<std::string, Datum<bool> > fBoolMap; 00156 std::map<std::string, Datum<bool> >::iterator fBIter; 00158 std::map<std::string, Datum<float> > fFloatMap; 00159 std::map<std::string, Datum<float> >::iterator fFIter; 00161 std::map<std::string, Datum<double> > fDoubleMap; 00162 std::map<std::string, Datum<double> >::iterator fDIter; 00164 std::map<std::string, Datum<int> > fIntMap; 00165 std::map<std::string, Datum<int> >::iterator fIIter; 00167 std::map<std::string, Datum<std::string> > fStringMap; 00168 std::map<std::string, Datum<std::string> >::iterator fSIter; 00169 00170 }; 00171 00172 Q_END_NAMESPACE 00173 00174 #endif