ANNA Suite  2020b
Multipurpose development suite for Telco applications
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
anna::Configuration Class Reference

#include <Configuration.hpp>

Public Member Functions

 Configuration ()
 
 ~Configuration ()
 
void load (const char *configFile) noexcept(false)
 
void setDefaultValue (const char *sectionName, const char *variableName, const char *defaultValue) noexcept(false)
 
const char * getValue (const char *sectionName, const char *variableName, const bool strict=false) const noexcept(false)
 
int getIntegerValue (const char *sectionName, const char *variableName, const bool strict=false) const noexcept(false)
 
bool exists (const char *sectionName, const char *variableName) const
 

Static Public Member Functions

static const char * getClassName ()
 

Static Public Attributes

static const char * defaultSection
 

Detailed Description

Clase para recoger parametros de un determinado archivo de configuracion.

Constructor & Destructor Documentation

◆ Configuration()

anna::Configuration::Configuration ( )
inline

Constructor.

34 {;}

◆ ~Configuration()

anna::Configuration::~Configuration ( )
inline

Destructor.

39 { removeAll(); }
Here is the call graph for this function:

Member Function Documentation

◆ exists()

bool anna::Configuration::exists ( const char *  sectionName,
const char *  variableName 
) const

Devuelve el estado de existencia o no de la variable indicada.

Parameters
sectionNameNombre de la seccion a la que pertenece la variable.
variableNameNombre de la variable de configuracion.
Returns
true si la variable existe, y false en otro caso. Solo deberia invocarse despues de invocar al metodo load.

◆ getClassName()

static const char* anna::Configuration::getClassName ( )
inlinestatic

Devuelve la cadena por la que podemos buscar el componente.

Returns
La cadena por la que podemos buscar el componente.
See also
Application::find
105 { return "anna::Configuration"; }
Here is the call graph for this function:

◆ getIntegerValue()

int anna::Configuration::getIntegerValue ( const char *  sectionName,
const char *  variableName,
const bool  strict = false 
) const
noexcept

Devuelve el valor asociada a la variable indicada.

Parameters
sectionNameNombre de la seccion a la que pertenece la variable.
variableNameNombre de la variable de configuracion.
strictSi es true indica que debe devolver el valor estricto de la variable, de forma, que si esta variable no esta contenida en el archivo de configuracion aun habiendo asociado un valor por defecto (ver setDefaultValue) devolvera NULL.
Returns
El valor asociado a la variable.

◆ getValue()

const char* anna::Configuration::getValue ( const char *  sectionName,
const char *  variableName,
const bool  strict = false 
) const
noexcept

Devuelve el valor asociada a la variable indicada.

Parameters
sectionNameNombre de la seccion a la que pertenece la variable.
variableNameNombre de la variable de configuracion.
strictSi es true indica que debe devolver el valor estricto de la variable, de forma, que si esta variable no esta contenida en el archivo de configuracion aun habiendo asociado un valor por defecto (ver setDefaultValue) devolvera NULL.
Returns
El valor asociado a la variable. Puede ser NULL.

◆ load()

void anna::Configuration::load ( const char *  configFile)
noexcept

Carga en memoria el archivo indicado como argumento.

Parameters
configFileRuta completa con el nombre del archivo de configuracion a cargar. Cualquier otro archivo procesado anteriormente con esta instancia se perdera.

◆ setDefaultValue()

void anna::Configuration::setDefaultValue ( const char *  sectionName,
const char *  variableName,
const char *  defaultValue 
)
noexcept

Establece el valor por defecto para una determinada variable, es decir, en caso de que la variable no exista en el fichero de configuracion cargado (ver load) devolvera el valor establecido mediante este metodo.

Parameters
sectionNameNombre de la seccion a la que pertenece la variable.
variableNameNombre de la variable de configuracion.
defaultValueValor por defecto de la variable. Éste valor solo sera devuelto en caso de que la variable indicada por la seccion y el nombre de variable no este contenido en el archivo de configuracion cargado.

Member Data Documentation

◆ defaultSection

const char* anna::Configuration::defaultSection
static

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