Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
configured.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//configured.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//configured.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with configured.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
27
28#pragma once
29
31
32namespace bertini {
33
34 namespace detail{
35
36
81 template<typename ...Ts>
83 {
84 std::tuple<Ts...> configuration_;
85
87 template<typename ... T>
88 Configured(T const& ...t) : configuration_(t...)
89 {}
90
91
93 template<typename T, typename = typename std::enable_if<IsTemplateParameter<T,Ts...>::value>::type>
94 const T& Get() const
95 {
96 return std::get<T>(configuration_);
97 }
98
100 template<typename T, typename = typename std::enable_if<IsTemplateParameter<T,Ts...>::value>::type>
101 void Set(T const& t)
102 {
103 std::get<T>(configuration_) = t;
104 }
105
106 using UsedConfigs = TypeList<Ts...>;
107
108 }; // Configured
109
111 template<typename ...Ts>
112 struct Configured<TypeList<Ts...>> : public Configured<Ts...>
113 {
115 template<typename ... T>
116 Configured(T const& ...t) : Configured<Ts...>(t...)
117 {}
118
120 Configured() : Configured<Ts...>() {}
121
122 };
123
125 #define FORWARD_GET_CONFIGURED \
126 template <typename T> \
127 const T& Get() const \
128 { return Config::template Get<T>();}
129
130 } // namespace detail
131}
Contains the detail/is_template_parameter helper, for checking whether a type is a template parameter...
Definition configured.hpp:34
Definition algorithm_builder.hpp:36
Configured(T const &...t)
Construct, forwarding the given values to the base Configured.
Definition configured.hpp:116
Configured()
Default-construct the held configuration objects.
Definition configured.hpp:120
const T & Get() const
Get the held configuration object of type T.
Definition configured.hpp:94
void Set(T const &t)
Set the held configuration object of type T.
Definition configured.hpp:101
std::tuple< Ts... > configuration_
Definition configured.hpp:84
TypeList< Ts... > UsedConfigs
The list of configuration types this object holds.
Definition configured.hpp:106
Configured(T const &...t)
Construct, forwarding the given values into the held configuration tuple.
Definition configured.hpp:88
Base template, which says 'no', it's not in the pack.
Definition is_template_parameter.hpp:42
A basic typelist, in the style of Modern C++ Design, but using variadic templates.
Definition typelist.hpp:42