libalextractor  2.5.7.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
alextractor.h
Go to the documentation of this file.
1 
10 #pragma once
11 #ifndef _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_
12 #define _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_
13 
14 #include <alcommon/almodule.h>
15 #include <alextractor/config.h>
16 
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/shared_ptr.hpp>
19 #include <boost/thread/mutex.hpp>
20 #include <boost/thread/shared_mutex.hpp>
21 
22 namespace AL
23 {
24  class ALBroker;
25  class ALExtractorPrivate;
26 
36  {
37  public:
45  ALExtractor(boost::shared_ptr<ALBroker> pBroker,
46  const std::string& pName);
47 
49  virtual ~ALExtractor();
50 
58  virtual void subscribe(const std::string &pSubscribedName,
59  const int &pPeriod,
60  const float &pPrecision);
61 
69  virtual void subscribe(const std::string &pSubscribedName);
70 
71 
77  virtual void updatePeriod(const std::string &pSubscribedName,
78  const int &pPeriod);
79 
85  virtual void updatePrecision(const std::string &pSubscribedName,
86  const float &pPrecision);
87 
93  virtual void unsubscribe(const std::string &pSubscribedName);
94 
100  virtual int getCurrentPeriod();
101 
107  virtual float getCurrentPrecision();
108 
114  virtual int getMyPeriod(const std::string &pSubscribedName);
115 
121  virtual float getMyPrecision(const std::string &pSubscribedName);
122 
128  ALValue getSubscribersInfo();
129 
130  protected:
131 
140  virtual void xStartDetection(const int pPeriod,
141  const float pPrecision) = 0;
142 
152  virtual void xUpdateParameters(const int pPeriod, const float pPrecision) {}
153 
159  virtual void xStopDetection() = 0;
160 
161 
169  virtual int getDefaultPeriod();
170 
178  virtual float getDefaultPrecision();
179 
180 
188  virtual int getMinimumPeriod();
189 
197  virtual int getMaximumPeriod();
198 
203  virtual std::vector<std::string> getOutputNames(void);
204 
209  std::vector<std::string> getEventList(void);
210 
215  std::vector<std::string> getMemoryKeyList(void);
216 
220  void declareEvent(const std::string& event);
221 
225  void declareMemoryKey(const std::string& key);
226 
227  private:
229  boost::scoped_ptr<ALExtractorPrivate> _private;
233  void xUpdateParameters();
234 
235 
236  boost::mutex fSubscriptionMutex;
237  };
238 } // namespace AL
239 
240 #endif // _LIBALEXTRACTOR_ALEXTRACTOR_ALEXTRACTOR_H_
241 
virtual void xUpdateParameters(const int pPeriod, const float pPrecision)
Enables to do some custom updates when the period and/or the precision have been updated.
Definition: alextractor.h:152
dll import/export
ALExtractor class implements an extractor.
Definition: alextractor.h:35
#define ALEXTRACTOR_API
Definition: config.h:23