Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
RTC::ConfigAdmin Class Reference

ConfigAdmin class. More...

#include <ConfigAdmin.h>

Inheritance diagram for RTC::ConfigAdmin:
Inheritance graph
[legend]

List of all members.

Classes

struct  find_conf

Public Member Functions

bool activateConfigurationSet (const char *config_id)
 Activate the configuration set.
void addConfigurationParamListener (ConfigurationParamListenerType type, ConfigurationParamListener *listener, bool autoclean=true)
 Adding ConfigurationParamListener.
bool addConfigurationSet (const coil::Properties &configuration_set)
 Add the configuration value to configuration set.
void addConfigurationSetListener (ConfigurationSetListenerType type, ConfigurationSetListener *listener, bool autoclean=true)
 Adding ConfigurationSetListener.
void addConfigurationSetNameListener (ConfigurationSetNameListenerType type, ConfigurationSetNameListener *listener, bool autoclean=true)
 Adding ConfigurationSetNameListener.
template<typename VarType >
bool bindParameter (const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
 Setup for configuration parameters.
 ConfigAdmin (coil::Properties &prop)
 Constructor.
const coil::PropertiesgetActiveConfigurationSet (void)
 Get the active configuration set.
const char * getActiveId (void)
 Get ID of active configuration set.
const coil::PropertiesgetConfigurationSet (const char *config_id)
 Get a configuration set by specified ID.
const std::vector
< coil::Properties * > & 
getConfigurationSets (void)
 Get all configuration sets.
bool haveConfig (const char *config_id)
 Check the existence of configuration set.
bool isActive (void)
 Confirm to activate configuration set.
bool isChanged (void)
 Confirm to change configuration parameters.
bool isExist (const char *name)
 Check the existence of configuration parameters.
void removeConfigurationParamListener (ConfigurationParamListenerType type, ConfigurationParamListener *listener)
 Removing ConfigurationParamListener.
bool removeConfigurationSet (const char *config_id)
 Remove the configuration set.
void removeConfigurationSetListener (ConfigurationSetListenerType type, ConfigurationSetListener *listener)
 Removing ConfigurationSetListener.
void removeConfigurationSetNameListener (ConfigurationSetNameListenerType type, ConfigurationSetNameListener *listener)
 Removing ConfigurationSetNameListener.
bool setConfigurationSetValues (const coil::Properties &configuration_set)
 Add to configuration set from specified property.
void setOnActivateSet (OnActivateSetCallback *cb)
void setOnAddConfigurationSet (OnAddConfigurationAddCallback *cb)
void setOnRemoveConfigurationSet (OnRemoveConfigurationSetCallback *cb)
void setOnSetConfigurationSet (OnSetConfigurationSetCallback *cb)
void setOnUpdate (OnUpdateCallback *cb)
void setOnUpdateParam (OnUpdateParamCallback *cb)
void update (void)
 Update the values of configuration parameters (Active configuration set)
void update (const char *config_set)
 Update configuration parameter (By ID)
void update (const char *config_set, const char *config_param)
 Update the values of configuration parameters (By name)
 ~ConfigAdmin (void)
 Virtual Destructor.

Protected Member Functions

void onActivateSet (const char *config_id)
 Called when the configuration set is made active.
void onAddConfigurationSet (const coil::Properties &config_set)
 Called when a set value is added to the configuration set.
void onRemoveConfigurationSet (const char *config_id)
 Called when the configuration set has been deleted.
void onSetConfigurationSet (const coil::Properties &config_set)
 Called when the property is added to the configuration set.
void onUpdate (const char *config_set)
 When the configuration parameter is updated, it is called.
void onUpdateParam (const char *config_set, const char *config_param)
 When the configuration parameter is updated, it is called.

Private Member Functions

 ConfigAdmin (const ConfigAdmin &ca)
ConfigAdminoperator= (const ConfigAdmin &ca)

Private Attributes

bool m_active
std::string m_activeId
bool m_changed
coil::Propertiesm_configsets
coil::Properties m_emptyconf
ConfigurationListeners m_listeners
std::vector< std::string > m_newConfig
std::vector< ConfigBase * > m_params

Detailed Description

ConfigAdmin class.

Class to manage various configuration information. Now terms for this class are defined as follows.

The following two configuration informations are stored in this class.

  1. A list of configuration-set
  2. A list of configuration parameter variables

Basically, the purpose of this class is to set one of the configuration-set in the list of (1) into parameter variables of (2). Usually, configuration parameter variables manipulation is performed with two-phases of configuration-set setting and parameter variables setting.

The configuration-set manipulations are performed by the following functions.

Modification, addition, deletion, acquisition and activation of configuration-set are performed by these functions. In order to reflect configuration-set, which is manipulated by these functions, on parameter variables that are used from RTC activities, the following update() functions are used .

Callback functors can be given to hook configuration operation. Operations to be hooked are as follows.

Since:
0.4.0

Definition at line 534 of file ConfigAdmin.h.


Constructor & Destructor Documentation

Constructor.

Constructor

Parameters:
propThe target property name for setup

Definition at line 32 of file ConfigAdmin.cpp.

Virtual Destructor.

Virtual destructor.

Virtual Destructor

Definition at line 45 of file ConfigAdmin.cpp.

RTC::ConfigAdmin::ConfigAdmin ( const ConfigAdmin ca) [private]

Member Function Documentation

bool RTC::ConfigAdmin::activateConfigurationSet ( const char *  config_id)

Activate the configuration set.

Activate the configuration set of specified ID Return empty configuration set, if a configuration set of specified ID doesn't exist.

Parameters:
config_idID of the target configuration set for remove
Returns:
Activate result (Remove success:trueĦ˘Remove failure:false)

Definition at line 265 of file ConfigAdmin.cpp.

Adding ConfigurationParamListener.

This function adds a listener object which is called when update(const char* config_set, const char* config_param) is called. In the type argument, currently only ON_UPDATE_CONFIG_PARAM is allowed.

Parameters:
typeConfigurationParamListenerType value ON_UPDATE_CONFIG_PARAM is only allowed.
listenerConfigurationParamListener listener object.
autocleana flag whether if the listener object autocleaned.

Definition at line 336 of file ConfigAdmin.cpp.

bool RTC::ConfigAdmin::addConfigurationSet ( const coil::Properties configuration_set)

Add the configuration value to configuration set.

Add the configuration value to the configuration set.

Add the configuration value to configuration set

Parameters:
configuration_setProperty to add
Returns:
Add Result (Successful:true, Failed:false)

Definition at line 215 of file ConfigAdmin.cpp.

Adding ConfigurationSetListener.

This function add a listener object which is called when ConfigurationSet is updated. Available events are the followings.

Parameters:
typeConfigurationSetListenerType value
listenerConfigurationSetListener listener object.
autocleana flag whether if the listener object autocleaned.

Definition at line 365 of file ConfigAdmin.cpp.

Adding ConfigurationSetNameListener.

This function add a listener object which is called when ConfigurationSetName is updated. Available events are the followings.

  • ON_UPDATE_CONFIG_SET: A ConfigurationSet has been updated.
  • ON_REMOVE_CONFIG_SET: A ConfigurationSet has been deleted.
  • ON_ACTIVATE_CONFIG_SET: A ConfigurationSet has been activated.
Parameters:
typeConfigurationSetNameListenerType value
listenerConfigurationSetNameListener listener object.
autocleana flag whether if the listener object autocleaned.

Definition at line 394 of file ConfigAdmin.cpp.

template<typename VarType >
bool RTC::ConfigAdmin::bindParameter ( const char *  param_name,
VarType &  var,
const char *  def_val,
bool(*)(VarType &, const char *)  trans = coil::stringTo 
) [inline]

Setup for configuration parameters.

Bind configuration parameter to its variable. Return false, if configuration parameter of specified name has already existed. Specify the data type of the configuration as <VarType>.

Parameters:
param_nameConfiguration parameter name
varConfiguration parameter variable
def_valDefault value of configuration parameter
transFunction to transform configuration parameter type into string format
Returns:
Setup result (Successful:true, Failed:false)

Definition at line 612 of file ConfigAdmin.h.

Get the active configuration set.

Get the current active configuration set. Return empty configuration set, if an active configuration set doesn't exist.

Returns:
The active configuration set

Definition at line 201 of file ConfigAdmin.cpp.

const char* RTC::ConfigAdmin::getActiveId ( void  ) [inline]

Get ID of active configuration set.

Get ID of the current active configuration set.

Returns:
The active configuration set ID

Definition at line 796 of file ConfigAdmin.h.

const coil::Properties & RTC::ConfigAdmin::getConfigurationSet ( const char *  config_id)

Get a configuration set by specified ID.

Get a configuration set that was specified by ID Return empty configuration set, if a configuration set of specified ID doesn't exist.

Parameters:
config_idID of the target configuration set for getting
Returns:
The configuration set

Definition at line 165 of file ConfigAdmin.cpp.

const std::vector< coil::Properties * > & RTC::ConfigAdmin::getConfigurationSets ( void  )

Get all configuration sets.

Get all specified configuration sets

Returns:
All configuration sets

Definition at line 152 of file ConfigAdmin.cpp.

bool RTC::ConfigAdmin::haveConfig ( const char *  config_id) [inline]

Check the existence of configuration set.

Check the existence of specified configuration set.

Parameters:
config_idID of target configuration set for confirmation
Returns:
Result of existence confirmation (Specified ConfigSet exists:true, else:false)

Definition at line 822 of file ConfigAdmin.h.

bool RTC::ConfigAdmin::isActive ( void  ) [inline]

Confirm to activate configuration set.

Confirm that configuration set has been activated.

Returns:
Result of state confirmation (Active state:true, Inactive state:false)

Definition at line 847 of file ConfigAdmin.h.

bool RTC::ConfigAdmin::isChanged ( void  ) [inline]

Confirm to change configuration parameters.

Confirm that configuration parameters have changed.

Returns:
Result of change confirmation (There is a change:trueĦ˘No change:false)

Definition at line 775 of file ConfigAdmin.h.

bool RTC::ConfigAdmin::isExist ( const char *  name)

Check the existence of configuration parameters.

Check the existence of configuration parameters of specified name.

Parameters:
nameConfiguration parameter name
Returns:
Result of existance confirmation (Parameters exist:true, else:false)

Definition at line 132 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onActivateSet ( const char *  config_id) [protected]

Called when the configuration set is made active.

Call the set callback object.

Parameters:
config_idproperty

Definition at line 486 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onAddConfigurationSet ( const coil::Properties config_set) [protected]

Called when a set value is added to the configuration set.

Call the set callback object.

Parameters:
configuration_setproperty

Definition at line 462 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onRemoveConfigurationSet ( const char *  config_id) [protected]

Called when the configuration set has been deleted.

Call the set callback object.

Parameters:
config_idproperty

Definition at line 474 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onSetConfigurationSet ( const coil::Properties config_set) [protected]

Called when the property is added to the configuration set.

Call the set callback object.

Parameters:
configuration_setproperty

Definition at line 450 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onUpdate ( const char *  config_set) [protected]

When the configuration parameter is updated, it is called.

Call the set callback object.

Parameters:
config_setThe target configuration set's ID to setup

Definition at line 424 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::onUpdateParam ( const char *  config_set,
const char *  config_param 
) [protected]

When the configuration parameter is updated, it is called.

Call the set callback object.

Parameters:
config_setconfiguration-set ID.
config_paramconfiguration parameter name.

Definition at line 437 of file ConfigAdmin.cpp.

ConfigAdmin& RTC::ConfigAdmin::operator= ( const ConfigAdmin ca) [private]

Removing ConfigurationParamListener.

This function removes a listener object which is added by addConfigurationParamListener() function.

Parameters:
typeConfigurationParamListenerType value ON_UPDATE_CONFIG_PARAM is only allowed.
listenera pointer to ConfigurationParamListener listener object.

Definition at line 351 of file ConfigAdmin.cpp.

bool RTC::ConfigAdmin::removeConfigurationSet ( const char *  config_id)

Remove the configuration set.

Remove the configuration set of specified ID Return empty configuration set, if a configuration set of specified ID doesn't exist.

The configuration-sets that can be removed by this function are only configuration-sets newly added by the addConfigurationSet() function. The configuration that can be removed by this function is only newly added configuration-set by addConfigurationSet() function. The "default" configuration-set and configurationi-sets that is loaded from configuration file cannot be removed.

If the specified configuration is active currently, any configurations are not deleted.

Callback functions that are set by addOnRemovedConfigurationSet() will be called if a configuration-set is deleted actually by this function.

Parameters:
config_idID of the target configuration set for remove
Returns:
Remove result (Successful:true, Failed:false)

Definition at line 238 of file ConfigAdmin.cpp.

Removing ConfigurationSetListener.

This function removes a listener object which is added by addConfigurationSetListener() function.

Parameters:
typeConfigurationSetListenerType value
listenera pointer to ConfigurationSetListener listener object.

Definition at line 380 of file ConfigAdmin.cpp.

Removing ConfigurationSetNameListener.

This function removes a listener object which is added by addConfigurationSetNameListener() function.

Parameters:
typeConfigurationSetNameListenerType value ON_UPDATE_CONFIG_PARAM is only allowed.
listenera pointer to ConfigurationSetNameListener listener object.

Definition at line 409 of file ConfigAdmin.cpp.

Add to configuration set from specified property.

Add to the configuration set from specified property.

Add specified property to configuration set that was specified by ID. Return false if configuration set, that matches specified ID, doesn't exist.

Parameters:
config_idID of the target configuration set for add
configuration_setProperty to add
Returns:
Add result (Successful:true, Failed:false)

Definition at line 180 of file ConfigAdmin.cpp.

Definition at line 318 of file ConfigAdmin.cpp.

Definition at line 303 of file ConfigAdmin.cpp.

Definition at line 311 of file ConfigAdmin.cpp.

Definition at line 296 of file ConfigAdmin.cpp.

Definition at line 282 of file ConfigAdmin.cpp.

Definition at line 289 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::update ( void  )

Update the values of configuration parameters (Active configuration set)

When configuration set is updated, update the configuration parameter value to the value that is set to the current active configuration. This update will be executed, only when an active configuration set exists and the content of the configuration set has been updated from the last update.

Definition at line 64 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::update ( const char *  config_set)

Update configuration parameter (By ID)

This operation updates configuration variables by the configuration-set with specified ID. This operation does not change current active configuration-set. Since this operation causes inconsistency between current active configuration set and actual values of configuration variables, user should carefully use it.

This operation ends without doing anything, if the configuration-set does not exist.

Parameters:
config_setThe target configuration set's ID to setup

Definition at line 82 of file ConfigAdmin.cpp.

void RTC::ConfigAdmin::update ( const char *  config_set,
const char *  config_param 
)

Update the values of configuration parameters (By name)

This operation updates a configuration variable by the specified configuration parameter in the configuration-set. This operation does not change current active configuration-set. Since this operation causes inconsistency between current active configuration set and actual values of configuration variables, user should carefully use it.

This operation ends without doing anything, if the configuration-set or the configuration parameter do not exist.

Parameters:
config_setconfiguration-set ID.
config_paramconfiguration parameter name.

Definition at line 106 of file ConfigAdmin.cpp.


Member Data Documentation

Definition at line 1429 of file ConfigAdmin.h.

std::string RTC::ConfigAdmin::m_activeId [private]

Definition at line 1428 of file ConfigAdmin.h.

Definition at line 1430 of file ConfigAdmin.h.

Definition at line 1425 of file ConfigAdmin.h.

Definition at line 1426 of file ConfigAdmin.h.

Definition at line 1432 of file ConfigAdmin.h.

std::vector<std::string> RTC::ConfigAdmin::m_newConfig [private]

Definition at line 1431 of file ConfigAdmin.h.

std::vector<ConfigBase*> RTC::ConfigAdmin::m_params [private]

Definition at line 1427 of file ConfigAdmin.h.


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


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sat Jun 8 2019 18:49:13