OpenMPCD
Public Member Functions | List of all members
OpenMPCD::Configuration::List Class Reference

Represents a list, or an array, of values. More...

#include <Configuration.hpp>

Public Member Functions

 List (const libconfig::Setting &s)
 The constructor. More...
 
unsigned int getSize () const
 Returns the number of elements in the list. More...
 
const Setting getSetting (const unsigned int index) const
 Returns the setting object with the given index. More...
 
const List getList (const unsigned int index) const
 Returns the list with the given index. More...
 
template<typename ValueType >
void read (const unsigned int index, ValueType *const value) const
 Reads the specified setting and stores them in the given location. More...
 
void read (const unsigned int index, std::string *const value) const
 Reads the specified setting and stores it in the given location. More...
 
template<typename ValueType >
ValueType read (const unsigned int index) const
 Returns the specified setting from the given configuration file. More...
 

Detailed Description

Represents a list, or an array, of values.

Definition at line 323 of file Configuration.hpp.

Constructor & Destructor Documentation

◆ List()

OpenMPCD::Configuration::List::List ( const libconfig::Setting &  s)
inline

The constructor.

The instance is only valid as long as the Configuration instance it originated from is valid.

Parameters
[in]sThe setting.
Exceptions
ExceptionIf OPENMPCD_DEBUG is defined, throws if this setting is neither a list nor an array in the libconfig sense.

Definition at line 334 of file Configuration.hpp.

Member Function Documentation

◆ getList()

const List OpenMPCD::Configuration::List::getList ( const unsigned int  index) const
inline

Returns the list with the given index.

Parameters
[in]indexThe index to return.
Exceptions
InvalidConfigurationExceptionThrows if the given index does not exist or is not a list.

Definition at line 376 of file Configuration.hpp.

◆ getSetting()

const Setting OpenMPCD::Configuration::List::getSetting ( const unsigned int  index) const
inline

Returns the setting object with the given index.

Exceptions
OpenMPCD::InvalidConfigurationExceptionThrows if the given index does not exist.
Parameters
[in]indexThe setting index, starting at 0.

Definition at line 359 of file Configuration.hpp.

◆ getSize()

unsigned int OpenMPCD::Configuration::List::getSize ( ) const
inline

Returns the number of elements in the list.

Definition at line 346 of file Configuration.hpp.

◆ read() [1/3]

template<typename ValueType >
ValueType OpenMPCD::Configuration::List::read ( const unsigned int  index) const
inline

Returns the specified setting from the given configuration file.

Exceptions
InvalidConfigurationExceptionThrows if the settings could not be read into the specified type.
Template Parameters
ValueTypeThe type of the settings value.
Parameters
[in]indexThe setting index

Definition at line 464 of file Configuration.hpp.

◆ read() [2/3]

void OpenMPCD::Configuration::List::read ( const unsigned int  index,
std::string *const  value 
) const
inline

Reads the specified setting and stores it in the given location.

Exceptions
OpenMPCD::InvalidConfigurationExceptionThrows if the setting ist not a string.
OpenMPCD::NULLPointerExceptionIf OPENMPCD_DEBUG is defined, throws if value == nullptr.
Parameters
[in]indexThe setting index.
[out]valueThe location to read the setting value into.

Definition at line 434 of file Configuration.hpp.

◆ read() [3/3]

template<typename ValueType >
void OpenMPCD::Configuration::List::read ( const unsigned int  index,
ValueType *const  value 
) const
inline

Reads the specified setting and stores them in the given location.

Exceptions
InvalidConfigurationExceptionThrows if the setting could not be read into the specified type.
NULLPointerExceptionIf OPENMPCD_DEBUG is defined, throws if the given pointer is NULL.
Template Parameters
ValueTypeThe type of the settings value.
Parameters
[in]indexThe setting index.
[out]valueThe location to read the setting value into.

Definition at line 400 of file Configuration.hpp.


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