class Gambit::Options

[No description available] More…

#include <yaml_options.hpp>

Public Functions

Name
template <typename… args>
bool
hasKey(const args &… keys) const
template <typename TYPE ,typename… args>
TYPE
getValue(const args &… keys) const
template <typename TYPE ,typename… args>
TYPE
getValueOrDef(TYPE def, const args &… keys) const
template <typename KEYTYPE ,typename VALTYPE >
void
setValue(const KEYTYPE & key, const VALTYPE & val)
Options()
Default constructor.
Options(const YAML::Node & options)
Copy constructor.
Options(YAML::Node && options)
Move constructor.
template <typename TYPE >
std::vector< TYPE >
getVector(std::string key) const
Get a std::vector of a particular type.
template <typename… args>
const std::vector< str >
getNames(const args &… keys) const
const std::vector< str >getNames() const
template <typename… args>
const Options
getOptions(const args &… keys) const
Recursive options retrieval.
template <typename… args>
YAML::Node
getNode(const args &… keys) const
Retrieve raw YAML node.
template <typename… args>
YAML::Node
loadFromFile(const args &… keys) const
Get YAML node from file.
YAML::const_iteratorbegin() const
Return begin and end of options.
YAML::const_iteratorend() const
std::stringtoString(size_t level) const
Convert to string with some indentation.
voidtoMap(map_str_str & map, str header ="") const
Convert the options node a map.

Detailed Description

class Gambit::Options;

A small wrapper object for ‘options’ nodes. These can be extracted from the prior, observable/likelihood and rules sections of the inifile, or set by hand in module standalone mode.

Public Functions Documentation

function hasKey

template <typename... args>
inline bool hasKey(
    const args &... keys
) const

Getters for key/value pairs (which is all the options node should contain)

function getValue

template <typename TYPE ,
typename... args>
inline TYPE getValue(
    const args &... keys
) const

function getValueOrDef

template <typename TYPE ,
typename... args>
inline TYPE getValueOrDef(
    TYPE def,
    const args &... keys
) const

function setValue

template <typename KEYTYPE ,
typename VALTYPE >
inline void setValue(
    const KEYTYPE & key,
    const VALTYPE & val
)

Basic setter, for adding extra options

function Options

inline Options()

Default constructor.

function Options

inline Options(
    const YAML::Node & options
)

Copy constructor.

function Options

inline Options(
    YAML::Node && options
)

Move constructor.

function getVector

template <typename TYPE >
inline std::vector< TYPE > getVector(
    std::string key
) const

Get a std::vector of a particular type.

If the entry is a scalar rather than a vector, try to convert it to a size one std::vector

function getNames

template <typename... args>
inline const std::vector< str > getNames(
    const args &... keys
) const

Retrieve values from key-value pairs in options node. Works for an arbitrary set of input keys (of any type), and returns all values as strings.

function getNames

inline const std::vector< str > getNames() const

Retrieve values from all key-value pairs in options node. Returns all keys as strings.

function getOptions

template <typename... args>
inline const Options getOptions(
    const args &... keys
) const

Recursive options retrieval.

function getNode

template <typename... args>
inline YAML::Node getNode(
    const args &... keys
) const

Retrieve raw YAML node.

function loadFromFile

template <typename... args>
inline YAML::Node loadFromFile(
    const args &... keys
) const

Get YAML node from file.

function begin

inline YAML::const_iterator begin() const

Return begin and end of options.

function end

inline YAML::const_iterator end() const

function toString

inline std::string toString(
    size_t level
) const

Convert to string with some indentation.

function toMap

inline void toMap(
    map_str_str & map,
    str header =""
) const

Convert the options node a map.


Updated on 2024-07-18 at 13:53:30 +0000