Sirikata
|
A service which needs to be polled periodically. More...
#include <PollingService.hpp>
Public Member Functions | |
PollingService (Network::IOStrand *str, const char *cb_tag, const Duration &max_rate=Duration::microseconds(0), Context *ctx=NULL, const String &name="", bool accurate=false) | |
~PollingService () | |
virtual void | start () |
Start polling this service on this strand at the given maximum rate. | |
virtual void | stop () |
Stop scheduling this service. | |
Protected Member Functions | |
virtual void | poll ()=0 |
Override this method to specify the work to be done when polling. | |
virtual void | shutdown () |
Override this method to clean up when a shutdown is requested. | |
Private Member Functions | |
void | indirectPoll () |
Private Attributes | |
TimeProfiler::Stage * | mProfiler |
A service which needs to be polled periodically.
This class handles scheduling and polling the service and only requires the user to override a single poll() method.
Sirikata::PollingService::PollingService | ( | Network::IOStrand * | str, |
const char * | cb_tag, | ||
const Duration & | max_rate = Duration::microseconds(0) , |
||
Context * | ctx = NULL , |
||
const String & | name = "" , |
||
bool | accurate = false |
||
) |
References Sirikata::TimeProfiler::addStage(), mProfiler, and Sirikata::Context::profiler.
Sirikata::PollingService::~PollingService | ( | ) |
References mProfiler.
void Sirikata::PollingService::indirectPoll | ( | ) | [private] |
virtual void Sirikata::PollingService::poll | ( | ) | [protected, pure virtual] |
Override this method to specify the work to be done when polling.
Implemented in Sirikata::TimeSyncClient, Sirikata::Graphics::ResourceDownloadPlanner, Sirikata::Graphics::PriorityDownloadPlanner, Sirikata::SessionManager, Sirikata::CoordinateSegmentation, Sirikata::LoadMonitor, Sirikata::LocationService, Sirikata::Proximity, Sirikata::LibproxManualProximity, Sirikata::LibproxProximity, Sirikata::LocalForwarder, and Sirikata::DistributedCoordinateSegmentation.
Referenced by indirectPoll().
virtual void Sirikata::PollingService::shutdown | ( | ) | [inline, protected, virtual] |
Override this method to clean up when a shutdown is requested.
Referenced by stop().
void Sirikata::PollingService::start | ( | ) | [virtual] |
Start polling this service on this strand at the given maximum rate.
Reimplemented from Sirikata::PollerService.
Reimplemented in Sirikata::Graphics::ResourceDownloadPlanner, Sirikata::SessionManager, Sirikata::LocationService, Sirikata::Proximity, Sirikata::LibproxManualProximity, Sirikata::LibproxProximity, and Sirikata::LibproxProximityBase.
Referenced by Sirikata::DistributedCoordinateSegmentation::asyncLLRead().
void Sirikata::PollingService::stop | ( | ) | [virtual] |
Stop scheduling this service.
Note that this does not immediately stop the service, it simply guarantees the service will not be scheduled again. This allows outstanding events to be handled properly.
Reimplemented from Sirikata::PollerService.
Reimplemented in Sirikata::Graphics::ResourceDownloadPlanner, Sirikata::Graphics::PriorityDownloadPlanner, Sirikata::SessionManager, Sirikata::LocationService, Sirikata::Proximity, Sirikata::LibproxManualProximity, Sirikata::LibproxProximityBase, and Sirikata::DistributedCoordinateSegmentation.
References shutdown().
Referenced by Sirikata::SessionManager::handleSpaceConnection().
Reimplemented in Sirikata::LoadMonitor, and Sirikata::LocationService.
Referenced by indirectPoll(), PollingService(), and ~PollingService().