131 def __init__(self, name, var, def_val, trans=None):
138 self.
_trans = OpenRTM_aist.stringTo
415 trans = OpenRTM_aist.stringTo
420 if not trans(var, def_val):
423 self._params.append(
Config(param_name, var, def_val, trans))
528 def update(self, config_set=None, config_param=None):
530 if config_set
and config_param
is None:
531 if self._configsets.hasKey(config_set)
is None:
533 prop = self._configsets.getNode(config_set)
534 for i
in range(len(self.
_params)):
535 if prop.hasKey(self.
_params[i].name):
540 if config_set
and config_param:
542 key = key+
"."+config_param
544 if conf.name == config_param:
545 conf.update(self._configsets.getProperty(key))
550 if config_set
is None and config_param
is None:
588 if conf.name == param_name:
674 if self._configsets.hasKey(config_id)
is None:
732 return self._configsets.getLeaf()
765 prop = self._configsets.getNode(config_id)
797 if config_set.getName() ==
"" or config_set.getName()
is None:
800 if not self._configsets.hasKey(config_set.getName()):
803 p = self._configsets.getNode(config_set.getName())
807 p.mergeProperties(config_set)
841 p = self._configsets.getNode(self.
_activeId)
874 if self._configsets.hasKey(configset.getName()):
876 node = configset.getName()
879 self._configsets.createNode(node)
881 p = self._configsets.getNode(node)
885 p.mergeProperties(configset)
886 self._newConfig.append(node)
952 if config_id ==
"default":
960 if conf == config_id:
968 p = self._configsets.getNode(config_id)
970 p.getRoot().removeNode(config_id)
1011 if config_id
is None:
1015 if config_id[0] ==
'_':
1018 if not self._configsets.hasKey(config_id):
1052 print "setOnUpdate function is obsolete." 1053 print "Use addConfigurationSetNameListener instead." 1054 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET].addListener(cb,
False)
1079 print "setOnUpdateParam function is obsolete." 1080 print "Use addConfigurationParamListener instead." 1081 self._listeners.configparam_[OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM].addListener(cb,
False)
1106 print "setOnSetConfigurationSet function is obsolete." 1107 print "Use addConfigurationSetListener instead." 1108 self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET].addListener(cb,
False)
1133 print "setOnAddConfigurationSet function is obsolete." 1134 print "Use addConfigurationSetListener instead." 1135 self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET].addListener(cb,
False)
1160 print "setOnRemoveConfigurationSet function is obsolete." 1161 print "Use addConfigurationSetNameListener instead." 1162 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET].addListener(cb,
False)
1187 print "setOnActivateSet function is obsolete." 1188 print "Use addConfigurationSetNameListener instead." 1189 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET].addListener(cb,
False)
1232 self._listeners.configparam_[type].addListener(listener, autoclean)
1263 self._listeners.configparam_[type].removeListener(listener)
1302 self._listeners.configset_[type].addListener(listener, autoclean)
1330 self._listeners.configset_[type].removeListener(listener)
1372 self._listeners.configsetname_[type].addListener(listener, autoclean)
1405 self._listeners.configsetname_[type].removeListener(listener)
1432 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_UPDATE_CONFIG_SET].notify(config_set)
1461 self._listeners.configparam_[OpenRTM_aist.ConfigurationParamListenerType.ON_UPDATE_CONFIG_PARAM].notify(config_set,
1489 self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_SET_CONFIG_SET].notify(config_set)
1516 self._listeners.configset_[OpenRTM_aist.ConfigurationSetListenerType.ON_ADD_CONFIG_SET].notify(config_set)
1543 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_REMOVE_CONFIG_SET].notify(config_id)
1570 self._listeners.configsetname_[OpenRTM_aist.ConfigurationSetNameListenerType.ON_ACTIVATE_CONFIG_SET].notify(config_id)
1580 if conf
is None or conf
is 0:
1583 return self.
_name == conf.name
def removeConfigurationSet(self, config_id)
Remove the configuration set.
def __call__(self, config_set)
def setOnActivateSet(self, cb)
Set callback that is called by OnActivateSet.
def isChanged(self)
Confirm to change configuration parameters.
def __init__(self, name, var, def_val, trans=None)
Constructor.
def onActivateSet(self, config_id)
Called when the configuration set is made active.
def __call__(self, config_set)
def __call__(self, config_set)
def setOnRemoveConfigurationSet(self, cb)
Set callback that is called by OnRemoveConfigurationSet.
def isExist(self, param_name)
Check the existence of configuration parameters.
def onAddConfigurationSet(self, config_set)
Called when a set value is added to the configuration set.
def __call__(self, config_id)
def onUpdate(self, config_set)
When the configuration parameter is updated, it is called.
The Properties class represents a persistent set of properties.
def update(self, config_set=None, config_param=None)
void update(void);
def bindParameter(self, param_name, var, def_val, trans=None)
Setup for configuration parameters.
def setOnAddConfigurationSet(self, cb)
Set callback that is called by OnSetConfiguration.
def setOnSetConfigurationSet(self, cb)
Set callback that is called by OnSetConfiguration.
def onRemoveConfigurationSet(self, config_id)
Called when the configuration set has been deleted.
def setOnUpdateParam(self, cb)
Set callback that is called by OnUpdateParam.
def getActiveConfigurationSet(self)
Get the active configuration set.
def onUpdateParam(self, config_set, config_param)
When the configuration parameter is updated, it is called.
def activateConfigurationSet(self, config_id)
Activate the configuration set.
def addConfigurationSetNameListener(self, type, listener, autoclean=True)
Adding ConfigurationSetNameListener.
def update(self, val)
Update a bind parameter value.
def getConfigurationSets(self)
Get all configuration sets.
def isActive(self)
Confirm to activate configuration set.
def __call__(self, config_set)
def __del__(self)
Destructor.
def haveConfig(self, config_id)
Check the existence of configuration set.
def addConfigurationSetListener(self, type, listener, autoclean=True)
Adding ConfigurationSetListener.
def addConfigurationSet(self, configset)
Add the configuration value to configuration set.
def setOnUpdate(self, cb)
Set callback that is called by OnUpdate.
def getConfigurationSet(self, config_id)
Get a configuration set by specified ID.
def removeConfigurationSetNameListener(self, type, listener)
Removing ConfigurationSetNameListener.
def __init__(self, configsets)
Constructor.
def __call__(self, config_set, config_param)
def removeConfigurationParamListener(self, type, listener)
Removing ConfigurationParamListener.
def getActiveId(self)
Get ID of active configuration set.
def setConfigurationSetValues(self, config_set)
Add to configuration set from specified property.
def addConfigurationParamListener(self, type, listener, autoclean=True)
Adding ConfigurationParamListener.
def removeConfigurationSetListener(self, type, listener)
Removing ConfigurationSetListener.
def onSetConfigurationSet(self, config_set)
Called when the property is added to the configuration set.