10 #include <opals/fwd.hpp>
11 #include <opals/UsageLevel.hpp>
12 #include <opals/ValueSource.hpp>
13 #include <opals/OptionNames.hpp>
14 #include <type_traits>
33 using NameT = std::integral_constant<Names, nam>;
36 using NodeT = std::integral_constant<Nodes, nod>;
61 template<Names nam,
bool cnst,
class T>
65 using Name = NameT<nam>;
66 using Node = NodeT<Nodes::value>;
74 virtual bool empty()
const = 0;
76 virtual explicit operator bool()
const = 0;
79 virtual const T&
get()
const = 0;
81 virtual T
getOr(T&& default_)
const = 0;
82 virtual const T&
getOr(
const T& default_)
const = 0;
89 template<Names nam,
class T>
94 virtual void set(
const T& value) = 0;
101 template<Names nam,
bool cnst,
class T>
105 using Name = NameT<nam>;
106 using Node = NodeT<Nodes::feed>;
115 template<Names nam,
class T>
120 virtual void set(
const Vector<T>& values) = 0;
125 #include <opals/IAccess.hpp>
135 template<
Names nam,
class... Opts>
139 using Name = NameT<nam>;
140 using Node = NodeT<Nodes::group>;
143 template<
Names, bool,
class...>
146 template<
Names, size_t,
class...>
157 template<Names nam,
bool cnst,
class T>
163 template<Names nam,
bool cnst,
class T>
169 template<
Names nam,
class... Opts>
175 template<
Names nam,
bool cnst,
class... Opts>
181 template<
Names nam,
size_t n,
class... Opts>
193 using Element_ =
typename std::conditional<
194 std::is_const<Cont>::value,
195 typename std::add_const<typename Cont::Element>::type,
196 typename Cont::Element>::type;
198 using iterator_category = std::input_iterator_tag;
199 using difference_type = ptrdiff_t;
200 using value_type = Element_;
201 using reference = value_type&;
202 using pointer = value_type*;
204 Iterator(Cont* cont =
nullptr,
size_t pos = 0) : cont_(cont), pos_(pos) {}
206 reference operator* ()
const {
return (*cont_)[pos_]; }
207 pointer operator->()
const {
return &(*cont_)[pos_]; }
208 Iterator& operator++() { ++pos_;
return *
this; }
210 friend bool operator==(
const Iterator& a,
const Iterator& b) {
return a.cont_ == b.cont_ && a.pos_ == b.pos_; };
211 friend bool operator!=(
const Iterator& a,
const Iterator& b) {
return !(a == b); };
218 template<
Names nam,
class... Opts>
222 using Name = NameT<nam>;
224 using Feed = ifeed::Type<Element>;
227 virtual size_t size()
const = 0;
229 virtual bool empty()
const = 0;
233 virtual const Element& operator[](
size_t idx)
const = 0;
234 virtual Element& operator[](
size_t idx) = 0;
240 virtual const Element& all()
const = 0;
247 virtual const Feed& feed()
const = 0;
248 virtual Feed& feed() = 0;
265 return {
this,
size() };
270 return {
this,
size() };
279 template<
Names nam,
bool cnst,
class... Opts>
283 using Node = NodeT<Nodes::vector>;
287 template<
Names nam,
class... Opts>
291 using Node = NodeT<Nodes::vector>;
293 virtual void resize(
size_t size) = 0;
301 template<
Names nam,
size_t n,
class... Opts>
305 using Node = NodeT<Nodes::array>;
virtual UsageLevel minUsageLevel() const =0
For a leaf, this is its own usage level. Otherwise, this is the minimum usage level of all descendant...
virtual ValueSource valueSource() const =0
The context in which the value has been set.
Nodes
Enumerates the main option types.
Definition: IOption.hpp:23
virtual size_t size() const =0
The number of actual elements.
virtual const T & get() const =0
Get the value.
virtual bool empty() const =0
Returns size() == 0.
Definition: IOption.hpp:152
A leaf that feeds values to its targets.
Definition: IOption.hpp:102
A leaf that holds a value.
Definition: IOption.hpp:62
A container of options.
Definition: IOption.hpp:219
virtual UsageLevel usageLevel() const =0
Frequency / expected skills of users that access this leaf.
Definition: IOption.hpp:189
virtual Nodes node() const =0
The node type of this option.
UsageLevel
Frequency of use / needed level of user experience of an option.
Definition: UsageLevel.hpp:8
virtual String shortDescription() const =0
One-liner that describes this option.
Contains the public interface of OPALS.
Definition: AbsValueOrQuantile.hpp:8
virtual T getOr(T &&default_) const =0
Get the value or default_ if empty.
ValueSource
Origin of an option value.
Definition: ValueSource.hpp:8
virtual String longDescription() const =0
Longer text that describes this option in more detail.
virtual bool empty() const =0
If its value has not been set, a leaf is considered empty.
Names
Enumerates all option names.
Definition: OptionNames.hpp:19
virtual String name() const =0
The option name as string.
An array of N options.
Definition: IOption.hpp:147
virtual Names enumerator() const =0
The option name as enumerator.
Mimics std::vector<T>
Definition: fwd.hpp:18
A group of options.
Definition: IOption.hpp:136
@ vector
General vector data file (las, shp, ..)
typename IAcc_< Opts... >::Type IAcc
The specialization of IAcc for the first member of a group.
Definition: IAccess.hpp:3927
virtual String path() const =0
The option name as string, preceded by the names of its parents, if any, interspersed with '....
A dynamic character string whose interface conforms to STL's std::string.
Definition: String.hpp:35
A vector of a variable number of options.
Definition: IOption.hpp:144
Base class of all option types.
Definition: IOption.hpp:39