An Awaiter that returns the roundtrip time of the Echo message. More...
#include <TimingAwaiter.h>
Public Member Functions | |
double | GetResponseInMilliseconds () |
Translate the precise response to a floating point number of milliseconds. More... | |
TimingAwaiter (Endpoint *endpoint, uint64_t requestIdentifier) | |
Construct a new TimingAwaiter object. More... | |
Public Member Functions inherited from swarmio::services::Awaiter< std::chrono::nanoseconds > | |
Awaiter (Endpoint *endpoint, uint64_t requestIdentifier) | |
Construct a new ResponseAwaiter object. More... | |
Awaiter (const std::chrono::nanoseconds &value) | |
Construct an awaiter with a cached value. More... | |
Awaiter (Awaiter &&other) | |
Move an Awaiter object. More... | |
uint64_t | GetIdentifier () const |
Get request identifier. More... | |
std::chrono::nanoseconds | GetResponse () |
Get the response value. Will throw an exception if called before the response is received. More... | |
bool | HasException () |
Checks whether the result of the processing has ended with an exception. More... | |
virtual bool | ReceiveMessage (const Node *sender, const data::Message *message) override |
Delivery point of all messages. More... | |
bool | WaitForResponse (const std::chrono::milliseconds &timeout) |
Wait for the response to become available or util the timeout period ellapses. More... | |
Public Member Functions inherited from swarmio::Mailbox | |
virtual void | Disconnect () |
Disconnect this Mailbox from the Endpoint. More... | |
Endpoint * | GetEndpoint () |
Get the associated Endpoint. More... | |
Mailbox (const Mailbox &)=delete | |
Remove copy constructor. More... | |
virtual void | MailboxWasConnected () noexcept |
Called when the mailbox is attached to an already running endpoint or if the attached endpoint has just started. More... | |
virtual void | MailboxWillBeDisconnected () noexcept |
Called right before the mailbox is disconnected from its endpoint or if the attached endpoint is about to stop. 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... | |
Mailbox & | operator= (const Mailbox &)=delete |
Remove assignment operator. More... | |
virtual | ~Mailbox () |
Destroy the Mailbox object. More... | |
Protected Member Functions | |
virtual std::chrono::nanoseconds | ExtractResponse (const Node *node, const data::Message *message) override |
Called when a response for the original message has been received. More... | |
Protected Member Functions inherited from swarmio::services::Awaiter< std::chrono::nanoseconds > | |
virtual bool | IsFinished () |
Check whether the last message has been received. 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 Attributes | |
std::chrono::time_point< std::chrono::high_resolution_clock > | _start |
When the ping request was sent. More... | |
An Awaiter that returns the roundtrip time of the Echo message.
Definition at line 12 of file TimingAwaiter.h.
|
inline |
Construct a new TimingAwaiter object.
endpoint | Endpoint |
requestIdentifier | Original message identifier |
Definition at line 40 of file TimingAwaiter.h.
|
overrideprotectedvirtual |
Called when a response for the original message has been received.
node | Sender node |
message | Message |
Implements swarmio::services::Awaiter< std::chrono::nanoseconds >.
Definition at line 9 of file TimingAwaiter.cpp.
double TimingAwaiter::GetResponseInMilliseconds | ( | ) |
Translate the precise response to a floating point number of milliseconds.
Definition at line 22 of file TimingAwaiter.cpp.
|
private |
When the ping request was sent.
Definition at line 20 of file TimingAwaiter.h.