Commit da22b377 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2203] changed the callback type of addRemoteConfig to boost::function.

this will make it more convenient, e.g., by allowing the caller to pass
boost::bind encapsulating a class object and a class method.

boost::function is upper compatible to function pointer, so it doesn't
ensure source-level compatibility.

the functor overhead shouldn't matter in this context, and since this module
already uses boost::function this change doesn't introduce additional
dependency.
parent 0e9c2a4c
......@@ -338,7 +338,7 @@ getRelatedLoggers(ConstElementPtr loggers) {
// Now find the wildcard names (the one that start with "*").
BOOST_FOREACH(ConstElementPtr cur_logger, loggers->listValue()) {
std::string cur_name = cur_logger->get("name")->stringValue();
const std::string cur_name = cur_logger->get("name")->stringValue();
// If name is '*', or starts with '*.', replace * with root
// logger name.
if (cur_name == "*" || cur_name.length() > 1 &&
......@@ -671,9 +671,7 @@ ModuleCCSession::fetchRemoteSpec(const std::string& module, bool is_filename) {
std::string
ModuleCCSession::addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module,
ConstElementPtr,
const ConfigData&),
RemoteHandler handler,
bool spec_is_filename)
{
// First get the module name, specification and default config
......
......@@ -283,7 +283,7 @@ public:
* the configuration manager must know it). If
* spec_is_filename is true (the default), then a
* filename is assumed, otherwise a module name.
* \param handler The handler function called whenever there's a change.
* \param handler The handler functor called whenever there's a change.
* Called once initally from this function. May be NULL
* if you don't want any handler to be called and you're
* fine with requesting the data through
......@@ -296,11 +296,11 @@ public:
* \return The name of the module specified in the given specification
* file
*/
typedef boost::function<void(const std::string&,
isc::data::ConstElementPtr,
const ConfigData&)> RemoteHandler;
std::string addRemoteConfig(const std::string& spec_name,
void (*handler)(const std::string& module_name,
isc::data::ConstElementPtr
update,
const ConfigData& config_data) = NULL,
RemoteHandler handler = RemoteHandler(),
bool spec_is_filename = true);
/**
......@@ -513,9 +513,6 @@ private:
const std::string& command,
isc::data::ConstElementPtr args);
typedef void (*RemoteHandler)(const std::string&,
isc::data::ConstElementPtr,
const ConfigData&);
std::map<std::string, ConfigData> remote_module_configs_;
std::map<std::string, RemoteHandler> remote_module_handlers_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment