libpsynth 0.2.1
Public Member Functions
psynth::base::conf_node Class Reference

A configuration node. More...

#include <config.hpp>

Inheritance diagram for psynth::base::conf_node:
Inheritance graph
[legend]
Collaboration diagram for psynth::base::conf_node:
Collaboration graph
[legend]

List of all members.

Public Member Functions

const std::type_info & type () const
 Returns the type of the node.
bool empty () const
 Returns wether the node is empty or not.
void nudge ()
 Nudges the node.
template<class T >
void set (const T &val)
 Sets the value of the node.
template<class T >
void set (const T &val, bool overwrite)
 Sets the value of the node unless overwrite = false and the node is already set.
template<class T >
void def (const T &val)
 Sets the value of the node if no previous value has been give to the node.
template<class T >
void get (T &data) const
 Gets the value of the node.
template<class T >
get () const
 Gets the value of the node.
void save ()
 Permanently stores this node hierarchy using the attached backend.
void load ()
 Loads this node hierarchy from the permanent media.
void def_load ()
 Loads this node hierarchy from the permanent media but leaving already set values with their old value.
void set_backend (conf_backend_ptr backend)
 Attaches a backend to the node.
void unset_backend ()
 Dataches the currently attached backend to the node.

Detailed Description

A configuration node.

It stores a value of any type in conf_type. It has some childs identifyed by its name crating a whole hierarchy that allows a better organization of the values and the information.

Note:
This implementation is thread safe.
Todo:

Rethink the backend system.

Template threading model.


Member Function Documentation

template<class T >
void psynth::base::conf_node::def ( const T &  val)

Sets the value of the node if no previous value has been give to the node.

The node type is set to T, unless T is not a valid type in which case nothing happends.

Parameters:
valThe new value of the node.
void psynth::base::conf_node::def_load ( )

Loads this node hierarchy from the permanent media but leaving already set values with their old value.

bool psynth::base::conf_node::empty ( ) const [inline]

Returns wether the node is empty or not.

template<class T >
T psynth::base::conf_node::get ( ) const

Gets the value of the node.

Make sure that T matches the node type.

template<class T >
void psynth::base::conf_node::get ( T &  data) const

Gets the value of the node.

Make sure that T matches the node type.

Parameters:
dataSomewhere to store the node value.
void psynth::base::conf_node::load ( )

Loads this node hierarchy from the permanent media.

void psynth::base::conf_node::nudge ( ) [inline]

Nudges the node.

It just raises a nudge event.

void psynth::base::conf_node::save ( )

Permanently stores this node hierarchy using the attached backend.

template<class T >
void psynth::base::conf_node::set ( const T &  val) [inline]

Sets the value of the node.

The node type is set to T, unless T is not a valid type in which case nothing happends.

Parameters:
valThe new value of the node.
template<class T >
void psynth::base::conf_node::set ( const T &  val,
bool  overwrite 
)

Sets the value of the node unless overwrite = false and the node is already set.

Parameters:
valThe new value of the node.
void psynth::base::conf_node::set_backend ( conf_backend_ptr  backend)

Attaches a backend to the node.

If another backend has already been attached it is datached.

Parameters:
backendThe backend to attach.
const std::type_info& psynth::base::conf_node::type ( ) const [inline]

Returns the type of the node.

void psynth::base::conf_node::unset_backend ( )

Dataches the currently attached backend to the node.


The documentation for this class was generated from the following files: