OpenRTM-aist 2.1.0
|
#include <Manager.h>
Classes | |
struct | ECFactoryPredicate |
class | FactoryPredicate |
struct | Finalized |
struct | InstanceName |
struct | ModuleFactories |
class | ModulePredicate |
Public Types | |
using | TaskId = coil::Timer< coil::PeriodicFunction >::TaskId |
Public Member Functions | |
void | join () |
Wait for Manager's termination. | |
LogStreamBuf & | getLogStreamBuf () |
Get the log buffer. | |
std::string & | getLogLevel () |
Get the log level of the configuration. | |
coil::Properties & | getConfig () |
Get the manager configuration. | |
void | setModuleInitProc (ModuleInitProc proc) |
Set initial procedure. | |
bool | activateManager () |
Activate the Manager. | |
void | runManager (bool no_block=false) |
Run the Manager. | |
TaskId | addTask (std::function< void(void)> fn, std::chrono::nanoseconds period) |
Add a task to the Manager timer. | |
void | invoke (std::function< void(void)> fn, std::chrono::nanoseconds delay=std::chrono::seconds::zero()) |
Run a function on the Manager main thread. | |
ReturnCode_t | load (const std::string &fname, const std::string &initfunc) |
[CORBA interface] Load module | |
ReturnCode_t | load (coil::Properties &prop, const std::string &initfunc) |
[CORBA interface] Load module | |
void | unload (const char *fname) |
Unload module. | |
void | unloadAll () |
Unload all modules. | |
std::vector< coil::Properties > | getLoadedModules () |
Get a list of loaded modules. | |
std::vector< coil::Properties > | getLoadableModules () |
Get a list of loadable modules. | |
bool | registerFactory (coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func) |
Register RT-Component Factory. | |
std::vector< coil::Properties > | getFactoryProfiles () |
Get profiles of factories. | |
bool | registerECFactory (const char *name, ECNewFunc new_func, ECDeleteFunc delete_func) |
Register ExecutionContext Factory. | |
std::vector< std::string > | getModulesFactories () |
Get the list of all Factories. | |
RTObject_impl * | createComponent (const char *comp_args) |
Create RT-Components. | |
ExecutionContextBase * | createContext (const char *ec_args) |
Create Context. | |
void | cleanupComponent (RTObject_impl *comp) |
Unregister RT-Components. | |
void | cleanupComponents () |
This method deletes RT-Components. | |
void | notifyFinalized (RTObject_impl *comp) |
This method deletes RT-Components. | |
bool | registerComponent (RTObject_impl *comp) |
Register RT-Component directly without Factory. | |
bool | unregisterComponent (RTObject_impl *comp) |
Unregister RT-Components. | |
void | deleteComponent (RTObject_impl *comp) |
Unregister RT-Components that have been registered to Manager. | |
void | deleteComponent (const char *instance_name) |
Unregister RT-Components that have been registered to Manager. | |
RTObject_impl * | getComponent (const char *instance_name) |
Get RT-Component's pointer. | |
std::vector< RTObject_impl * > | getComponents () |
Get all RT-Components registered in the Manager. | |
void | addManagerActionListener (RTM::ManagerActionListener *listener, bool autoclean=true) |
void | removeManagerActionListener (RTM::ManagerActionListener *listener) |
void | addModuleActionListener (RTM::ModuleActionListener *listener, bool autoclean=true) |
void | removeModuleActionListener (RTM::ModuleActionListener *listener) |
void | addRtcLifecycleActionListener (RTM::RtcLifecycleActionListener *listener, bool autoclean=true) |
void | removeRtcLifecycleActionListener (RTM::RtcLifecycleActionListener *listener) |
void | addNamingActionListener (RTM::NamingActionListener *listener, bool autoclean=true) |
void | removeNamingActionListener (RTM::NamingActionListener *listener) |
void | addLocalServiceActionListener (RTM::LocalServiceActionListener *listener, bool autoclean=true) |
void | removeLocalServiceActionListener (RTM::LocalServiceActionListener *listener) |
CORBA::ORB_ptr | theORB () |
Get the pointer to ORB (ownership retained) | |
CORBA::ORB_ptr | getORB () |
Get the pointer to ORB (ownership duplicated) | |
PortableServer::POA_ptr | thePOA () |
Get a pointer to RootPOA held by Manager. | |
PortableServer::POA_ptr | getPOA () |
Get a pointer to RootPOA held by Manager. | |
PortableServer::POAManager_ptr | thePOAManager () |
Get POAManager that Manager has (ownership retained) | |
PortableServer::POAManager_ptr | getPOAManager () |
Get POAManager that Manager has (ownership duplicated) | |
RTM::ManagerServant & | getManagerServant () |
Getting ManagerServant. | |
bool | initLocalService () |
LocalService initialization. | |
NamingManager * | getNaming () |
Getting NamingManager. | |
Static Public Member Functions | |
static Manager * | init (int argc, char **argv) |
Initialize manager. | |
static Manager & | instance () |
Get instance of the manager. | |
static void | terminate () |
Terminate manager. | |
static void | removeTask (TaskId id) |
Remove the task from the Manager timer. | |
Protected Types | |
using | ComponentManager = ObjectManager< std::string, RTObject_impl, InstanceName > |
using | FactoryManager = ObjectManager< const coil::Properties, FactoryBase, FactoryPredicate > |
ComponentFactory . | |
using | ECFactoryManager = ObjectManager< const char *, ECFactoryBase, ECFactoryPredicate > |
Protected Member Functions | |
Manager () | |
Protected Constructor. | |
Manager (const Manager &)=delete | |
Manager & | operator= (const Manager &)=delete |
void | initManager (int argc, char **argv) |
Manager internal initialization. | |
void | shutdown () |
Shutdown Manager. | |
void | mainThread () |
The main function of Manager main thread. . | |
void | initLogstreamFile () |
void | initLogstreamPlugins () |
void | initLogstreamOthers () |
bool | initLogger () |
System logger initialization. | |
void | shutdownLogger () |
System Logger finalization. | |
void | shutdownManagerServant () |
Manager Servant finalization. | |
bool | initORB () |
CORBA ORB initialization. | |
std::string | createORBOptions () |
Create ORB command options. | |
void | createORBEndpoints (coil::vstring &endpoints) |
Create Endpoints. | |
void | createORBEndpointOption (std::string &opt, coil::vstring endpoints) |
Create a command optional line of Endpoint of ORB. | |
void | shutdownORB () |
ORB finalization. | |
bool | initNaming () |
NamingManager initialization. | |
void | shutdownNaming () |
NamingManager finalization. | |
NamingManager & | getNamingManager () |
Getting NamingManager. | |
void | shutdownComponents () |
NamingManager finalization. | |
bool | procComponentArgs (const char *comp_arg, coil::Properties &comp_id, coil::Properties &comp_conf) |
Extracting component type/properties from the given string. | |
bool | procContextArgs (const char *ec_args, std::string &ec_id, coil::Properties &ec_conf) |
Extracting ExecutionContext's name/properties from the given string. | |
void | configureComponent (RTObject_impl *comp, const coil::Properties &prop) |
Configure RT-Component. | |
bool | initExecContext () |
ExecutionContextManager initialization. | |
bool | initComposite () |
PeriodicECSharedComposite initialization. | |
bool | initFactories () |
Factories initialization. | |
void | initCpuAffinity () |
void | initPreConnection () |
void | initPreActivation () |
void | initPreCreation () |
void | invokeInitProc () |
void | publishPorts (RTObject_impl *comp) |
void | subscribePorts (RTObject_impl *comp) |
PortServiceList * | getPortsOnNameServers (const std::string &nsname, const std::string &kind) |
void | connectDataPorts (PortService_ptr port, PortServiceList_var &target_ports) |
void | connectServicePorts (PortService_ptr port, PortServiceList_var &target_ports) |
bool | initManagerServant () |
ManagerServant initialization. | |
bool | mergeProperty (coil::Properties &prop, const char *file_name) |
Merge property information. | |
std::string | formatString (const char *naming_format, coil::Properties &prop) |
Construct registration information when registering to Naming server. | |
void | setEndpointProperty (CORBA::Object_ptr objref) |
Setting endpoint info from corba.endpoints . | |
void | endpointPropertySwitch (const std::string &ipver, bool &ip, std::vector< int > &ip_list) |
Getting option info from corba.endpoint_property . | |
Static Protected Member Functions | |
static bool | isORBEndPoint (const std::string &endpoint) |
Protected Attributes | |
RTM::ManagerServant * | m_mgrservant {nullptr} |
The pointer to the ManagerServant . | |
CORBA::ORB_var | m_pORB |
The pointer to the ORB . | |
PortableServer::POA_var | m_pPOA |
The pointer to the POA . | |
PortableServer::POAManager_var | m_pPOAManager |
The pointer to the POAManager . | |
coil::Argv | m_argv |
The argument of ORB_init . | |
int | m_argvSize |
The argument of ORB_init . | |
ModuleInitProc | m_initProc {nullptr} |
User's initialization function's pointer . | |
coil::Properties | m_config |
Managaer's configuration Properties . | |
ModuleManager * | m_module {nullptr} |
The pointer to the ModuleManager . | |
NamingManager * | m_namingManager {nullptr} |
The pointer to the NamingManager . | |
coil::Timer< coil::DelayedFunction > | m_invoker |
Timer Object for delay call on the Manager thread . | |
coil::Timer< coil::PeriodicFunction > | m_scheduler |
Timer Object for delay call on the Manager thread . | |
std::thread | m_threadOrb |
ORB thread. . | |
std::thread | m_threadMain |
Manager main thread. . | |
std::list< coil::SignalAction > | m_signals |
An array for signals management . | |
bool | m_needsTimer {false} |
A flag that Manager use Timer or not. . | |
LogStreamBuf | m_logStreamBuf |
Logger buffer . | |
Logger | rtclog {&m_logStreamBuf} |
Logger stream . | |
std::vector< std::filebuf * > | m_logfiles |
Files for log output . | |
ComponentManager | m_compManager |
ComponentManager . | |
FactoryManager | m_factory |
ComponentManager . | |
ECFactoryManager | m_ecfactory |
ExecutionContext Manager . | |
std::vector< ExecutionContextBase * > | m_ecs |
ExecutionContext list . | |
Finalized | m_finalized |
::RTM::ManagerActionListeners | m_listeners |
Static Protected Attributes | |
static Manager * | manager |
The pointer to the Manager . | |
static std::mutex | mutex |
The mutex of the pointer to the Manager . | |
static std::atomic_flag | m_isRunning |
A flag to stop the main thread. . | |
Manager class.
This is a manager class that manages various information such as components.
|
protected |
|
protected |
|
protected |
ComponentFactory .
using RTC::Manager::TaskId = coil::Timer<coil::PeriodicFunction>::TaskId |
|
protected |
Protected Constructor.
|
protecteddelete |
bool RTC::Manager::activateManager | ( | ) |
Activate the Manager.
This operation do the following:
This operation should be invoked after Manager:init(), and before runManager().
void RTC::Manager::addLocalServiceActionListener | ( | RTM::LocalServiceActionListener * | listener, |
bool | autoclean = true |
||
) |
void RTC::Manager::addManagerActionListener | ( | RTM::ManagerActionListener * | listener, |
bool | autoclean = true |
||
) |
void RTC::Manager::addModuleActionListener | ( | RTM::ModuleActionListener * | listener, |
bool | autoclean = true |
||
) |
void RTC::Manager::addNamingActionListener | ( | RTM::NamingActionListener * | listener, |
bool | autoclean = true |
||
) |
void RTC::Manager::addRtcLifecycleActionListener | ( | RTM::RtcLifecycleActionListener * | listener, |
bool | autoclean = true |
||
) |
TaskId RTC::Manager::addTask | ( | std::function< void(void)> | fn, |
std::chrono::nanoseconds | period | ||
) |
Add a task to the Manager timer.
This operation add a function or functional object to Manger's timer. It run until removeTask(). DO NOT block (Ex. sleep) in the registerd function.
fn | The Function run periodically. |
period | Period of fn execution. |
void RTC::Manager::cleanupComponent | ( | RTObject_impl * | comp | ) |
Unregister RT-Components.
void RTC::Manager::cleanupComponents | ( | ) |
This method deletes RT-Components.
|
protected |
Configure RT-Component.
|
protected |
|
protected |
RTObject_impl * RTC::Manager::createComponent | ( | const char * | comp_args | ) |
Create RT-Components.
ExecutionContextBase * RTC::Manager::createContext | ( | const char * | ec_args | ) |
Create Context.
|
protected |
Create a command optional line of Endpoint of ORB.
|
protected |
Create Endpoints.
|
protected |
Create ORB command options.
void RTC::Manager::deleteComponent | ( | const char * | instance_name | ) |
Unregister RT-Components that have been registered to Manager.
void RTC::Manager::deleteComponent | ( | RTObject_impl * | comp | ) |
Unregister RT-Components that have been registered to Manager.
|
protected |
Getting option info from corba.endpoint_property .
|
protected |
Construct registration information when registering to Naming server.
RTObject_impl * RTC::Manager::getComponent | ( | const char * | instance_name | ) |
Get RT-Component's pointer.
std::vector< RTObject_impl * > RTC::Manager::getComponents | ( | ) |
Get all RT-Components registered in the Manager.
|
inline |
Get the manager configuration.
References m_config.
std::vector< coil::Properties > RTC::Manager::getFactoryProfiles | ( | ) |
Get profiles of factories.
std::vector< coil::Properties > RTC::Manager::getLoadableModules | ( | ) |
Get a list of loadable modules.
std::vector< coil::Properties > RTC::Manager::getLoadedModules | ( | ) |
Get a list of loaded modules.
|
inline |
Get the log level of the configuration.
References m_config.
|
inline |
Get the log buffer.
References m_logStreamBuf.
RTM::ManagerServant & RTC::Manager::getManagerServant | ( | ) |
Getting ManagerServant.
std::vector< std::string > RTC::Manager::getModulesFactories | ( | ) |
Get the list of all Factories.
NamingManager * RTC::Manager::getNaming | ( | ) |
Getting NamingManager.
|
protected |
Getting NamingManager.
CORBA::ORB_ptr RTC::Manager::getORB | ( | ) |
Get the pointer to ORB (ownership duplicated)
Referenced by CORBA_SeqUtil::refToVstring().
PortableServer::POA_ptr RTC::Manager::getPOA | ( | ) |
Get a pointer to RootPOA held by Manager.
PortableServer::POAManager_ptr RTC::Manager::getPOAManager | ( | ) |
Get POAManager that Manager has (ownership duplicated)
|
protected |
|
static |
Initialize manager.
|
protected |
PeriodicECSharedComposite initialization.
|
protected |
|
protected |
ExecutionContextManager initialization.
|
protected |
Factories initialization.
bool RTC::Manager::initLocalService | ( | ) |
LocalService initialization.
|
protected |
System logger initialization.
|
protected |
|
protected |
|
protected |
|
protected |
Manager internal initialization.
|
protected |
ManagerServant initialization.
|
protected |
NamingManager initialization.
|
protected |
CORBA ORB initialization.
|
protected |
|
protected |
|
protected |
|
static |
Get instance of the manager.
This is the static member function to get the instance of the Manager. Before calling this function, ensure that the initialization function "init()" is called.
Referenced by CORBA_SeqUtil::refToVstring().
void RTC::Manager::invoke | ( | std::function< void(void)> | fn, |
std::chrono::nanoseconds | delay = std::chrono::seconds::zero() |
||
) |
|
protected |
|
staticprotected |
void RTC::Manager::join | ( | ) |
Wait for Manager's termination.
ReturnCode_t RTC::Manager::load | ( | coil::Properties & | prop, |
const std::string & | initfunc | ||
) |
[CORBA interface] Load module
Load specified module (shared library, DLL etc..), and invoke initialize function.
prop | module_file_name: module file name module_file_path: module file path language: programming language |
initfunc | The initialize function name |
ReturnCode_t RTC::Manager::load | ( | const std::string & | fname, |
const std::string & | initfunc | ||
) |
[CORBA interface] Load module
Load specified module (shared library, DLL etc..), and invoke initialize function.
fname | The module file name |
initfunc | The initialize function name |
|
protected |
The main function of Manager main thread. .
|
protected |
Merge property information.
void RTC::Manager::notifyFinalized | ( | RTObject_impl * | comp | ) |
This method deletes RT-Components.
|
protected |
Extracting component type/properties from the given string.
|
protected |
Extracting ExecutionContext's name/properties from the given string.
|
protected |
bool RTC::Manager::registerComponent | ( | RTObject_impl * | comp | ) |
Register RT-Component directly without Factory.
bool RTC::Manager::registerECFactory | ( | const char * | name, |
ECNewFunc | new_func, | ||
ECDeleteFunc | delete_func | ||
) |
Register ExecutionContext Factory.
bool RTC::Manager::registerFactory | ( | coil::Properties & | profile, |
RtcNewFunc | new_func, | ||
RtcDeleteFunc | delete_func | ||
) |
Register RT-Component Factory.
void RTC::Manager::removeLocalServiceActionListener | ( | RTM::LocalServiceActionListener * | listener | ) |
void RTC::Manager::removeManagerActionListener | ( | RTM::ManagerActionListener * | listener | ) |
void RTC::Manager::removeModuleActionListener | ( | RTM::ModuleActionListener * | listener | ) |
void RTC::Manager::removeNamingActionListener | ( | RTM::NamingActionListener * | listener | ) |
void RTC::Manager::removeRtcLifecycleActionListener | ( | RTM::RtcLifecycleActionListener * | listener | ) |
|
inlinestatic |
Remove the task from the Manager timer.
This operation remove the specify function.
id | Task ID |
void RTC::Manager::runManager | ( | bool | no_block = false | ) |
Run the Manager.
This operation processes the main event loop of the Manager. In this main loop, periodic task and etc. are performed. This operation also start CORBA's ORB event loop. As the default behavior, this operation is going to blocking mode and never returns until Manager::terminate() is called. When the given argument "no_block" is set to "true", this operation creates a thread to process the event loop internally, and it doesn't block and returns.
no_block | false: Blocking mode, true: non-blocking mode. |
|
protected |
Setting endpoint info from corba.endpoints .
void RTC::Manager::setModuleInitProc | ( | ModuleInitProc | proc | ) |
Set initial procedure.
This operation sets the initial procedure call to process module initialization, other user defined initialization and so on. The given procedure will be called at the proper timing after the manager initialization, activation and run.
proc | A function pointer to the initial procedure call |
|
protected |
Shutdown Manager.
|
protected |
NamingManager finalization.
|
protected |
System Logger finalization.
|
protected |
Manager Servant finalization.
|
protected |
NamingManager finalization.
|
protected |
ORB finalization.
|
protected |
|
static |
Terminate manager.
CORBA::ORB_ptr RTC::Manager::theORB | ( | ) |
Get the pointer to ORB (ownership retained)
PortableServer::POA_ptr RTC::Manager::thePOA | ( | ) |
Get a pointer to RootPOA held by Manager.
PortableServer::POAManager_ptr RTC::Manager::thePOAManager | ( | ) |
Get POAManager that Manager has (ownership retained)
void RTC::Manager::unload | ( | const char * | fname | ) |
Unload module.
Unload module.
fname | The module file name |
void RTC::Manager::unloadAll | ( | ) |
Unload all modules.
Unload all modules.
bool RTC::Manager::unregisterComponent | ( | RTObject_impl * | comp | ) |
Unregister RT-Components.
|
protected |
The argument of ORB_init .
|
protected |
The argument of ORB_init .
|
protected |
ComponentManager .
|
protected |
Managaer's configuration Properties .
Referenced by getConfig(), and getLogLevel().
|
protected |
ExecutionContext Manager .
|
protected |
ExecutionContext list .
|
protected |
ComponentManager .
|
protected |
|
protected |
User's initialization function's pointer .
|
protected |
Timer Object for delay call on the Manager thread .
|
staticprotected |
A flag to stop the main thread. .
|
protected |
|
protected |
Files for log output .
|
protected |
Logger buffer .
Referenced by getLogStreamBuf().
|
protected |
The pointer to the ManagerServant .
|
protected |
The pointer to the ModuleManager .
|
protected |
The pointer to the NamingManager .
|
protected |
A flag that Manager use Timer or not. .
|
protected |
The pointer to the ORB .
|
protected |
The pointer to the POA .
|
protected |
The pointer to the POAManager .
|
protected |
Timer Object for delay call on the Manager thread .
|
protected |
An array for signals management .
|
protected |
Manager main thread. .
|
protected |
ORB thread. .
|
staticprotected |
The mutex of the pointer to the Manager .
|
protected |
Logger stream .