00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef ABSTRACT_DEVICE_CLASS_H_ 00004 #define ABSTRACT_DEVICE_CLASS_H_ 00005 00006 #include <fesa-core/DataStore/AbstractDeviceFactory.h> 00007 #include <fesa-core/Core/OnDemandProducer.h> 00008 00009 #include <string> 00010 #include <vector> 00011 #include <map> 00012 #include <boost/shared_ptr.hpp> 00013 00014 namespace fesa 00015 { 00016 00017 class AbstractServiceLocator; 00018 class AbstractDeviceFactory; 00019 00020 //TODO this class is not only abstract any more, there are many services, used by Server and RT (e.g. load instantiation file) . It should be split into a concrete-class and an abstract one. 00021 //TODO The name of this class is bad. Something like "FESAClass" would fit much better (E.g. FESAClass + FESAClassImpl or AbstractFESAClass + FESAClass ) 00022 00027 class AbstractDeviceClass 00028 { 00029 public: 00030 00036 AbstractDeviceClass(const std::string& fesaClassName, const std::string& version); 00037 00041 virtual ~AbstractDeviceClass(); 00042 00047 virtual AbstractDeviceFactory* getDeviceFactory(); 00048 00053 virtual const std::string& getName(); 00054 00059 virtual const std::string& getVersion(); 00060 00064 virtual void initialize() = 0; 00065 00069 virtual void specificInit() = 0; 00070 00071 virtual const AbstractServiceLocator* getServiceLocator(); 00072 00073 virtual boost::shared_ptr<OnDemandProducer> getOnDemandEventProducer(const std::string& onDemandEventSourceName) const; 00074 00075 protected: 00076 00080 void addOnDemandEventProducer(const std::string& onDemandEventSourceName, boost::shared_ptr<OnDemandProducer>& producer); 00081 00085 std::string name_; 00086 00090 std::string version_; 00091 00095 AbstractDeviceFactory* deviceFactory_; 00096 00101 std::vector<AbstractDeviceClass*> relatedClassCol_; 00102 00107 AbstractDeviceClass* baseClass_; 00108 00109 const AbstractServiceLocator* serviceLocator_; 00110 00111 typedef const std::string OnDemandEventSourceName; 00112 typedef std::map<OnDemandEventSourceName,boost::shared_ptr<OnDemandProducer> > OnDemandEventProducerCollection; 00113 00117 OnDemandEventProducerCollection onDemandEventProducerCol_; 00118 00119 }; 00120 00121 inline AbstractDeviceFactory* AbstractDeviceClass::getDeviceFactory() 00122 { 00123 return deviceFactory_; 00124 } 00125 00126 inline const std::string& AbstractDeviceClass::getName() 00127 { 00128 return name_; 00129 } 00130 00131 inline const std::string& AbstractDeviceClass::getVersion() 00132 { 00133 return version_; 00134 } 00135 } // fesa 00136 00137 #endif // ABSTRACT_DEVICE_CLASS_H_ 00138