Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Namespaces | Functions
cfg_utils.hh File Reference
#include <list>
#include <sstream>
#include <boost/core/demangle.hpp>
#include <armadillo>
#include <yaml-cpp/yaml.h>
#include "../core/exceptions.hh"
#include "../core/string.hh"
#include "../core/types.hh"
Include dependency graph for cfg_utils.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Utopia
 
namespace  Utopia::DataIO
 
namespace  Utopia::_internal
 

Functions

template<class Exc >
YAML::Exception Utopia::DataIO::improve_yaml_exception (const Exc &e, const Config &node, std::string prefix={})
 Improves yaml-cpp exceptions occurring for a given node.
 
std::string Utopia::DataIO::to_string (const Config &node)
 Given a config node, returns a string representation of it.
 
template<typename ReturnType >
ReturnType Utopia::get_as (const std::string &key, const DataIO::Config &node)
 This function is a wrapper around the yaml-cpp YAML::Node::as function.
 
template<typename ReturnType >
ReturnType Utopia::get_as (const std::string &key, const DataIO::Config &node, ReturnType fallback)
 Like Utopia::get_as, but instead of KeyError, returns a fallback value.
 
template<typename CVecT , DimType dim = 0>
CVecT Utopia::DataIO::get_as_arma_vec (const std::string &key, const DataIO::Config &node)
 Retrieve a config entry as Armadillo column vector using get_.
 
template<DimType dim>
SpaceVecType< dim > Utopia::get_as_SpaceVec (const std::string &key, const DataIO::Config &node)
 Special case of Utopia::get_as to retrieve an entry as SpaceVec.
 
template<DimType dim>
MultiIndexType< dim > Utopia::get_as_MultiIndex (const std::string &key, const DataIO::Config &node)
 Special case of Utopia::get_as to retrieve an entry as MultiIndex.
 
template<class T , class Keys = std::list<std::string>>
Config Utopia::_internal::__recursive_setitem (Config d, Keys &&key_sequence, const T &val)
 Helper function for recursive_setitem.
 
Config Utopia::_internal::recursive_getitem (const Config &d, const std::vector< std::string > &key_sequence)
 Recursively retrieve an element from the configuration tree.
 
Config Utopia::_internal::recursive_getitem (const Config &d, const std::string &key_sequence, const std::string &delims=".")
 Overload for recursive_getitem, accepting a string-like key sequence.
 
template<class T >
void Utopia::_internal::recursive_setitem (Config &d, std::list< std::string > key_sequence, const T val)
 Recursively sets an element in a configuration tree.
 
template<class T >
void Utopia::_internal::recursive_setitem (Config &d, const std::string &key_sequence, const T val, const std::string &delims=".")
 Overload for recursive_setitem that splits a string into a key sequence.