libalextractor
2.0.6.8
|
00001 00010 #pragma once 00011 #ifndef _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_ 00012 #define _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_ 00013 00014 #include <alcommon/almodule.h> 00015 #include <alextractor/config.h> 00016 00017 #include <boost/scoped_ptr.hpp> 00018 #include <boost/shared_ptr.hpp> 00019 #include <boost/thread/mutex.hpp> 00020 #include <boost/thread/shared_mutex.hpp> 00021 00022 namespace AL 00023 { 00024 class ALBroker; 00025 class ALExtractorPrivate; 00026 00035 class ALEXTRACTOR_API ALExtractor: public ALModule 00036 { 00037 public: 00045 ALExtractor(boost::shared_ptr<ALBroker> pBroker, 00046 const std::string& pName); 00047 00049 virtual ~ALExtractor(); 00050 00058 virtual void subscribe(const std::string &pSubscribedName, 00059 const int &pPeriod, 00060 const float &pPrecision); 00061 00069 virtual void subscribe(const std::string &pSubscribedName); 00070 00071 00077 virtual void updatePeriod(const std::string &pSubscribedName, 00078 const int &pPeriod); 00079 00085 virtual void updatePrecision(const std::string &pSubscribedName, 00086 const float &pPrecision); 00087 00093 virtual void unsubscribe(const std::string &pSubscribedName); 00094 00100 virtual int getCurrentPeriod(); 00101 00107 virtual float getCurrentPrecision(); 00108 00114 virtual int getMyPeriod(const std::string &pSubscribedName); 00115 00121 virtual float getMyPrecision(const std::string &pSubscribedName); 00122 00128 ALValue getSubscribersInfo(); 00129 00134 virtual std::string httpGet(); 00135 00136 protected: 00137 00146 virtual void xStartDetection(const int pPeriod, 00147 const float pPrecision) = 0; 00148 00158 virtual void xUpdateParameters(const int pPeriod, const float pPrecision) {} 00159 00165 virtual void xStopDetection() = 0; 00166 00167 00175 virtual int getDefaultPeriod(); 00176 00184 virtual float getDefaultPrecision(); 00185 00186 00194 virtual int getMinimumPeriod(); 00195 00203 virtual int getMaximumPeriod(); 00204 00209 virtual std::vector<std::string> getOutputNames(void); 00210 00215 std::vector<std::string> getEventList(void); 00216 00221 std::vector<std::string> getMemoryKeyList(void); 00222 00226 void declareEvent(const std::string& event); 00227 00231 void declareMemoryKey(const std::string& key); 00232 00233 private: 00235 boost::scoped_ptr<ALExtractorPrivate> _private; 00239 void xUpdateParameters(); 00240 00241 00242 boost::mutex fSubscriptionMutex; 00243 }; 00244 } // namespace AL 00245 00246 #endif // _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_ 00247