00001 00002 #ifndef DBISIMFLAGASSOCIATION 00003 #define DBISIMFLAGASSOCIATION 00004 00005 /** 00006 * 00007 * $Id: TDbiSimFlagAssociation.hxx,v 1.1 2011/01/18 05:49:20 finch Exp $ 00008 * 00009 * \class TDbiSimFlagAssociation 00010 * 00011 * 00012 * \brief 00013 * <b>Concept</b> Association of a particular SimFlag type with a list 00014 * of SimFlag types. 00015 * 00016 * \brief 00017 * <b>Purpose</b> To allow the DBI to choose an alternative SimFlag type 00018 * when attempting to satisfy queries. For example, allow MC data to 00019 * use Data constants. 00020 * 00021 * Contact: A.Finch@lancaster.ac.uk 00022 * 00023 * 00024 */ 00025 00026 #include <iosfwd> 00027 using std::ostream; 00028 #include <list> 00029 using std::list; 00030 #include <map> 00031 using std::map; 00032 00033 #include "DbiSimFlag.hxx" 00034 00035 00036 class TDbiSimFlagAssociation; 00037 00038 class TDbiRegistry; 00039 00040 00041 ostream& operator<<(ostream& s, const TDbiSimFlagAssociation& simFlagAss); 00042 00043 00044 class TDbiSimFlagAssociation 00045 { 00046 00047 00048 public: 00049 00050 // Typedefs for tired fingers. 00051 typedef list<DbiSimFlag::SimFlag_t> SimList_t; 00052 typedef map<DbiSimFlag::SimFlag_t,SimList_t > SimMap_t; 00053 00054 // Constructors and destructors. 00055 TDbiSimFlagAssociation(); 00056 virtual ~TDbiSimFlagAssociation(); 00057 00058 // State testing member functions 00059 00060 SimList_t Get(const DbiSimFlag::SimFlag_t value)const; 00061 void Print(ostream& s)const; 00062 void Show(); 00063 00064 /// Get access to the one and only instance. 00065 static const TDbiSimFlagAssociation& Instance(); 00066 00067 // State changing member functions. 00068 00069 void Clear() { fAssociations.clear(); } 00070 void Set(const DbiSimFlag::SimFlag_t value, SimList_t list) { 00071 fAssociations[value] = list; } 00072 void Set(TDbiRegistry& reg); 00073 00074 private: 00075 00076 /// The one and only instance (owned by TDbiDatabaseManager). 00077 static const TDbiSimFlagAssociation* fgInstance; 00078 00079 // Data members 00080 00081 SimMap_t fAssociations; 00082 00083 ClassDef(TDbiSimFlagAssociation,0) // Association between SimFlag types. 00084 00085 }; 00086 00087 00088 00089 #endif // DBISIMFLAGASSOCIATION 00090