advgetopt/conf_file.cpp
/** \brief Call whenever the value changed so we can handle callbacks.
 *
 * This function is called on a change of the internal values.
 *
 * The function is used to call the callbacks that were added to this
 * option_info object. The function first copies the existing list of
 * callbacks so you can safely update the list from within a callback.
 *
 * \warning
 * Destroying your advgetopt::getopt option is not safe while a callback
 * is running.
 */
\brief Call whenever the value changed so we can handle callbacks.
This function is called on a change of the internal values.

The function is used to call the callbacks that were added to this
option_info object. The function first copies the existing list of
callbacks so you can safely update the list from within a callback.

\warning
Destroying your advgetopt::getopt option is not safe while a callback
is running.
\ brief Call whenever the value changed so we can handle callbacks . This function is called on a change of the internal values . The function is used to call the callbacks that were added to this option_info object . The function first copies the existing list of callbacks so you can safely update the list from within a callback . \ warning Destroying your advgetopt :: getopt option is not safe while a callback is running .
void conf_file::value_changed(
          callback_action_t action
        , std::string const & parameter_name
        , std::string const & value)
{
    callback_vector_t callbacks;
    callbacks.reserve(f_callbacks.size());
    {
        cppthread::guard lock(get_global_mutex());
        callbacks = f_callbacks;
    }
    for(auto & e : callbacks)
    {
        if(e.f_parameter_name.empty()
        || e.f_parameter_name == parameter_name)
        {
            e.f_callback(shared_from_this(), action, parameter_name, value);
        }
    }
}
void conf_file :: value_changed ( callback_action_t action , std :: string const & parameter_name , std :: string const & value ) { callback_vector_t callbacks ; callbacks . reserve ( f_callbacks . size ( ) ) ; { cppthread :: guard lock ( get_global_mutex ( ) ) ; callbacks = f_callbacks ; } for ( auto & e : callbacks ) { if ( e . f_parameter_name . empty ( ) || e . f_parameter_name == parameter_name ) { e . f_callback ( shared_from_this ( ) , action , parameter_name , value ) ; } } }
\brief Call whenever the value changed so we can handle callbacks.
\ brief Call whenever the value changed so we can handle callbacks .