IConfigurationManager Class Reference

Manager for all kind of configuration. More...

Inheritance diagram for IConfigurationManager:
IKernelObject IObject

List of all members.

Public Member Functions

virtual void clear (void)=0
 Clears the content of this configuration manager.
virtual OpenViBE::boolean addConfigurationFromFile (const OpenViBE::CString &rFileNameWildCard)=0
 Parses a configuration file and adds its content as token configuration.
virtual OpenViBE::CIdentifier createConfigurationToken (const OpenViBE::CString &rConfigurationTokenName, const OpenViBE::CString &rConfigurationTokenValue)=0
 Creates a new configuration token in this configuration manager.
virtual OpenViBE::boolean releaseConfigurationToken (const OpenViBE::CIdentifier &rConfigurationTokenIdentifier)=0
 Removes an existing configuration token.
virtual OpenViBE::CIdentifier getNextConfigurationTokenIdentifier (const OpenViBE::CIdentifier &rPreviousConfigurationTokenIdentifier) const =0
 Iterates on the existing configuration tokens of this configuration manager.
virtual OpenViBE::CString getConfigurationTokenName (const OpenViBE::CIdentifier &rConfigurationTokenIdentifier) const =0
 Gets a token's name from its identifier.
virtual OpenViBE::CString getConfigurationTokenValue (const OpenViBE::CIdentifier &rConfigurationTokenIdentifier) const =0
 Gets a token's value from its identifier.
virtual OpenViBE::boolean setConfigurationTokenName (const OpenViBE::CIdentifier &rConfigurationTokenIdentifier, const OpenViBE::CString &rConfigurationTokenName)=0
 Changes the name of an exisiting token.
virtual OpenViBE::boolean setConfigurationTokenValue (const OpenViBE::CIdentifier &rConfigurationTokenIdentifier, const OpenViBE::CString &rConfigurationTokenValue)=0
 Changes the value of an exisiting token.
virtual OpenViBE::CIdentifier lookUpConfigurationTokenIdentifier (const OpenViBE::CString &rConfigurationTokenName, const OpenViBE::boolean bRecursive=false) const =0
 Searches the identifier of a token with a given name.
virtual OpenViBE::CString lookUpConfigurationTokenValue (const OpenViBE::CString &rConfigurationTokenName) const =0
 Searches the value of a token with a given name.
virtual OpenViBE::CString expand (const OpenViBE::CString &rExpression) const =0
 Expands a string to an expanded string based on its use of configuration tokens.
virtual OpenViBE::float64 expandAsFloat (const OpenViBE::CString &rExpression, const OpenViBE::float64 f64FallbackValue=0) const =0
 Expands a string to a floating point value based on its use of configuration tokens.
virtual OpenViBE::int64 expandAsInteger (const OpenViBE::CString &rExpression, const OpenViBE::int64 i64FallbackValue=0) const =0
 Expands a string to an integer value based on its use of configuration tokens.
virtual OpenViBE::uint64 expandAsUInteger (const OpenViBE::CString &rExpression, const OpenViBE::uint64 ui64FallbackValue=0) const =0
 Expands a string to an unsigned integer value based on its use of configuration tokens.
virtual OpenViBE::boolean expandAsBoolean (const OpenViBE::CString &rExpression, const OpenViBE::boolean bFallbackValue=true) const =0
 Expands a string to a boolean value based on its use of configuration tokens.
virtual OpenViBE::uint64 expandAsEnumerationEntryValue (const OpenViBE::CString &rExpression, const OpenViBE::CIdentifier &rEnumerationTypeIdentifier, const OpenViBE::uint64 ui64FallbackValue=0) const =0
 Expands a string to an enumeration entry value based on its use of configuration tokens.

Detailed Description

Manager for all kind of configuration.

Author:
Yann Renard (INRIA/IRISA)
Date:
2008-11-05

Member Function Documentation

virtual OpenViBE::boolean addConfigurationFromFile ( const OpenViBE::CString rFileNameWildCard) [pure virtual]

Parses a configuration file and adds its content as token configuration.

Parameters:
rFileNameWildCard[in] : a wildcard of the files to parse & add
Returns:
true in case of success
false in case of error
Note:
In case the wildcard matches several filenames, it is up to this configuration manager to choose the order it parses the files in.
See also:
IConfigurationManager::createConfigurationToken
virtual OpenViBE::CIdentifier createConfigurationToken ( const OpenViBE::CString rConfigurationTokenName,
const OpenViBE::CString rConfigurationTokenValue 
) [pure virtual]

Creates a new configuration token in this configuration manager.

Parameters:
rConfigurationTokenName[in] : the name of the configuration token
rConfigurationTokenValue[in] the value of the configuration token
Returns:
the identifier of the newly created token in case of success
OV_UndefinedIdentifier in case of error
See also:
IConfigurationManager::releaseConfigurationToken
IConfigurationManager::createConfigurationToken
virtual OpenViBE::boolean releaseConfigurationToken ( const OpenViBE::CIdentifier rConfigurationTokenIdentifier) [pure virtual]

Removes an existing configuration token.

Parameters:
rConfigurationTokenIdentifier[in] : the identifier of the token to remove
Returns:
true in case of success
false in case of error
See also:
IConfigurationManager::addConfigurationFromFile
IConfigurationManager::createConfigurationToken
virtual OpenViBE::CIdentifier getNextConfigurationTokenIdentifier ( const OpenViBE::CIdentifier rPreviousConfigurationTokenIdentifier) const [pure virtual]

Iterates on the existing configuration tokens of this configuration manager.

Parameters:
rPreviousConfigurationTokenIdentifier[in] : the identifier of the token to start the iteration from
Returns:
the identifier of the next configuration token in case of success
OV_UndefinedIdentifier in case there is no more token to iterate on

Typicall use of this function is :

 CIdentifier l_oTokenIdentifier; // defaults to OV_UndefinedIdentifier
 while((l_oTokenIdentifier=l_pConfigurationManager->getNextConfigurationTokenIdentifier(l_oTokenIdentifier)) != OV_UndefinedIdentifier)
 {
     // do some stuff with current token identified with l_oTokenIdentifier
 }
virtual OpenViBE::CString getConfigurationTokenName ( const OpenViBE::CIdentifier rConfigurationTokenIdentifier) const [pure virtual]

Gets a token's name from its identifier.

Parameters:
rConfigurationTokenIdentifier[in] : the token identifier which name should be returned
Returns:
the name of the token in case of success
an empty string in case of error
See also:
IConfigurationManager::getConfigurationTokenValue
virtual OpenViBE::CString getConfigurationTokenValue ( const OpenViBE::CIdentifier rConfigurationTokenIdentifier) const [pure virtual]

Gets a token's value from its identifier.

Parameters:
rConfigurationTokenIdentifier[in] : the token identifier which value should be returned
Returns:
the value (unexapanded) of the token in case of success
an empty string in case of error
See also:
IConfigurationManager::getConfigurationTokenName
IConfigurationManager::expand and others
Note:
the returned value is not expanded by this configuration manager ; only the value that was passed at creation time is returned. If you want to expand things, please use IConfigurationManager::expand
virtual OpenViBE::boolean setConfigurationTokenName ( const OpenViBE::CIdentifier rConfigurationTokenIdentifier,
const OpenViBE::CString rConfigurationTokenName 
) [pure virtual]

Changes the name of an exisiting token.

Parameters:
rConfigurationTokenIdentifier[in] : the identifier of the token which name should be changed
rConfigurationTokenName[in] : the new name of the configuration token
Returns:
true in case of success
false in case of error
Note:
it is not valid to add a token using this function
See also:
IConfigurationManager::createConfigurationToken
IConfigurationManager::addConfigurationFromFile
IConfigurationManager::setConfigurationTokenValue
virtual OpenViBE::boolean setConfigurationTokenValue ( const OpenViBE::CIdentifier rConfigurationTokenIdentifier,
const OpenViBE::CString rConfigurationTokenValue 
) [pure virtual]

Changes the value of an exisiting token.

Parameters:
rConfigurationTokenIdentifier[in] : the identifier of the token which value should be changed
rConfigurationTokenValue[in] : the new value of the configuration token
Returns:
true in case of success
false in case of error
Note:
it is not valid to add a token using this function
See also:
IConfigurationManager::createConfigurationToken
IConfigurationManager::addConfigurationFromFile
IConfigurationManager::setConfigurationTokenName
virtual OpenViBE::CIdentifier lookUpConfigurationTokenIdentifier ( const OpenViBE::CString rConfigurationTokenName,
const OpenViBE::boolean  bRecursive = false 
) const [pure virtual]

Searches the identifier of a token with a given name.

Parameters:
rConfigurationTokenName[in] : the name of the token which identifier should be found
bRecursive[in] : when set to true, asks this configuration manager to propagate the request to parent configuration manager (if any).
Returns:
the identifier of the token with the actual name in case of success
OV_UndefinedIdentifier in case of error
Note:
if bRecursive is set to true then the returned identifier should not be considered as the identifier of an existing token in this configuration manager as it may have been returned from a parent configuration manager. Instead, one must consider the returned identifier as a kind of boolean value : suck token actually exists or such token does not exists.
virtual OpenViBE::CString lookUpConfigurationTokenValue ( const OpenViBE::CString rConfigurationTokenName) const [pure virtual]

Searches the value of a token with a given name.

Parameters:
rConfigurationTokenName[in] : the name of the token which value should be found
Returns:
the value of the token with the actual name in case of success
Note:
This function differs of getConfigurationTokenName in the sense that it recursively requests a token value to parent configuration managers until it finds one (if any). It also differs from the expand function in the sense that it takes a token name as input but does not expand its value when it finds it.
virtual OpenViBE::CString expand ( const OpenViBE::CString rExpression) const [pure virtual]

Expands a string to an expanded string based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expan
Returns:
the expanded string
See also:
IConfigurationManager::expandAsFloat
IConfigurationManager::expandAsInteger
IConfigurationManager::expandAsUInteger
IConfigurationManager::expandAsBoolean
IConfigurationManager::expandAsEnumerationEntryValue

Typical use of this function is :

 l_pConfigurationManager->expand("${TokenName}")
virtual OpenViBE::float64 expandAsFloat ( const OpenViBE::CString rExpression,
const OpenViBE::float64  f64FallbackValue = 0 
) const [pure virtual]

Expands a string to a floating point value based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expand
f64FallbackValue[in] : a fall back value to return in case the expanded string can not be parsed as a floating point value
Returns:
the expanded value
See also:
IConfigurationManager::expand
virtual OpenViBE::int64 expandAsInteger ( const OpenViBE::CString rExpression,
const OpenViBE::int64  i64FallbackValue = 0 
) const [pure virtual]

Expands a string to an integer value based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expand
i64FallbackValue[in] : a fall back value to return in case the expanded string can not be parsed as an integer value
Returns:
the expanded value
See also:
IConfigurationManager::expand
virtual OpenViBE::uint64 expandAsUInteger ( const OpenViBE::CString rExpression,
const OpenViBE::uint64  ui64FallbackValue = 0 
) const [pure virtual]

Expands a string to an unsigned integer value based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expand
ui64FallbackValue[in] : a fall back value to return in case the expanded string can not be parsed as an unsigned integer value
Returns:
the expanded value
See also:
IConfigurationManager::expand
virtual OpenViBE::boolean expandAsBoolean ( const OpenViBE::CString rExpression,
const OpenViBE::boolean  bFallbackValue = true 
) const [pure virtual]

Expands a string to a boolean value based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expand
bFallbackValue[in] : a fall back value to return in case the expanded string can not be parsed as a boolean value
Returns:
the expanded value
See also:
IConfigurationManager::expand
virtual OpenViBE::uint64 expandAsEnumerationEntryValue ( const OpenViBE::CString rExpression,
const OpenViBE::CIdentifier rEnumerationTypeIdentifier,
const OpenViBE::uint64  ui64FallbackValue = 0 
) const [pure virtual]

Expands a string to an enumeration entry value based on its use of configuration tokens.

Parameters:
rExpression[in] : the string that you want to expand
rEnumerationTypeIdentifier[in] : the enumeration type to use
ui64FallbackValue[in] : a fall back value to return in case the expanded string can not be parsed as an enumeration entry value
Returns:
the expanded value
See also:
IConfigurationManager::expand
ITypeManager