00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef ABSTRACT_MULTIPLEXING_MANAGER_H_ 00004 #define ABSTRACT_MULTIPLEXING_MANAGER_H_ 00005 00006 #include <string> 00007 #include <map> 00008 00009 #include <stdint.h> 00010 00011 namespace fesa 00012 { 00013 00014 class MultiplexingContext; 00015 class CycleDescriptor; 00016 class AbstractMultiplexingDataManager; 00017 00023 class AbstractMultiplexingManager 00024 { 00025 00026 friend class ExtendedMultiplexingManager; 00027 template<typename T> friend class Field; 00028 template<typename GlobalDeviceType, typename DomainStoreType, typename DevInstType> friend class DeviceFactoryImp; 00029 friend class AbstractField; 00030 friend class SynchronizationFactory; 00031 00032 public: 00033 00038 virtual int32_t getDepth(); 00039 00046 virtual int32_t requireSlot(MultiplexingContext& context) = 0; 00047 00054 virtual int32_t getSlot(MultiplexingContext& context) =0; 00055 00059 virtual ~AbstractMultiplexingManager(); 00060 00061 //Todo MuxManager(M.A): asking for a slot giving a MuxContext requires to check the compatibility 00062 // between MuxContext and MuxManager in terms of timingDomain just to avoid that a MuxContext 00063 // issued from a PSB event talk to a MuxManager CPS for instance. 00064 00065 00066 protected: 00067 00072 CycleDescriptor* getTimingDescriptor(); 00073 00079 static int32_t getMemorySizeToAllocate(); 00080 00084 static void mapMemory(char* pAddr); 00085 00093 virtual AbstractMultiplexingDataManager* getMultiplexingDataManager() = 0; 00094 00099 const std::string& getName(); 00100 00106 AbstractMultiplexingManager(const std::string& name, CycleDescriptor* timingDescriptor); 00107 00113 static AbstractMultiplexingManager* getMultiplexingManager(const std::string& name); 00114 00118 std::string name_; 00119 00123 static std::map<std::string, AbstractMultiplexingManager*> managersCol_; 00124 00128 CycleDescriptor* timingDescriptor_; 00129 00136 virtual int32_t getLastSlot(const std::string& cycleName) = 0; 00137 00144 virtual int32_t requireSlot(const std::string& cycleName) = 0; 00145 00152 virtual int32_t requireSlot(int32_t cycleId) = 0; 00153 00160 virtual int32_t getLastSlot(int32_t cycleId) = 0; 00161 00162 }; 00163 00164 inline const std::string& AbstractMultiplexingManager::getName() 00165 { 00166 return name_; 00167 } 00168 00169 inline CycleDescriptor* AbstractMultiplexingManager::getTimingDescriptor() 00170 { 00171 return timingDescriptor_; 00172 } 00173 00174 } // fesa 00175 00176 #endif // ABSTRACT_MULTIPLEXING_MANAGER_H_