11 #include <glog/logging.h> 23 inline std::ostream&
operator<<(std::ostream&,
const Algorithm&);
30 std::stringstream(s) >> val;
38 using StatMap = std::map<std::string, std::string>;
43 std::unique_ptr<pattern::Algorithm> m_static_selection;
52 std::unique_ptr<pattern::Algorithm>&& static_selection,
55 inline const std::string& name()
const;
58 inline const pattern::Algorithm& static_selection()
const;
76 inline bool is_algorithm()
const;
79 inline const std::string& as_string()
const;
80 inline uint64_t as_integer()
const;
81 inline double as_floating()
const;
82 inline bool as_bool()
const;
94 m_arguments(other.m_arguments),
95 m_ds_flags(other.m_ds_flags)
97 if (other.m_static_selection !=
nullptr) {
98 m_static_selection = std::make_unique<pattern::Algorithm>(
99 *other.m_static_selection);
104 m_name(
std::move(other.m_name)),
105 m_arguments(
std::move(other.m_arguments)),
106 m_static_selection(
std::move(other.m_static_selection)),
107 m_ds_flags(other.m_ds_flags) {}
125 CHECK(m_static_selection !=
nullptr);
126 return *m_static_selection;
129 this->m_name = std::move(other.m_name);
130 this->m_arguments = std::move(other.m_arguments);
131 this->m_static_selection = std::move(other.m_static_selection);
132 this->m_ds_flags = std::move(other.m_ds_flags);
147 m_value_or_algorithm(
std::move(algorithm)) {}
150 m_is_value(other.m_is_value),
151 m_value_or_algorithm(other.m_value_or_algorithm) {}
154 m_is_value(other.m_is_value),
155 m_value_or_algorithm(
std::move(other.m_value_or_algorithm)) {}
162 return m_value_or_algorithm;
167 return std::move(m_value_or_algorithm);
172 return m_value_or_algorithm.m_name;
182 if (s ==
"true")
return true;
183 if (s ==
"false")
return false;
184 throw std::runtime_error(std::string(
"option with string value '")
186 +
"' can not be converted to an boolean value!");
193 this->m_is_value = other.m_is_value;
194 this->m_value_or_algorithm = std::move(other.m_value_or_algorithm);
199 os << av.
name() <<
" {";
202 os << e.first <<
" : " << e.second <<
", ";
212 return os <<
"string: " << ov.
as_string();
Contains the text compression and encoding framework.
AlgorithmValue(const AlgorithmValue &other)
uint_impl_t & operator=(const uint_impl_t &b)
std::ostream & operator<<(std::ostream &os, const uint_impl_t< N > &v)
const std::string & as_string() const
const std::string & name() const
const pattern::Algorithm & static_selection() const
std::map< std::string, std::string > StatMap
uint64_t as_integer() const
AlgorithmValue & operator=(AlgorithmValue &&other)
std::map< std::string, OptionValue > ArgumentMap
AlgorithmValue to_algorithm() &&
bool is_algorithm() const
OptionValue & operator=(OptionValue &&other)
const ArgumentMap & arguments() const
ds::InputRestrictionsAndFlags textds_flags() const
const AlgorithmValue & as_algorithm() const
double as_floating() const
T lexical_cast(const std::string &s)