00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef FIELD_SYNCHRO_MANAGER_H_ 00004 #define FIELD_SYNCHRO_MANAGER_H_ 00005 00006 #include <fesa-core/Utilities/Mutex.h> 00007 00008 #include <map> 00009 #include <set> 00010 00011 namespace fesa 00012 { 00013 00014 class DataStore; 00015 class FieldValueBase; 00016 class MultiplexingContext; 00017 00022 class FieldSynchroManager 00023 { 00024 public: 00029 static FieldSynchroManager* getInstance(); 00030 00039 void 00040 registerModifiedField(MultiplexingContext* pContext, DataStore* pDataStore, bool isShared, FieldValueBase* pFieldValue); 00041 00049 void commitModifiedFieldSynchronization(MultiplexingContext* context); 00050 00057 void abortModifiedFieldSynchronization(MultiplexingContext* context); 00058 00065 void commitModifiedFieldSynchronization(); 00066 00067 protected: 00072 FieldSynchroManager(); 00073 00077 static FieldSynchroManager* theInstance_; 00078 00079 private: 00083 typedef std::pair<FieldValueBase*, bool> PairFieldValueShared; 00084 00088 typedef std::set<PairFieldValueShared> SetPairFieldValueShared; 00092 typedef std::map<DataStore*, SetPairFieldValueShared> MapDataStoreSetOfPairs; 00093 00097 typedef std::map<const MultiplexingContext*, MapDataStoreSetOfPairs> MapModifiedFields; 00098 00102 MapModifiedFields recentlyModifiedFields_; 00103 00108 Mutex mutex_; 00109 }; 00110 00111 } // fesa 00112 00113 #endif // FIELD_SYNCHRO_MANAGER_H_