advgetopt/conf_file.cpp
/** \brief Add a callback to detect when changes happen.
 *
 * This function is used to attach a callback to this configuration file.
 * This is useful if you'd like to know when a change happen to a parameter
 * in this configuration file.
 *
 * The callbacks get called when:
 *
 * \li The set_parameter() is called and the parameter gets created.
 * \li The set_parameter() is called and the parameter gets updated.
 * \li The erase_parameter() is called and the parameter gets erased.
 *
 * You can cancel your callback by calling the remove_callback() function
 * with the identifier returned by this function.
 *
 * To attach another object to your callback, you can either create
 * a callback which is attached to your object and a function
 * member or use std::bind() to attach the object to the function
 * call.
 *
 * If you specifcy a \p parameter_name, the callback is called only if the
 * parameter has that specific name.
 *
 * \param[in] c  The new callback std::function.
 * \param[in] parameter_name  The parameter name or an empty string.
 *
 * \return The callback identifier (useful if you want to be able to remove it).
 */
\brief Add a callback to detect when changes happen.
This function is used to attach a callback to this configuration file.
This is useful if you'd like to know when a change happen to a parameter
in this configuration file.

The callbacks get called when.

\li The set_parameter() is called and the parameter gets created.
\li The set_parameter() is called and the parameter gets updated.
\li The erase_parameter() is called and the parameter gets erased.

You can cancel your callback by calling the remove_callback() function
with the identifier returned by this function.

To attach another object to your callback, you can either create
a callback which is attached to your object and a function
member or use std::bind() to attach the object to the function
call.

If you specifcy a \p parameter_name, the callback is called only if the
parameter has that specific name.

\param[in] c  The new callback std::function.
\param[in] parameter_name  The parameter name or an empty string.

\return The callback identifier (useful if you want to be able to remove it).
\ brief Add a callback to detect when changes happen . This function is used to attach a callback to this configuration file . This is useful if you ' d like to know when a change happen to a parameter in this configuration file . The callbacks get called when . \ li The set_parameter () is called and the parameter gets created . \ li The set_parameter () is called and the parameter gets updated . \ li The erase_parameter () is called and the parameter gets erased . You can cancel your callback by calling the remove_callback () function with the identifier returned by this function . To attach another object to your callback you can either create a callback which is attached to your object and a function member or use std :: bind () to attach the object to the function call . If you specifcy a \ p parameter_name the callback is called only if the parameter has that specific name . \ param [ in ] c The new callback std :: function . \ param [ in ] parameter_name The parameter name or an empty string . \ return The callback identifier ( useful if you want to be able to remove it ) .
conf_file::callback_id_t conf_file::add_callback(
          callback_t const & c
        , std::string const & parameter_name)
{
    cppthread::guard lock(get_global_mutex());
    ++f_next_callback_id;
    f_callbacks.emplace_back(f_next_callback_id, c, parameter_name);
    return f_next_callback_id;
}
conf_file :: callback_id_t conf_file :: add_callback ( callback_t const & c , std :: string const & parameter_name ) { cppthread :: guard lock ( get_global_mutex ( ) ) ; ++ f_next_callback_id ; f_callbacks . emplace_back ( f_next_callback_id , c , parameter_name ) ; return f_next_callback_id ; }
\brief Add a callback to detect when changes happen.
\ brief Add a callback to detect when changes happen .