1#ifndef UTOPIA_MODELS_ENVIRONMENT_TOOLS_HH
2#define UTOPIA_MODELS_ENVIRONMENT_TOOLS_HH
31 throw std::invalid_argument(
"The `mode` argument for configuration of "
32 "environment function " +
context +
" can be 'add' or 'set', but "
38template <
typename Time>
40 bool invoke_always =
true;
43 if (
not cfg.IsMap()) {
45 return {invoke_always, times};
50 invoke_always =
false;
59 [](
auto&
t){ return (t <= 0); }),
67 return {invoke_always, times};
72template <
typename Time>
73std::tuple<bool, bool, std::set<Time>>
76 bool invoke_at_initialization =
get_as<bool>(
"invoke_at_initialization",
81 return {invoke_at_initialization, invoke_always, times};
85template <
typename Time>
YAML::Node Config
Type of a variadic dictionary-like data structure used throughout Utopia.
Definition types.hh:71
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
Time extract_time_start(const DataIO::Config &cfg)
Given a configuration, extracts the time of first function invocation.
Definition tools.hh:86
std::tuple< bool, bool, std::set< Time > > extract_times_and_initialization(const DataIO::Config &cfg)
Definition tools.hh:74
ValMode extract_val_mode(const DataIO::Config &cfg, const std::string &context)
Given a configuration node, extract the value mode.
Definition tools.hh:19
std::pair< bool, std::set< Time > > extract_times(const DataIO::Config &cfg)
Definition tools.hh:39
ValMode
Value calculation mode.
Definition tools.hh:10
@ Set
Set a value, discarding the current state.
@ Add
Add the new value to the existing value.
Definition env_param_func_collection.hh:8