Protected Member Functions | Private Member Functions | Private Attributes | List of all members
swarmio::services::PeriodicService Class Referenceabstract

A service that uses a periodic background worker to perform its work. More...

#include <PeriodicService.h>

Inheritance diagram for swarmio::services::PeriodicService:
Inheritance graph
[legend]

Protected Member Functions

virtual void MailboxWasConnected () noexceptoverride
 Called when the mailbox is attached to an already running endpoint or if the attached endpoint has just started. More...
 
virtual void MailboxWillBeDisconnected () noexceptoverride
 Called right before the mailbox is disconnected from its endpoint or if the attached endpoint is about to stop. More...
 
 PeriodicService (Endpoint *endpoint, std::chrono::milliseconds period)
 Construct a new Periodic Service object. More...
 
virtual void Update ()=0
 Called periodically to perform work. More...
 
- Protected Member Functions inherited from swarmio::Mailbox
void FinishConstruction ()
 Called when the last constructor has finished its job. More...
 
void FinishMovingTo (Mailbox *other)
 Called when message handling should be passed onto the new instance. More...
 
 Mailbox ()
 Construct a disconnected Mailbox. More...
 
 Mailbox (Endpoint *endpoint)
 Construct a new Mailbox object. More...
 
 Mailbox (Mailbox &&other)
 Move a Mailbox object. More...
 

Private Member Functions

void Worker ()
 Worker thread entry point. More...
 

Private Attributes

std::chrono::milliseconds _period
 Tick period. More...
 
std::atomic< bool > _shutdownRequested
 Worker thread shutdown requested. More...
 
std::thread * _worker = nullptr
 Worker thread. More...
 

Additional Inherited Members

- Public Member Functions inherited from swarmio::Mailbox
virtual void Disconnect ()
 Disconnect this Mailbox from the Endpoint. More...
 
EndpointGetEndpoint ()
 Get the associated Endpoint. More...
 
 Mailbox (const Mailbox &)=delete
 Remove copy constructor. More...
 
virtual void NodeDidJoin (const Node *node) noexcept
 Called when a new Node has joined the group. More...
 
virtual void NodeWasDiscovered (const Node *node) noexcept
 Called when a new Node has been discovered. More...
 
virtual void NodeWillLeave (const Node *node) noexcept
 Called when a Node signals that it will leave. More...
 
Mailboxoperator= (const Mailbox &)=delete
 Remove assignment operator. More...
 
virtual bool ReceiveMessage (const Node *sender, const data::Message *message)
 Delivery point of all messages. More...
 
virtual ~Mailbox ()
 Destroy the Mailbox object. More...
 

Detailed Description

A service that uses a periodic background worker to perform its work.

Definition at line 13 of file PeriodicService.h.

Constructor & Destructor Documentation

swarmio::services::PeriodicService::PeriodicService ( Endpoint endpoint,
std::chrono::milliseconds  period 
)
inlineprotected

Construct a new Periodic Service object.

Parameters
endpointEndpoint
periodBackground worker period

Definition at line 49 of file PeriodicService.h.

Member Function Documentation

void PeriodicService::MailboxWasConnected ( )
overrideprotectedvirtualnoexcept

Called when the mailbox is attached to an already running endpoint or if the attached endpoint has just started.

Reimplemented from swarmio::Mailbox.

Definition at line 30 of file PeriodicService.cpp.

void PeriodicService::MailboxWillBeDisconnected ( )
overrideprotectedvirtualnoexcept

Called right before the mailbox is disconnected from its endpoint or if the attached endpoint is about to stop.

Reimplemented from swarmio::Mailbox.

Definition at line 36 of file PeriodicService.cpp.

virtual void swarmio::services::PeriodicService::Update ( )
protectedpure virtual

Called periodically to perform work.

Implemented in swarmio::services::telemetry::Service.

void PeriodicService::Worker ( )
private

Worker thread entry point.

Definition at line 6 of file PeriodicService.cpp.

Member Data Documentation

std::chrono::milliseconds swarmio::services::PeriodicService::_period
private

Tick period.

Definition at line 33 of file PeriodicService.h.

std::atomic<bool> swarmio::services::PeriodicService::_shutdownRequested
private

Worker thread shutdown requested.

Definition at line 27 of file PeriodicService.h.

std::thread* swarmio::services::PeriodicService::_worker = nullptr
private

Worker thread.

Definition at line 21 of file PeriodicService.h.


The documentation for this class was generated from the following files:


swarmros
Author(s):
autogenerated on Fri Apr 3 2020 03:42:48