RTC Toolkit  2.0.0
Public Member Functions | Protected Member Functions | List of all members
rtctk::componentFramework::CommandRequestor Class Reference

Extendable class that allows to send commands to components using MAL. More...

#include <commandRequestor.hpp>

Inheritance diagram for rtctk::componentFramework::CommandRequestor:
MyCommandRequestor

Public Member Functions

 CommandRequestor (const elt::mal::Uri &uri, std::optional< std::chrono::milliseconds > timeout=std::nullopt)
 Create a new CommandRequestor object. More...
 
virtual ~CommandRequestor ()=default
 
std::string SendCommandSync (std::string const &id, std::string const &args)
 Send synchronous command to a component. More...
 
elt::mal::future< std::string > SendCommandAsync (std::string const &id, std::string const &args)
 Send asynchronous command to a component. More...
 

Protected Member Functions

template<typename T >
std::unique_ptr< T > MakeInterface (std::string const &name)
 Make a new MAL interface. More...
 
void RegisterCommand (std::string const &id, std::function< elt::mal::future< std::string >(std::string const &)> fun)
 Register a new command. More...
 

Detailed Description

Extendable class that allows to send commands to components using MAL.

Constructor & Destructor Documentation

◆ CommandRequestor()

rtctk::metadataCollector::CommandRequestor::CommandRequestor ( const elt::mal::Uri &  uri,
std::optional< std::chrono::milliseconds >  timeout = std::nullopt 
)

Create a new CommandRequestor object.

Parameters
uriip and port of the component
timeouttimeout for requests in milliseconds

◆ ~CommandRequestor()

virtual rtctk::componentFramework::CommandRequestor::~CommandRequestor ( )
virtualdefault

Member Function Documentation

◆ MakeInterface()

template<typename T >
std::unique_ptr<T> rtctk::componentFramework::CommandRequestor::MakeInterface ( std::string const &  name)
inlineprotected

Make a new MAL interface.

Template Parameters
Ttype of the MAL interface
Parameters
ididentifyer of the MAL interface

◆ RegisterCommand()

void rtctk::componentFramework::CommandRequestor::RegisterCommand ( std::string const &  id,
std::function< elt::mal::future< std::string >(std::string const &)>  fun 
)
protected

Register a new command.

Parameters
ididentifyer of the command
funfunction that executes the command using the async MAL interface

◆ SendCommandAsync()

elt::mal::future< std::string > rtctk::componentFramework::CommandRequestor::SendCommandAsync ( std::string const &  id,
std::string const &  args 
)

Send asynchronous command to a component.

Parameters
ididentifyer of the command
argscommand arguments a serialised string

◆ SendCommandSync()

std::string rtctk::componentFramework::CommandRequestor::SendCommandSync ( std::string const &  id,
std::string const &  args 
)

Send synchronous command to a component.

Parameters
ididentifyer of the command
argscommand arguments a serialised string

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