32 #ifndef DRAIN_VARIABLEMAP_H
33 #define DRAIN_VARIABLEMAP_H
49 #include <drain/Variable.h>
50 #include <drain/FlexibleVariable.h>
54 #ifndef DRAIN_SMAP_NAME
55 #define DRAIN_SMAP_NAME VariableMap
86 for (
const auto & entry: inits){
87 (*this)[entry.first] = entry.second;
97 (*this)[entry.first] = entry.second;
110 VariableMap & operator=(
const std::map<std::string,T> & m){
111 if (&m != this->
getMap()){
123 std::ostream &
Sprinter::toStream(std::ostream & ostr,
const VariableMap & vmap,
const SprinterLayout & layout){
162 FlexVariableMap & link(
const std::string &key, T & target){
163 (*this)[key].link(target);
168 void clearVariables(){
171 if (!it->second.isLinking()){
180 if (it == this->end()){
192 std::ostream &
Sprinter::toStream(std::ostream & ostr,
const FlexVariableMap & vmap,
const SprinterLayout & layout){
195 ostr <<
"UNSET_LAYOUT:";
A map of FlexVariable:s.
Definition: VariableMap.h:138
FlexVariableMap(const FlexVariableMap &m)
Copies a map like VariableMap does - creates an own entry for every input entry.
Definition: VariableMap.h:149
A base class for smart maps providing methods for importing and exporting values, among others.
Definition: SmartMap.h:66
map_t::iterator iterator
Needed?
Definition: SmartMap.h:80
char separator
Default character used for splitting input and output. See setValues.
Definition: SmartMap.h:85
const map_t & getMap() const
Definition: SmartMap.h:206
void importMap(const std::map< std::string, S > &m)
Assign values from a map, overriding existing entries.
Definition: SmartMap.h:252
static std::ostream & sequenceToStream(std::ostream &ostr, const T &x, const SprinterLayout &layout)
Convenience: if sequence type (array, list, set, map) not given, assume array.
Definition: Sprinter.h:321
static std::ostream & toStream(std::ostream &ostr, const std::initializer_list< T > &x, const SprinterLayout &layout=defaultLayout)
New (experimental)
Definition: Sprinter.h:420
static const SprinterLayout UNSET_LAYOUT
Marker for unset layout.
Definition: Sprinter.h:200
static const SprinterLayout jsonLayout
Resembles JSON structure: {"a":1,"b":22,"c":3}.
Definition: Sprinter.h:221
A map of Variables.
Definition: VariableMap.h:61
VariableMap(char separator=',')
Default constructor.
Definition: VariableMap.h:67
VariableMap(std::initializer_list< Variable::init_pair_t > inits)
Constructor for initializer lists.
Definition: VariableMap.h:84
VariableMap(const VariableMap &v)
Copy constructor.
Definition: VariableMap.h:73
VariableMap(Variable::init_pair_t &entry)
Experimental constructor.
Definition: VariableMap.h:96
VariableT is a final class applied through typedefs Variable, Reference and FlexibleVariable.
Definition: VariableT.h:87
Definition: DataSelector.cpp:1277
DRAIN_VARIABLE Variable
Value container supporting dynamic type.
Definition: Variable.h:63