19 #ifndef RTC_CONFIGADMIN_H 20 #define RTC_CONFIGADMIN_H 25 #include <coil/Properties.h> 26 #include <coil/stringutil.h> 225 virtual bool update(
const char* val) = 0;
281 template <
typename VarType,
282 typename TransFunc = bool (*)(VarType&,
const char*)>
314 :
ConfigBase(name, def_val), m_var(var), m_trans(trans)
360 if ((*m_trans)(m_var, val)) {
return true; }
611 template <
typename VarType>
616 if (param_name == 0) {
return false; }
617 if (def_val == 0) {
return false; }
618 if (isExist(param_name)) {
return false; }
619 if (!trans(var, def_val)) {
return false; }
620 m_params.push_back(
new Config<VarType>(param_name, var, def_val, trans));
686 void update(
const char* config_set);
725 void update(
const char* config_set,
const char* config_param);
753 bool isExist(
const char*
name);
824 return (m_configsets.hasKey(config_id) == NULL) ?
false :
true;
874 const std::vector<coil::Properties*>& getConfigurationSets(
void);
1040 bool removeConfigurationSet(
const char* config_id);
1069 bool activateConfigurationSet(
const char* config_id);
1074 void setOnUpdate(OnUpdateCallback* cb);
1076 void setOnUpdateParam(OnUpdateParamCallback* cb);
1078 void setOnSetConfigurationSet(OnSetConfigurationSetCallback* cb);
1080 void setOnAddConfigurationSet(OnAddConfigurationAddCallback* cb);
1082 void setOnRemoveConfigurationSet(OnRemoveConfigurationSetCallback* cb);
1084 void setOnActivateSet(OnActivateSetCallback* cb);
1123 bool autoclean =
true);
1185 bool autoclean =
true);
1249 bool autoclean =
true);
1301 void onUpdate(
const char* config_set);
1324 void onUpdateParam(
const char* config_set,
const char* config_param);
1387 void onRemoveConfigurationSet(
const char* config_id);
1408 void onActivateSet(
const char* config_id);
1420 if (conf == 0) {
return false; }
1421 return (m_name == conf->
name);
1436 #endif // RTC_CONFIGADMIN_H ConfigBase abstract class.
ConfigurationSetNameListener OnActivateSetCallback
ConfigurationParamListener OnUpdateParamCallback
bool stringTo(To &val, const char *str)
Convert the given std::string to object.
ConfigBase(const char *name_, const char *def_val)
Constructer.
ConfigurationSetNameListener OnRemoveConfigurationSetCallback
bool isActive(void)
Confirm to activate configuration set.
ConfigurationSetListener class.
ConfigurationSetNameListener class.
ConfigurationParamListener class.
ConfigurationSetNameListenerType
The types of ConfigurationSetNameListener.
std::vector< std::string > m_newConfig
VarType & m_var
Configuration parameter variable.
coil::Properties & m_configsets
coil::Properties m_emptyconf
ConfigurationSetListener OnAddConfigurationAddCallback
find_conf(const char *name)
bool isChanged(void)
Confirm to change configuration parameters.
virtual bool update(const char *val)=0
Pure virtual function to update configuration parameter values.
TransFunc m_trans
Transformation function to convert configuration parameter type into string format.
const char * name
Configuration name.
prop
Organization::get_organization_property ();.
virtual ~ConfigBase(void)
Virtual Destructor.
Class represents a set of properties.
bool operator()(ConfigBase *conf)
virtual bool update(const char *val)
Update a bind parameter value.
const char * getActiveId(void)
Get ID of active configuration set.
ConfigurationSetNameListener OnUpdateCallback
std::vector< ConfigBase * > m_params
bool bindParameter(const char *param_name, VarType &var, const char *def_val, bool(*trans)(VarType &, const char *)=coil::stringTo)
Setup for configuration parameters.
virtual ~Config(void)
Virtual Destructor.
ConfigurationSetListenerType
The types of ConfigurationSetListener.
Config(const char *name, VarType &var, const char *def_val, TransFunc trans=coil::stringTo)
Constructor.
ConfigurationListeners m_listeners
bool haveConfig(const char *config_id)
Check the existence of configuration set.
const char * default_value
Default value in string format.
ConfigurationParamListenerType
The types of ConnectorDataListener.
ConfigurationSetListener OnSetConfigurationSetCallback
Configuration related event listener classes.