libalextractor
2.0.6.8
|
ALExtractor class implements an extractor. More...
#include <alextractor/alextractor.h>
Public Member Functions | |
ALExtractor (boost::shared_ptr< ALBroker > pBroker, const std::string &pName) | |
Constructor. | |
virtual | ~ALExtractor () |
Destructor. | |
virtual void | subscribe (const std::string &pSubscribedName, const int &pPeriod, const float &pPrecision) |
Called by the "client" to tell that it is interested in the output values. | |
virtual void | subscribe (const std::string &pSubscribedName) |
Called by the "client" to tell that it is interested in the output values. Period and Precision specified by getDefaultPrecision() and getDefaultPeriod() will be used by default. | |
virtual void | updatePeriod (const std::string &pSubscribedName, const int &pPeriod) |
Called by the "client" to update the periode. | |
virtual void | updatePrecision (const std::string &pSubscribedName, const float &pPrecision) |
Called by the "client" to update the precision. | |
virtual void | unsubscribe (const std::string &pSubscribedName) |
Called by the "client" to tell that it is not interested anymore in the output values. | |
virtual int | getCurrentPeriod () |
Called by the "client" to get the current period chosen by the Extractor. | |
virtual float | getCurrentPrecision () |
Called by the "client" to get the current precision chosen by the Extractor. | |
virtual int | getMyPeriod (const std::string &pSubscribedName) |
Called by the "client" to get the period. | |
virtual float | getMyPrecision (const std::string &pSubscribedName) |
Called by the "client" to get the precision. | |
ALValue | getSubscribersInfo () |
Called by the "client" to get the information of all the current subscribers. | |
virtual std::string | httpGet () |
Called by the broker webpage to detail the module. | |
Protected Member Functions | |
virtual void | xStartDetection (const int pPeriod, const float pPrecision)=0 |
What the extractor shall do to start detection. | |
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. | |
virtual void | xStopDetection ()=0 |
What the extractor shall do to stop detection. | |
virtual int | getDefaultPeriod () |
Specifies the advertised period that should be chosen by default when subscribe(std::string name) is used. | |
virtual float | getDefaultPrecision () |
Specifies the advertised precision that should be chosen by default when subscribe(std::string name) is used. | |
virtual int | getMinimumPeriod () |
Specifies the minimum period (in ms) that can be set for the extractor. | |
virtual int | getMaximumPeriod () |
Specifies the maximum period (in ms) that can be set for the extractor. | |
virtual std::vector< std::string > | getOutputNames (void) |
Which values this extractor updates in ALMemory. | |
std::vector< std::string > | getEventList (void) |
Retrieves the list of events updated by the extractor. | |
std::vector< std::string > | getMemoryKeyList (void) |
Retrieves the list of memory keys updated by the extractor. | |
void | declareEvent (const std::string &event) |
Declares an event in ALMemory. | |
void | declareMemoryKey (const std::string &key) |
Initializes a memory key in ALMemory (with an empty ALValue). |
ALExtractor class implements an extractor.
An extractor is a module which extracts some information about the world. It can be activated to produce information.
Definition at line 35 of file alextractor.h.
AL::ALExtractor::ALExtractor | ( | boost::shared_ptr< ALBroker > | pBroker, |
const std::string & | pName | ||
) |
Constructor.
Create a extractor link to a broker.
pBroker | pointer to the broker |
pName | name of the extractor |
virtual int AL::ALExtractor::getCurrentPeriod | ( | ) | [virtual] |
Called by the "client" to get the current period chosen by the Extractor.
virtual float AL::ALExtractor::getCurrentPrecision | ( | ) | [virtual] |
Called by the "client" to get the current precision chosen by the Extractor.
virtual int AL::ALExtractor::getDefaultPeriod | ( | ) | [protected, virtual] |
Specifies the advertised period that should be chosen by default when subscribe(std::string name) is used.
Implementing this method is optional. If not implemented, 30 ms will be chosen.
virtual float AL::ALExtractor::getDefaultPrecision | ( | ) | [protected, virtual] |
Specifies the advertised precision that should be chosen by default when subscribe(std::string name) is used.
Implementing this method is optional. If not implemented, 0 will be chosen.
std::vector<std::string> AL::ALExtractor::getEventList | ( | void | ) | [protected] |
Retrieves the list of events updated by the extractor.
virtual int AL::ALExtractor::getMaximumPeriod | ( | ) | [protected, virtual] |
Specifies the maximum period (in ms) that can be set for the extractor.
Implementing this method is optional. If not implemented, no maximum period will be set and the function will return -1.
std::vector<std::string> AL::ALExtractor::getMemoryKeyList | ( | void | ) | [protected] |
Retrieves the list of memory keys updated by the extractor.
virtual int AL::ALExtractor::getMinimumPeriod | ( | ) | [protected, virtual] |
Specifies the minimum period (in ms) that can be set for the extractor.
Implementing this method is optional. If not implemented, 1 ms will be chosen.
virtual int AL::ALExtractor::getMyPeriod | ( | const std::string & | pSubscribedName | ) | [virtual] |
Called by the "client" to get the period.
pSubscribedName | Name of the client module |
virtual float AL::ALExtractor::getMyPrecision | ( | const std::string & | pSubscribedName | ) | [virtual] |
Called by the "client" to get the precision.
pSubscribedName | Name of the client module |
virtual std::vector<std::string> AL::ALExtractor::getOutputNames | ( | void | ) | [protected, virtual] |
Which values this extractor updates in ALMemory.
ALValue AL::ALExtractor::getSubscribersInfo | ( | ) |
Called by the "client" to get the information of all the current subscribers.
virtual std::string AL::ALExtractor::httpGet | ( | ) | [virtual] |
Called by the broker webpage to detail the module.
Reimplemented from AL::ALModule.
virtual void AL::ALExtractor::subscribe | ( | const std::string & | pSubscribedName, |
const int & | pPeriod, | ||
const float & | pPrecision | ||
) | [virtual] |
Called by the "client" to tell that it is interested in the output values.
pSubscribedName | Name of the client module |
pPeriod | period of the extractor |
pPrecision | precision of the extractor |
virtual void AL::ALExtractor::subscribe | ( | const std::string & | pSubscribedName | ) | [virtual] |
Called by the "client" to tell that it is interested in the output values. Period and Precision specified by getDefaultPrecision() and getDefaultPeriod() will be used by default.
pSubscribedName | Name of the client module |
virtual void AL::ALExtractor::unsubscribe | ( | const std::string & | pSubscribedName | ) | [virtual] |
Called by the "client" to tell that it is not interested anymore in the output values.
pSubscribedName | Name of the client module |
virtual void AL::ALExtractor::updatePeriod | ( | const std::string & | pSubscribedName, |
const int & | pPeriod | ||
) | [virtual] |
Called by the "client" to update the periode.
pSubscribedName | Name of the client module |
pPeriod | period of the extractor |
virtual void AL::ALExtractor::updatePrecision | ( | const std::string & | pSubscribedName, |
const float & | pPrecision | ||
) | [virtual] |
Called by the "client" to update the precision.
pSubscribedName | Name of the client module |
pPrecision | precision of the extractor |
virtual void AL::ALExtractor::xStartDetection | ( | const int | pPeriod, |
const float | pPrecision | ||
) | [protected, pure virtual] |
What the extractor shall do to start detection.
This method is called only once: when the first module subscribes.
pPeriod | period of the extractor |
pPrecision | precision of the extractor |
virtual void AL::ALExtractor::xStopDetection | ( | ) | [protected, pure virtual] |
What the extractor shall do to stop detection.
this method is called only once: when the last module unsubscribes.
virtual void AL::ALExtractor::xUpdateParameters | ( | const int | pPeriod, |
const float | pPrecision | ||
) | [inline, protected, virtual] |
Enables to do some custom updates when the period and/or the precision have been updated.
This empty method can be overrided to do some custom updates when the period and/or the precision have been updated.
pPeriod | period of the extractor |
pPrecision | precision of the extractor |
Definition at line 158 of file alextractor.h.