RTC::Manager Class Reference

Manager class. More...

#include <Manager.h>

List of all members.

Classes

struct  ECFactoryPredicate
class  FactoryPredicate
struct  Finalized
struct  InstanceName
struct  ModuleFactories
class  ModulePredicate
class  OrbRunner
 OrbRunner class. More...
struct  Term
class  Terminator
 Terminator class. More...

Public Member Functions

void terminate ()
 Terminate manager.
void shutdown ()
 Shutdown Manager.
void join ()
 Wait for Manager's termination.
LogStreamBufgetLogStreamBuf ()
 Get the log buffer.
std::string & getLogLevel ()
 Get the log level of the configuration.
coil::PropertiesgetConfig ()
 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.
void load (const char *fname, const char *initfunc)
 [CORBA interface] Load module
void unload (const char *fname)
 Unload module.
void unloadAll ()
std::vector< coil::PropertiesgetLoadedModules ()
 Get a list of loaded modules.
std::vector< coil::PropertiesgetLoadableModules ()
 Get a list of loadable modules.
bool registerFactory (coil::Properties &profile, RtcNewFunc new_func, RtcDeleteFunc delete_func)
 Register RT-Component Factory.
std::vector< coil::PropertiesgetFactoryProfiles ()
 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_implcreateComponent (const char *comp_args)
 Create RT-Components.
ExecutionContextBasecreateContext (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_implgetComponent (const char *instance_name)
 Get RT-Component's pointer.
std::vector< RTObject_impl * > getComponents ()
 Get all RT-Components registered in the Manager.
CORBA::ORB_ptr getORB ()
 Get the pointer to ORB.
PortableServer::POA_ptr getPOA ()
 Get a pointer to RootPOA held by Manager.
PortableServer::POAManager_ptr getPOAManager ()
 Get POAManager that Manager has.

Static Public Member Functions

static Managerinit (int argc, char **argv)
 Initialize manager.
static Managerinstance ()
 Get instance of the manager.

Protected Types

typedef ObjectManager
< std::string, RTObject_impl,
InstanceName
ComponentManager
typedef ObjectManager< const
coil::Properties, FactoryBase,
FactoryPredicate
FactoryManager
 ComponentFactory.
typedef ObjectManager< const
char *, ECFactoryBase,
ECFactoryPredicate
ECFactoryManager

Protected Member Functions

 Manager ()
 Protected Constructor.
 Manager (const Manager &manager)
 Protected Copy Constructor.
void initManager (int argc, char **argv)
 Manager internal initialization.
void shutdownManager ()
 Shutdown Manager.
void shutdownOnNoRtcs ()
 Shutdown Manager.
bool initLogger ()
 System logger initialization.
void shutdownLogger ()
 System Logger 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 &endpoint)
 Create a command optional line of Endpoint of ORB.
void shutdownORB ()
 ORB finalization.
bool initNaming ()
 NamingManager initialization.
void shutdownNaming ()
 NamingManager finalization.
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.
bool initTimer ()
 Timer initialization.
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.

Protected Attributes

RTM::ManagerServantm_mgrservant
 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.
ModuleInitProc m_initProc
 User's initialization function's pointer.
coil::Properties m_config
 Managaer's configuration Properties.
ModuleManagerm_module
 The pointer to the ModuleManager.
NamingManagerm_namingManager
 The pointer to the NamingManager.
coil::Timerm_timer
 Timer Object.
LogStreamBuf m_logStreamBuf
 Logger buffer.
Logger rtclog
 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.
OrbRunnerm_runner
 The pointer to ORB helper class.
Terminatorm_terminator
 The pointer to ORB termination helper class.
Term m_terminate
 Synchronous flag for manager termination.
Finalized m_finalized

Static Protected Attributes

static Managermanager
 The pointer to the Manager.
static Mutex mutex
 The mutex of the pointer to the Manager.

Detailed Description

Manager class.

This is a manager class that manages various information such as components.

Since:
0.2.0

Member Typedef Documentation

ComponentFactory.


Constructor & Destructor Documentation

RTC::Manager::Manager (  )  [protected]

Protected Constructor.

Protected Constructor

RTC::Manager::Manager ( const Manager manager  )  [protected]

Protected Copy Constructor.

Protected Copy Constructor

Parameters:
manager Manager object of copy source

Member Function Documentation

bool RTC::Manager::activateManager (  ) 

Activate the Manager.

This operation do the following:

  • Activate CORBA POAManager
  • Activate Manager CORBA object
  • Bind object reference of the Manager to the nameserver

This operation should be invoked after Manager:init(), and before runManager().

Returns:
Activation result (Successful:true, Failed:false)
void RTC::Manager::cleanupComponent ( RTObject_impl comp  ) 

Unregister RT-Components.

Unregister specified RT-Component's instances from naming service.

Parameters:
comp Target RT-Components for the unregistration
void RTC::Manager::cleanupComponents (  ) 

This method deletes RT-Components.

This method deletes RT-Components registered by notifyFinalized().

void RTC::Manager::configureComponent ( RTObject_impl comp,
const coil::Properties prop 
) [protected]

Configure RT-Component.

Read property files described each RT-Component's type and instance, and configure it to the component. Also, get each component's registered name when registering to NamingService and configure it.

Parameters:
comp Target RT-Component for the configuration
RTObject_impl* RTC::Manager::createComponent ( const char *  comp_args  ) 

Create RT-Components.

Create specified RT-Component's instances via registered Factory. When its instances have been created successfully, the following processings are also executed.

  • Read and set configuration information that was set by external file.
  • Bind ExecutionContext and start operation.
  • Register to naming service.
Parameters:
module_name Target RT-Component names for the creation
Returns:
Created RT-Component's instances
ExecutionContextBase* RTC::Manager::createContext ( const char *  ec_args  ) 

Create Context.

Returns:
Created Context's instances
void RTC::Manager::createORBEndpointOption ( std::string &  opt,
coil::vstring endpoint 
) [protected]

Create a command optional line of Endpoint of ORB.

Parameters:
opt ORB options
endpoint Endpoints list
void RTC::Manager::createORBEndpoints ( coil::vstring endpoints  )  [protected]

Create Endpoints.

Create Endpoints from the configuration.

Parameters:
endpoints Endpoints list
std::string RTC::Manager::createORBOptions (  )  [protected]

Create ORB command options.

Create ORB launch options from configuration information that has been set.

Returns:
ORB launch options
void RTC::Manager::deleteComponent ( const char *  instance_name  ) 

Unregister RT-Components that have been registered to Manager.

Unregister RT-Components that have been registered to manager Remove specified RT-Component from naming service, terminate itself and release its instances.

Parameters:
instance_name Target RT-Component's instances for the unregistration
void RTC::Manager::deleteComponent ( RTObject_impl comp  ) 

Unregister RT-Components that have been registered to Manager.

Unregister RT-Components that have been registered to manager Remove specified RT-Component from naming service, terminate itself and release its instances.

Parameters:
comp Target RT-Component's instances for the unregistration
std::string RTC::Manager::formatString ( const char *  naming_format,
coil::Properties prop 
) [protected]

Construct registration information when registering to Naming server.

Construct information when registering to NameServer based on specified format and property information. Each format specification character means as follows:

  • % : Break of Context
  • n : Instance's name
  • t : Type name
  • m : Type name
  • v : Version
  • V : Vender
  • c : Category
  • h : Host name
  • M : Manager name
  • p : Process ID
Parameters:
naming_format Format specification for NamingService registration
prop Property information that is used
Returns:
Specification format conversion result
RTObject_impl* RTC::Manager::getComponent ( const char *  instance_name  ) 

Get RT-Component's pointer.

Search RT-Component that has been registered to Manager by its specified name, and get it that matches.

Parameters:
instance_name Target RT-Component's name for searching
Returns:
Target RT-Component's instances that matches
std::vector<RTObject_impl*> RTC::Manager::getComponents (  ) 

Get all RT-Components registered in the Manager.

Get all RT-Component's instances that have been registered to Manager.

Returns:
List of all RT-Component's instances
coil::Properties& RTC::Manager::getConfig (  )  [inline]

Get the manager configuration.

Get the manager configuration that has been set to manager.

Returns:
Manager's configuration

References m_config.

std::vector<coil::Properties> RTC::Manager::getFactoryProfiles (  ) 

Get profiles of factories.

Get profiles of factories.

Returns:
profiles of factories
std::vector<coil::Properties> RTC::Manager::getLoadableModules (  ) 

Get a list of loadable modules.

Get loadable module list. (Currently, unimplemented on ModuleManager side)

Returns:
Loadable module list
std::vector<coil::Properties> RTC::Manager::getLoadedModules (  ) 

Get a list of loaded modules.

Get module list that is currently loaded into manager.

Returns:
Module list that has been loaded.
std::string& RTC::Manager::getLogLevel (  )  [inline]

Get the log level of the configuration.

Get the log level of the configuration.

Returns:
Log level of Manager's configuration

References m_config.

LogStreamBuf& RTC::Manager::getLogStreamBuf (  )  [inline]

Get the log buffer.

Get the log buffer that has been set to manager.

Returns:
Log buffer to set to manager

References m_logStreamBuf.

std::vector<std::string> RTC::Manager::getModulesFactories (  ) 

Get the list of all Factories.

Get the list of all factories that have been registered.

Returns:
Registered factory list
CORBA::ORB_ptr RTC::Manager::getORB (  ) 

Get the pointer to ORB.

Get the pointer to ORB that has been set to Manager.

Returns:
ORB object
PortableServer::POA_ptr RTC::Manager::getPOA (  ) 

Get a pointer to RootPOA held by Manager.

Get the pointer to RootPOA that has been set to Manager.

Returns:
RootPOA object
PortableServer::POAManager_ptr RTC::Manager::getPOAManager (  ) 

Get POAManager that Manager has.

Get POAMAnager that has been set to Manager.

Returns:
POA manager
static Manager* RTC::Manager::init ( int  argc,
char **  argv 
) [static]

Initialize manager.

This is the static member function to initialize the Manager. The Manager is initialized by given commandline arguments. To use the manager, this initialization member function init() must be called. The manager has two static functions to get the instance such as init() and instance(). Since initializing process is only performed by the init() function, the init() has to be called at the beginning of the lifecycle of the Manager.

*Initialization of manager

  • initManager: Argument processing, reading config file, initialization of subsystem
  • initLogger: Initialization of Logger
  • initORB: Initialization of ORB
  • initNaming: Initialization of NamingService
  • initExecutionContext: Initialization of ExecutionContext factory
  • initTimer: Initialization of Timer
Parameters:
argc The number of command line arguments.
argv The array of the command line arguments.
Returns:
Reference of the unique instance of Manager
bool RTC::Manager::initComposite (  )  [protected]

PeriodicECSharedComposite initialization.

Returns:
PeriodicECSharedComposite initialization result (Successful:true, Failed:false)
bool RTC::Manager::initExecContext (  )  [protected]

ExecutionContextManager initialization.

Initialize each ExecutionContext that is used, and register each ExecutionContext creation Factory to ExecutionContextManager.

Returns:
ExecutionContextManager initialization result (Successful:true, Failed:false)
bool RTC::Manager::initFactories (  )  [protected]

Factories initialization.

Initialize buffer factories, thread factories, publisher factories, provider factories, and consumer factories.

Returns:
PeriodicECSharedComposite initialization result (Successful:true, Failed:false)
bool RTC::Manager::initLogger (  )  [protected]

System logger initialization.

Initialize System logger. Initialize logger and set it according to the set information in configuration file,

Returns:
Initialization result (Successful:true, Failed:false)
void RTC::Manager::initManager ( int  argc,
char **  argv 
) [protected]

Manager internal initialization.

Execute Manager's internal initialization processing.

  • Set Manager configuration
  • Set log output file
  • Create termination processing thread
  • Create timer thread (when using timer)
Parameters:
argc Number of commandline arguments
argv Commandline arguments
bool RTC::Manager::initManagerServant (  )  [protected]

ManagerServant initialization.

Returns:
Timer Initialization result (Successful:true, Failed:false)
bool RTC::Manager::initNaming (  )  [protected]

NamingManager initialization.

Initialize NamingManager . However, operate nothing, if it is set to property that NamingManager is not used. Register default NamingServer that is set to property information, when NamingManager is used. Also, launch a timer that updates information automatically at specified cycle and register the method for the update to the timer, when it is set to update it reguraly.

Returns:
Initialization result (Successful:true, Failed:false)
bool RTC::Manager::initORB (  )  [protected]

CORBA ORB initialization.

Initialize ORB based on the configuration given by arguments.

Returns:
ORB initialization result (Successful:true, Failed:false)
bool RTC::Manager::initTimer (  )  [protected]

Timer initialization.

Initialize each Timer that is used. (In current implementation, nothing is done.)

Returns:
Timer Initialization result (Successful:true, Failed:false)
static Manager& RTC::Manager::instance (  )  [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.

Returns:
The only instance reference of the manager

Referenced by CORBA_SeqUtil::refToVstring(), and RTC::Manager::Terminator::svc().

void RTC::Manager::join (  ) 

Wait for Manager's termination.

Wait for Manager's termination to synchronize.

void RTC::Manager::load ( const char *  fname,
const char *  initfunc 
)

[CORBA interface] Load module

Load specified module (shared library, DLL etc..), and invoke initialize function.

Parameters:
fname The module file name
initfunc The initialize function name
bool RTC::Manager::mergeProperty ( coil::Properties prop,
const char *  file_name 
) [protected]

Merge property information.

Load property information that is configured in the specified file, and merge existing properties that has been configured.

Parameters:
prop Target properties for the merge
file_name File name that property information is described
Returns:
Merge result (Successful:true, Failed:false)
void RTC::Manager::notifyFinalized ( RTObject_impl comp  ) 

This method deletes RT-Components.

The deleted RT-Component is registered. The registered RT-Components are deleted by cleanupComponents().

Parameters:
Deleted RT component
bool RTC::Manager::procComponentArgs ( const char *  comp_arg,
coil::Properties comp_id,
coil::Properties comp_conf 
) [protected]

Extracting component type/properties from the given string.

This operation extracts component type name and its properties from the figen character string. The given string formats is the following.

[RTC type]?[key(0)]=[val(0)]&[key(1)]=[val(1)]...[key(n)]=[val(n)]

Returned value "comp_id" has keys of "vendor", "category", "implementation_id", "version", and returned as Properties type object. "comp_conf" is returned as Properties type object includeing component properties to be given to component.

Returns:
comp_arg false will returned if no component type in arg
Parameters:
comp_arg character string to be processed
comp_type extracted component type name
comp_prop extracted component's properties
bool RTC::Manager::procContextArgs ( const char *  ec_args,
std::string &  ec_id,
coil::Properties ec_conf 
) [protected]

Extracting ExecutionContext's name/properties from the given string.

This operation extracts ExecutionContext's name and its properties from the figen character string. The given string formats is the following.

[ExecutionContext's name]?[key(0)]=[val(0)]&[key(1)]=[val(1)]...[key(n)]=[val(n)]

"ec_conf" is returned as Properties type object includeing component properties to be given to component.

Returns:
ec_arg false will returned if no ExecutionContext's name in arg
Parameters:
ec_arg character string to be processed
ec_type extracted ExecutionContext's name
ec_prop extracted ExecutionContext's properties
bool RTC::Manager::registerComponent ( RTObject_impl comp  ) 

Register RT-Component directly without Factory.

Register specified RT-Component's instances not via Factory to Manager directly.

Parameters:
comp Target RT-Component's instances for the registration
Returns:
Registration result (Successful:true, Failed:false)
bool RTC::Manager::registerECFactory ( const char *  name,
ECNewFunc  new_func,
ECDeleteFunc  delete_func 
)

Register ExecutionContext Factory.

Register Factory to create ExecutionContext's instances.

Parameters:
name ExecutionContext name for the creation
new_func ExecutionContext creation function
delete_func ExecutionContext destruction function
Returns:
Registration result (Successful:true, Failed:false)
bool RTC::Manager::registerFactory ( coil::Properties profile,
RtcNewFunc  new_func,
RtcDeleteFunc  delete_func 
)

Register RT-Component Factory.

Register Factory to create RT-Component's instances.

Parameters:
profile RT-Component profile
new_func RT-Component creation function
delete_func RT-Component destruction function
Returns:
Registration result (Successful:true, Failed:false)
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, CORBA's ORB event loop or other processes are performed. As the default behavior, this operation is going to blocking mode and never returns until Manager::destroy() 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.

Parameters:
no_block false: Blocking mode, true: non-blocking mode.
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.

Parameters:
proc A function pointer to the initial procedure call
void RTC::Manager::shutdown (  ) 

Shutdown Manager.

Terminate manager's processing. After terminating ORB, shutdown manager in sync.

Referenced by RTC::Manager::Terminator::svc().

void RTC::Manager::shutdownComponents (  )  [protected]

NamingManager finalization.

Get a list of RT-Components that have been registered to NamingManager, and shutdown all components.

void RTC::Manager::shutdownLogger (  )  [protected]

System Logger finalization.

Finalize System Logger. If log information stored in the buffer exists, output information to the log file forcibly and close it.

void RTC::Manager::shutdownManager (  )  [protected]

Shutdown Manager.

Shutdown Manager (However, not implemented now)

void RTC::Manager::shutdownNaming (  )  [protected]

NamingManager finalization.

Finalize NamingManager. Unbind all registered elements and shutdown them.

void RTC::Manager::shutdownOnNoRtcs (  )  [protected]

Shutdown Manager.

This method shutdowns Manager as follows.

  • "Manager.shutdown_on_nortcs" of configuration is YES.
  • The component is not registered.
void RTC::Manager::shutdownORB (  )  [protected]

ORB finalization.

Finalize ORB . When the waiting process exists, wait until it completes. In actual finalization, deactivate POA Manager and then shutdown of ORB.

void RTC::Manager::terminate (  ) 

Terminate manager.

Terminate manager's processing

void RTC::Manager::unload ( const char *  fname  ) 

Unload module.

Unload module.

Parameters:
fname The module file name
void RTC::Manager::unloadAll (  ) 

Unload all modules.

bool RTC::Manager::unregisterComponent ( RTObject_impl comp  ) 

Unregister RT-Components.

Unregister specified RT-Components

Parameters:
comp Target RT-Component's instances for the unregistration
Returns:
Unregistration result (Successful:true, Failed:false)

Member Data Documentation

ComponentManager.

Managaer's configuration Properties.

Referenced by getConfig(), and getLogLevel().

ExecutionContext Manager.

std::vector<ExecutionContextBase*> RTC::Manager::m_ecs [protected]

ExecutionContext list.

ComponentManager.

User's initialization function's pointer.

std::vector<std::filebuf*> RTC::Manager::m_logfiles [protected]

Files for log output.

Logger buffer.

Referenced by getLogStreamBuf().

The pointer to the ManagerServant.

The pointer to the ModuleManager.

The pointer to the NamingManager.

CORBA::ORB_var RTC::Manager::m_pORB [protected]

The pointer to the ORB.

PortableServer::POA_var RTC::Manager::m_pPOA [protected]

The pointer to the POA.

PortableServer::POAManager_var RTC::Manager::m_pPOAManager [protected]

The pointer to the POAManager.

The pointer to ORB helper class.

Synchronous flag for manager termination.

Flag used to take synchronization by join().

The pointer to ORB termination helper class.

Timer Object.

Manager* RTC::Manager::manager [static, protected]

The pointer to the Manager.

Mutex RTC::Manager::mutex [static, protected]

The mutex of the pointer to the Manager.

Logger stream.

Generated on Fri Oct 28 18:31:18 2016 for OpenRTM-aist by  doxygen 1.6.3