parameter_set.h Source File
|
CPP API
|
parameter_set.h
Go to the documentation of this file.
41 struct has_get_default_member_function<T, std::void_t<decltype(T::get_default(std::declval<Args>()...))>, Args...>
52 using has_get_default_member_function = details::has_get_default_member_function<T, void, Args...>;
64 static std::enable_if_t<has_get_default_member_function<Dummy, Ts...>::value, Type> get_default(Ts&&... args)
71 !has_get_default_member_function<Dummy, Ts...>::value && std::is_default_constructible<Type>::value, Type>
165 //An alias is immediately replaced and discarded when the compiler sees it, but this could leave the template F with some
166 //parameters bound and some free, which is not allowed. A struct that derives from F is persistent during compilation.
217 class = std::enable_if_t<details::AllOf<std::is_default_constructible, typename Tags::Type...>::value, Dummy>>
246 // Avoid erroneous template deduction for T1=ParameterSet as this constructor could falsely be considered
306 std::enable_if_t<has_get_default_member_function<ParameterTagTraits<Tag>, T...>::value, void> set_default(T&&... ts)
352 template <class Dummy = void, class = std::enable_if_t<(sizeof...(Tags) > 0), Dummy>, class = Dummy>
366 //read current parameter, append result to results of previous parameters, recurse to next parameter
368 auto r = obj.expect_element(TaggedParameter::Tag::name(), mio::Tag<typename TaggedParameter::Type>{});
375 static IOResult<ParameterSet> deserialize_recursive(IOContext& io, IOObject& /*obj*/, Rs&&... rs)
410 struct ParameterTag<I, ParameterSet<Head, Tail...>> : public ParameterTag<I - 1, ParameterSet<Tail...>> {
void set(const typename ParameterTagTraits< Tag >::Type &value)
set value of a parameter
Definition: parameter_set.h:283
static IOResult< ParameterSet > deserialize_recursive(IOContext &io, IOObject &, Rs &&... rs)
Definition: parameter_set.h:375
std::tuple< details::TaggedParameter< Tags >... > m_tup
Definition: parameter_set.h:400
std::enable_if_t< has_get_default_member_function< ParameterTagTraits< Tag >, T... >::value, void > set_default(T &&... ts)
(re)set parameter to its default value
Definition: parameter_set.h:306
static constexpr size_t size()
returns the number of parameters
Definition: parameter_set.h:315
ParameterSet(T1 &&arg1, TN &&... argn)
default initializing constructor.
Definition: parameter_set.h:251
bool operator!=(const ParameterSet &b) const
Definition: parameter_set.h:325
static IOResult< ParameterSet > deserialize(IOContext &io)
deserialize an object of this class.
Definition: parameter_set.h:393
ParameterSet()
default initializing constructor Initializes each parameter using either the get_default function def...
Definition: parameter_set.h:230
static IOResult< ParameterSet > deserialize_recursive(IOContext &io, IOObject &obj, Rs &&... rs)
Definition: parameter_set.h:364
bool operator==(const ParameterSet &b) const
Definition: parameter_set.h:320
void serialize(IOContext &io) const
serialize this.
Definition: parameter_set.h:335
ParameterSet(NoDefaultInit)
Non-initializing default constructor.
Definition: parameter_set.h:218
ParameterTagTraits< Tag >::Type & get()
get value of a parameter
Definition: parameter_set.h:273
const ParameterTagTraits< Tag >::Type & get() const
get value of a parameter
Definition: parameter_set.h:262
ParameterSet(const typename Tags::Type &... t)
Internal constructor taking a value for each parameter, and initializing it.
Definition: parameter_set.h:353
Definition: parameter_set.h:83
bool operator==(const TaggedParameter< T > &other) const
Definition: parameter_set.h:117
TaggedParameter(Ts &&... args)
Definition: parameter_set.h:91
bool operator!=(const TaggedParameter< T > &other) const
Definition: parameter_set.h:123
std::enable_if_t< sizeof...(Tail)==0, void > foreach_impl(Params &&, F)
Definition: parameter_set.h:432
std::enable_if_t< sizeof...(Tail)==0, void > foreach_tag_impl(F, std::index_sequence< Tail... >)
Definition: parameter_set.h:444
int size(Comm comm)
Return the size of the given communicator.
Definition: miompi.cpp:75
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
details::ParameterTag< I, ParamSet > ParameterTag
get the the tag of the I-th parameter in a set
Definition: parameter_set.h:423
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:407
void foreach_tag(F f)
call f(t) for all parameters in a ParameterSet with t a default constructed parameter tag
Definition: parameter_set.h:465
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:481
typename ParameterTag< I, ParamSet >::Type ParameterTagT
Definition: parameter_set.h:426
std::is_same< NoDefaultInit, T > is_no_default_init_tag
Definition: parameter_set.h:189
details::has_get_default_member_function< T, void, Args... > has_get_default_member_function
check whether a get_default function exists
Definition: parameter_set.h:52
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:353
Definition: io.h:94
A tag used for tag-dispatching the Constructor of ParameterSet, triggering default initialization of ...
Definition: parameter_set.h:185
static std::enable_if_t< !has_get_default_member_function< Dummy, Ts... >::value &&std::is_default_constructible< Type >::value, Type > get_default(Ts &&...)
Definition: parameter_set.h:72
static std::enable_if_t< has_get_default_member_function< Dummy, Ts... >::value, Type > get_default(Ts &&... args)
Definition: parameter_set.h:64
Definition: parameter_set.h:134
Definition: parameter_set.h:147
Definition: parameter_set.h:173
Definition: parameter_set.h:171
Definition: parameter_set.h:162
Definition: parameter_set.h:160
Head Type
Definition: parameter_set.h:415
Definition: parameter_set.h:407
Definition: parameter_set.h:37
Generated by