Public Member Functions | Private Member Functions | Private Attributes | List of all members
swarmio::tool::Loop Class Referencefinal

The command line interface for the tool. More...

#include <Loop.h>

Inheritance diagram for swarmio::tool::Loop:
Inheritance graph
[legend]

Public Member Functions

 Loop (Endpoint *endpoint, LogBuffer *logBuffer)
 Construct a new Loop object. More...
 
void Run ()
 Run the command loop. More...
 

Private Member Functions

data::Variant ConvertToVariant (const std::string &value)
 Convert a string parameter to a variant. More...
 
bool ExecuteCommand (const std::string &command)
 Execute a command given by the user. More...
 
void ExecuteEventCommand (const Command &command)
 Execute an 'event' command. More...
 
void ExecuteGetCommand (const Command &command)
 Execute an 'get' command. More...
 
void ExecuteInfoCommand (const Command &command)
 Execute an 'info' command. More...
 
void ExecuteLogCommand (const Command &command)
 Execute an 'log' command. More...
 
void ExecuteMembersCommand (const Command &command)
 Execute a 'members' command. More...
 
void ExecutePingCommand (const Command &command)
 Execute a 'ping' command. More...
 
void ExecuteRediscoverCommand (const Command &command)
 Execute an 'rediscover' command. More...
 
void ExecuteSelectCommand (const Command &command)
 Execute a 'select' command. More...
 
void ExecuteSetCommand (const Command &command)
 Execute an 'set' command. More...
 
void ExecuteSubscribeCommand (const Command &command)
 Execute a 'subscribe' command. More...
 
void ExecuteSubscriptionsCommand (const Command &command)
 Execute a 'subscriptions' command. More...
 
void ExecuteUnsubscribeCommand (const Command &command)
 Execute an 'unsubscribe' command. More...
 
std::string GetPrompt ()
 Build prompt string. More...
 
virtual void NodeWasDiscovered (const Node *node) noexceptoverride
 Called when a new Node has been discovered. More...
 
- Private Member Functions inherited from swarmio::profiles::ClientProfile
virtual void CachedDiscoveryResponseWasUpdated (const Node *node, const data::discovery::Response &response) override
 Receives notifications when discovery information becomes available. More...
 
 ClientProfile (Endpoint *endpoint)
 Construct a new ClientProfile. More...
 
virtual ~ClientProfile () override
 Destructor. More...
 
- Private Member Functions inherited from swarmio::profiles::Profile
swarmio::services::discovery::ServiceGetDiscoveryService ()
 Get a reference for the Discovery service. More...
 
swarmio::services::ping::ServiceGetPingService ()
 Get a reference for the Ping service. More...
 
swarmio::services::telemetry::ServiceGetTelemetryService ()
 Get a reference for the Telemetry service. More...
 
virtual ~Profile ()
 Destroy the Profile object. More...
 
 Profile (Endpoint *endpoint, bool performActiveDiscovery)
 Construct a new Profile. More...
 
- Private 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 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 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...
 
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

LogBuffer_logBuffer = nullptr
 Log buffer. More...
 
std::mutex _mutex
 Mutex to protect nodes vector. More...
 
std::vector< const Node * > _nodes
 Nodes and their indices. More...
 
replxx::Replxx _repl
 REPL interface. More...
 
const Node_selectedNode = nullptr
 Selected node. More...
 
std::list< services::telemetry::UpdateAwaiter_subscriptions
 Currently held subscriptions. More...
 
- Private Attributes inherited from swarmio::profiles::Profile
swarmio::services::discovery::Service _discoveryService
 Discovery service. More...
 
swarmio::services::ping::Service _pingService
 Ping service. More...
 
swarmio::services::telemetry::Service _telemetryService
 Telemetry service. More...
 

Detailed Description

The command line interface for the tool.

Definition at line 19 of file Loop.h.

Constructor & Destructor Documentation

Loop::Loop ( Endpoint endpoint,
LogBuffer logBuffer 
)

Construct a new Loop object.

Parameters
endpointEndpoint to use
logBufferLog buffer to read from

Definition at line 17 of file Loop.cpp.

Member Function Documentation

data::Variant Loop::ConvertToVariant ( const std::string &  value)
private

Convert a string parameter to a variant.

Parameters
valueOriginal value
Returns
data::Variant Variant value

Definition at line 572 of file Loop.cpp.

bool Loop::ExecuteCommand ( const std::string &  command)
private

Execute a command given by the user.

Parameters
commandCommand string
Returns
True if the loop should continue.

Definition at line 473 of file Loop.cpp.

void Loop::ExecuteEventCommand ( const Command command)
private

Execute an 'event' command.

Parameters
commandCommand

Definition at line 273 of file Loop.cpp.

void Loop::ExecuteGetCommand ( const Command command)
private

Execute an 'get' command.

Parameters
commandCommand

Definition at line 152 of file Loop.cpp.

void Loop::ExecuteInfoCommand ( const Command command)
private

Execute an 'info' command.

Parameters
commandCommand

Definition at line 82 of file Loop.cpp.

void Loop::ExecuteLogCommand ( const Command command)
private

Execute an 'log' command.

Parameters
commandCommand

Definition at line 458 of file Loop.cpp.

void Loop::ExecuteMembersCommand ( const Command command)
private

Execute a 'members' command.

Parameters
commandCommand

Definition at line 319 of file Loop.cpp.

void Loop::ExecutePingCommand ( const Command command)
private

Execute a 'ping' command.

Parameters
commandCommand

Definition at line 236 of file Loop.cpp.

void Loop::ExecuteRediscoverCommand ( const Command command)
private

Execute an 'rediscover' command.

Parameters
commandCommand

Definition at line 146 of file Loop.cpp.

void Loop::ExecuteSelectCommand ( const Command command)
private

Execute a 'select' command.

Parameters
commandCommand

Definition at line 339 of file Loop.cpp.

void Loop::ExecuteSetCommand ( const Command command)
private

Execute an 'set' command.

Parameters
commandCommand

Definition at line 201 of file Loop.cpp.

void Loop::ExecuteSubscribeCommand ( const Command command)
private

Execute a 'subscribe' command.

Parameters
command

Definition at line 410 of file Loop.cpp.

void Loop::ExecuteSubscriptionsCommand ( const Command command)
private

Execute a 'subscriptions' command.

Parameters
command

Definition at line 371 of file Loop.cpp.

void Loop::ExecuteUnsubscribeCommand ( const Command command)
private

Execute an 'unsubscribe' command.

Parameters
command

Definition at line 443 of file Loop.cpp.

std::string Loop::GetPrompt ( )
private

Build prompt string.

Returns
std::string

Definition at line 33 of file Loop.cpp.

void Loop::NodeWasDiscovered ( const Node node)
overrideprivatevirtualnoexcept

Called when a new Node has been discovered.

Parameters
nodeThe node that has been discovered

Reimplemented from swarmio::Mailbox.

Definition at line 25 of file Loop.cpp.

void Loop::Run ( )

Run the command loop.

Definition at line 45 of file Loop.cpp.

Member Data Documentation

LogBuffer* swarmio::tool::Loop::_logBuffer = nullptr
private

Log buffer.

Definition at line 39 of file Loop.h.

std::mutex swarmio::tool::Loop::_mutex
private

Mutex to protect nodes vector.

Definition at line 64 of file Loop.h.

std::vector<const Node*> swarmio::tool::Loop::_nodes
private

Nodes and their indices.

Definition at line 52 of file Loop.h.

replxx::Replxx swarmio::tool::Loop::_repl
private

REPL interface.

Definition at line 27 of file Loop.h.

const Node* swarmio::tool::Loop::_selectedNode = nullptr
private

Selected node.

Definition at line 33 of file Loop.h.

std::list<services::telemetry::UpdateAwaiter> swarmio::tool::Loop::_subscriptions
private

Currently held subscriptions.

Definition at line 58 of file Loop.h.


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


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