12#include <initializer_list>
45 using Value = std::variant<BlockName, int, double, bool, std::shared_ptr<DBNode>, std::vector<std::shared_ptr<DBNode>>>;
76 template <
typename... Keys>
104 template <
typename T,
typename Key,
typename... Rest>
105 void set(
T value, Key&& key, Rest&&... rest);
119 std::map<BlockName, Value>
getGroup(
const std::vector<BlockName>& keys)
const;
131 void setGroup(
const std::vector<BlockName>& keys,
const std::map<BlockName, Value>& groupData);
197 std::map<BlockName, Value> data_;
207 template <
typename Map,
typename Key>
208 Value getRecursive(
const Map& map, Key&& key)
const;
217 template <
typename Map,
typename Key,
typename Next,
typename... Rest>
220 Value getRecursive(
const Map& map, Key&& key, Next&& next, Rest&&... rest)
const;
223 void printValue(
const Value& value,
int level)
const;
226 void printValueToStream(std::ostream& os,
const Value& value,
int level)
const;
229 void printScalarYAMLToStream(std::ostream& os,
const Value& value)
const;
232 void printScalarYAML(
const Value& value)
const;
240 bool isListDBNode(
const std::shared_ptr<DBNode>& node)
const;
Representation of SLHA / LHA block names with support for aliases.
Block identifier with alias support.
void setGroup(const std::vector< BlockName > &keys, const std::map< BlockName, Value > &groupData)
Sets the content of a whole sub-tree from a map of values.
Value get(Keys &&... keys) const
Retrieves a value from the node using a sequence of keys.
void printYAMLToStream(std::ostream &os, int level=0) const
Prints the node in YAML format to a given output stream.
DBNode()
Default constructor.
std::map< BlockName, Value > getGroup(const std::vector< BlockName > &keys) const
Retrieves a whole sub-tree as a map from a path of keys.
int countChildren() const
Returns the number of direct children of this node.
void set(T value, Key &&key, Rest &&... rest)
Sets a value in the node using a sequence of keys.
std::variant< BlockName, int, double, bool, std::shared_ptr< DBNode >, std::vector< std::shared_ptr< DBNode > > > Value
Variant type used to store values in the tree.
std::vector< BlockName > get_keys()
Returns all the keys stored at the current node level.
bool contains(const BlockName &key) const
Checks whether the node contains a direct child with the given key.
void printJSON(int level=0) const
Prints the node in JSON format to std::cout.
void printYAML(int level=0) const
Prints the node in YAML format to std::cout.
void printJSONToStream(std::ostream &os, int level=0) const
Prints the node in JSON format to a given output stream.
bool isList() const
Returns true if this node represents a "list" node.
double T(double x)
Wilson coefficient T(x).