23 #include <yaml-cpp/yaml.h> 39 std::string
choose()
const;
41 void set(
const std::string &id,
size_t weight);
43 bool empty()
const {
return 0 == _totalWeight; }
45 void clear() { _totalWeight = 0; _choices.clear(); }
47 void load(
const YAML::Node &node);
49 YAML::Node
save()
const;
53 std::map<std::string, size_t> _choices;
std::string choose() const
Select from among the items.
Definition: WeightedOptions.cpp:31
WeightedOptions()
Create an empty set.
Definition: WeightedOptions.h:37
void clear()
Remove all entries.
Definition: WeightedOptions.h:45
YAML::Node save() const
Store our list in YAML.
Definition: WeightedOptions.cpp:100
bool empty() const
Is this empty?
Definition: WeightedOptions.h:43
std::vector< std::string > getNames()
Get the list of strings associated with these weights.
Definition: WeightedOptions.cpp:114
Holds pairs of relative weights and IDs.
Definition: WeightedOptions.h:33
void load(const YAML::Node &node)
Update our list with data from YAML.
Definition: WeightedOptions.cpp:86
Definition: BaseInfoState.cpp:40