12 #ifndef HAMMER_Setting_HH
13 #define HAMMER_Setting_HH
21 #include <type_traits>
23 #include <boost/variant.hpp>
28 #include "yaml-cpp/yaml.h"
33 struct SettingYamlConverter;
50 Setting(
const Serial::FBSetting* msgreader);
96 std::string
toString(
const bool useDefault =
false)
const;
115 using
SettingType = boost::variant<boost::blank, bool, int, double, std::string, std::complex<double>,
116 std::vector<std::string>, std::vector<double>, MatrixType>;
119 void
read(const Serial::FBSetting* msgreader);
131 YAML::Emitter& operator<<(YAML::Emitter& out, const Setting& s);
138 struct convert<::Hammer::Setting> {
140 static Node encode(const ::Hammer::Setting& value);
142 static bool decode(const Node& node, ::Hammer::Setting& value);
147 #include "Hammer/Tools/SettingDefs.hh"
Setting & operator=(const Setting &other)
std::vector< std::vector< double >> MatrixType
void update(const Setting &other)
Forward declaration of serialization related typedefs and includes.
Hammer data types declarations.
static bool _encodeUseDefault
T * getDefault()
get the default value of this setting
void reset()
reset the contents of the settings
void read(const Serial::FBSetting *msgreader)
WrittenSettingType write(flatbuffers::FlatBufferBuilder *msgwriter) const
T * getValue()
access the setting value
std::pair< flatbuffers::Offset< void >, Serial::FBSettingTypes > WrittenSettingType
boost::variant< boost::blank, bool, int, double, std::string, std::complex< double >, std::vector< std::string >, std::vector< double >, MatrixType > SettingType
data type for the setting values
void setValue(const T &value)
modify the setting value
bool isSame(const Setting &other) const
SettingType _default
setting default value
container for an Hammer run option
static void setEncodeUseDefault(bool useDefault)
std::string toString(const bool useDefault=false) const
properly format the value of the setting (so that can be e.g.
SettingType _value
setting value
Setting()
default constructor