xorp

ConfigParam< T > Class Template Reference

A class for storing a configuration parameter. More...

#include <config_param.hh>

List of all members.

Public Types

typedef XorpCallback1< void, T >
::RefPtr 
UpdateCallback

Public Member Functions

 ConfigParam (const T &value)
 Constructor of a parameter with an initial value.
 ConfigParam (const T &value, const UpdateCallback &update_cb)
 Constructor of a parameter with an initial value and a callback.
virtual ~ConfigParam ()
 Destructor.
const T & get () const
 Get the current value of the parameter.
void set (const T &value)
 Set the current value of the parameter.
ConfigParamoperator= (const T &value)
 Assignment operator.
const T & operator++ ()
 Increment Operator (prefix).
operator++ (int)
 Increment Operator (postfix).
const T & incr ()
 Increment Operator.
const T & operator-- ()
 Decrement Operator (prefix).
operator-- (int)
 Decrement Operator (postfix).
const T & decr ()
 Decrement Operator.
const T & get_initial_value () const
 Get the initial value of the parameter.
void reset ()
 Reset the current value of the parameter to its initial value.

Private Attributes

_value
_initial_value
UpdateCallback _update_cb

Detailed Description

template<class T>
class ConfigParam< T >

A class for storing a configuration parameter.

This class can be used to store a configuration parameter. Such parameter has a current and a default value.


Constructor & Destructor Documentation

template<class T>
ConfigParam< T >::ConfigParam ( const T &  value) [inline, explicit]

Constructor of a parameter with an initial value.

Create a configurable parameter, and initialize its initial and current value.

Parameters:
valuethe initial and current value to initialize the parameter to.
template<class T>
ConfigParam< T >::ConfigParam ( const T &  value,
const UpdateCallback &  update_cb 
) [inline]

Constructor of a parameter with an initial value and a callback.

Create a configurable parameter, initialize it, and assign a callback method that will be invoked when the value changes.

Parameters:
valuethe initial and current value to initialize the parameter to.
update_cbthe callback method that will be invoked when the value changes.

Member Function Documentation

template<class T>
const T& ConfigParam< T >::decr ( ) [inline]

Decrement Operator.

The numerical value of this configuration parameter is decremented by one.

Returns:
a reference to this configuration parameter after it was decremented by one.
template<class T>
const T& ConfigParam< T >::get ( ) const [inline]

Get the current value of the parameter.

Returns:
the current value of the parameter.
template<class T>
const T& ConfigParam< T >::incr ( ) [inline]

Increment Operator.

The numerical value of this configuration parameter is incremented by one.

Returns:
a reference to this configuration parameter after it was incremented by one.
template<class T>
const T& ConfigParam< T >::operator++ ( ) [inline]

Increment Operator (prefix).

The numerical value of this configuration parameter is incremented by one.

Returns:
a reference to this configuration parameter after it was incremented by one.
template<class T>
T ConfigParam< T >::operator++ ( int  ) [inline]

Increment Operator (postfix).

The numerical value of this configuration parameter is incremented by one.

Returns:
the value of this configuration parameter before it was incremented by one.
template<class T>
T ConfigParam< T >::operator-- ( int  ) [inline]

Decrement Operator (postfix).

The numerical value of this configuration parameter is decremented by one.

Returns:
the value of this configuration parameter before it was decremented by one.
template<class T>
const T& ConfigParam< T >::operator-- ( ) [inline]

Decrement Operator (prefix).

The numerical value of this configuration parameter is decremented by one.

Returns:
a reference to this configuration parameter after it was decremented by one.
template<class T>
ConfigParam& ConfigParam< T >::operator= ( const T &  value) [inline]

Assignment operator.

Parameters:
valuethe value to assign to the parameter.
Returns:
the parameter with the new value assigned.
template<class T>
void ConfigParam< T >::set ( const T &  value) [inline]

Set the current value of the parameter.

Parameters:
valuethe current value to set the parameter to.

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations