orocos_cpp
Classes | Public Member Functions | Static Public Member Functions | List of all members
orocos_cpp::Spawner Class Reference

#include <Spawner.hpp>

Inheritance diagram for orocos_cpp::Spawner:

Classes

class  ProcessHandle
 

Public Member Functions

ProcessHandlespawnTask (const std::string &cmp1, const std::string &as=std::string(), bool redirectOutput=true)
 
ProcessHandlespawnDeployment (const std::string &dplName, bool redirectOutput=true)
 
ProcessHandlespawnDeployment (Deployment *deployment, bool redirectOutput=true)
 
bool checkAllProcesses ()
 
bool allReady ()
 
void waitUntilAllReady (const base::Time &timeout)
 
void killAll ()
 
void sendSigTerm ()
 
std::vector< const Deployment * > getRunningDeployments ()
 
bool isRunning (const Deployment *instance)
 
void setLogDirectory (const std::string &log_folder)
 

Static Public Member Functions

static SpawnergetInstace ()
 

Member Function Documentation

◆ allReady()

bool Spawner::allReady ( )

This method checks if all spawned tasks registered at the nameservice.

◆ checkAllProcesses()

bool Spawner::checkAllProcesses ( )

This method checks if all spawened processes are still alive

Returns
false if any process died

◆ getInstace()

Spawner & Spawner::getInstace ( )
static

Singleton pattern, returns the ONE instance of the spawner.

◆ getRunningDeployments()

std::vector< const Deployment *> Spawner::getRunningDeployments ( )

Returns a vector of all deployments, that are currently running.

◆ isRunning()

bool Spawner::isRunning ( const Deployment instance)

Returns, if the given instance of a deployment is running.

◆ killAll()

void Spawner::killAll ( )

This method first sends a sigterm to all processes and waits for the processes to terminate. If this did not happen, it will send a sigkill and return.

◆ sendSigTerm()

void Spawner::sendSigTerm ( )

This method sends a sigterm to all child processes.

◆ setLogDirectory()

void Spawner::setLogDirectory ( const std::string &  log_folder)

Sets the default log directory. If no log directory is set it will be determined using bundles.

◆ spawnDeployment() [1/2]

Spawner::ProcessHandle & Spawner::spawnDeployment ( const std::string &  dplName,
bool  redirectOutput = true 
)

This method spawns a process that executes the deployment with the given name. This method will throw if any error occures.

  • dplName Name of the deployment executable that should be started
    Returns
    A Process handle, which may be used to request the process status

◆ spawnDeployment() [2/2]

Spawner::ProcessHandle & Spawner::spawnDeployment ( Deployment deployment,
bool  redirectOutput = true 
)

This method spawns a process that executes the given deployment. This method will throw if any error occures.

  • dplName The deployment that should be started. The ownership of the deployment will be taken over by the spawner.
    Returns
    A Process handle, which may be used to request the process status

◆ spawnTask()

Spawner::ProcessHandle & Spawner::spawnTask ( const std::string &  cmp1,
const std::string &  as = std::string(),
bool  redirectOutput = true 
)

This method spawns a default deployment matching the given componente description. If a second argument is given, the task will be renamed to the given name. The method will throw if any error occures.

  • cmp1 The task model name e.g Hokuyo::Task
  • as The name unter wich the taskmodel should be registered a the nameservice
    Returns
    A Process handle, which may be used to request the process status

◆ waitUntilAllReady()

void Spawner::waitUntilAllReady ( const base::Time &  timeout)

Waits up to the given timeout for all tasks, to be connectable via the nameservice. Will throw an runtime error if not all tasks could be reached.


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