RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
rtctk::rtcSupervisor::RtcObjectController Class Reference

Class used to control multiple RtcObjects. More...

#include <rtctk/rtcSupervisor/rtcObjectController.hpp>

Public Member Functions

 RtcObjectController ()=delete
 
 RtcObjectController (std::vector< std::unique_ptr< RtcObjectIf > > &objects)
 
virtual ~RtcObjectController ()=default
 
std::map< std::string, std::string > RunSequential (RtcCommand cmd, bool keep_going, std::optional< unsigned > timeout=std::nullopt)
 Runs specified command on each object in sequence and waits for completion or error.
 
std::map< std::string, std::string > RunParallel (RtcCommand cmd, std::optional< unsigned > timeout=std::nullopt)
 Runs specified command on each object in parallel and waits for completion or error.
 

Protected Attributes

log4cplus::Logger & m_logger
 
std::vector< std::unique_ptr< RtcObjectIf > > & m_objects
 reference to lists of objects
 
std::mutex m_command_mutex
 

Detailed Description

Class used to control multiple RtcObjects.

It can perform sequential and parallel operations on a list of RtcObjects

Note, the class is not the owner of said RtcObjects.

Constructor & Destructor Documentation

◆ RtcObjectController() [1/2]

rtctk::rtcSupervisor::RtcObjectController::RtcObjectController ( )
delete

◆ RtcObjectController() [2/2]

rtctk::rtcSupervisor::RtcObjectController::RtcObjectController ( std::vector< std::unique_ptr< RtcObjectIf > > & objects)
explicit

◆ ~RtcObjectController()

virtual rtctk::rtcSupervisor::RtcObjectController::~RtcObjectController ( )
virtualdefault

Member Function Documentation

◆ RunParallel()

std::map< std::string, std::string > rtctk::rtcSupervisor::RtcObjectController::RunParallel ( RtcCommand cmd,
std::optional< unsigned > timeout = std::nullopt )

Runs specified command on each object in parallel and waits for completion or error.

Run a command on the list of object in parallel. We wait for all commands and gather the names of any component which causes an error. At the end we throw an exception if any component caused an error.

Note, this method keeps going on failure by default.

Parameters
cmdThe command to send to each object.
timeoutCommand timeout in seconds.
Returns
map of returned strings for each object
Exceptions
CommandFailedException

launch the commands on all objects in parallel

wait for completion

At the end if any error occurred then CII_THROW

◆ RunSequential()

std::map< std::string, std::string > rtctk::rtcSupervisor::RtcObjectController::RunSequential ( RtcCommand cmd,
bool keep_going,
std::optional< unsigned > timeout = std::nullopt )

Runs specified command on each object in sequence and waits for completion or error.

Run a command on the list of object sequentially. Throw an exception if any of the calls fail unless the keep_going flag is set.

If keep_going is set, then continue to the end and throw at the end with the list of components which caused errors

Parameters
cmdThe command to send to each object.
keep_goingKeep going on failure, otherwise abort on first failure.
timeoutCommand timeout in seconds.
Returns
map of returned strings for each object
Exceptions
CommandFailedException

At the end if any error occurred then CII_THROW

Member Data Documentation

◆ m_command_mutex

std::mutex rtctk::rtcSupervisor::RtcObjectController::m_command_mutex
protected

◆ m_logger

log4cplus::Logger& rtctk::rtcSupervisor::RtcObjectController::m_logger
protected

◆ m_objects

std::vector<std::unique_ptr<RtcObjectIf> >& rtctk::rtcSupervisor::RtcObjectController::m_objects
protected

reference to lists of objects


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