Adiar 2.1.0
An External Memory Decision Diagram Library
Loading...
Searching...
No Matches
types.h
1#ifndef ADIAR_TYPES_H
2#define ADIAR_TYPES_H
3
4#include <optional>
5#include <utility>
6
7namespace adiar
8{
12 enum class assignment : signed char
13 {
15 False = 0,
17 True = 1,
19 None = -1
20 };
21
31 enum class replace_type : signed char
32 {
34 Auto = -1,
35
37 Non_Monotone = 8, // TODO
38
39 /* (Combination of 'Jump_Up' and 'Jump_Down'): Variable remapping which only swaps one pair of
40 variables in separate blocks.
41 */
42 // Swap = 7, // TODO
43
44 /* (Single-sweep version of 'Non_Monotone'): Variable remapping, only moving some variables up
45 without crossing other variables that are moving.
46 */
47 // Jump_Up = 6, // TODO
48
49 /* (Single-sweep version of 'Non_Monotone'): Variable remapping, only moving some variables down
50 without crossing other variables that are moving.
51 */
52 // Jump_Down = 5, // TODO
53
54 /* Variable remapping, only swapping variables that are adjacent to each other.
55 */
56 // Swap_Adjacent = 4, // TODO
57
59 Monotone = 3,
60
61 /* (faster version of 'Monotone'): `m(x) = ax + b` for some integers `a` and `b`. */
62 // Affine = 2, // TODO: Is there a use-case where this type of on-the-fly remapping is needed?
63
65 Shift = 1,
66
68 Identity = 0
69 };
70
74 template <typename T1, typename T2>
75 using pair = std::pair<T1, T2>;
76
80 template <typename T1, typename T2>
81 constexpr pair<T1, T2>
82 make_pair(const T1& t1, const T2& t2)
83 {
84 return std::make_pair(t1, t2);
85 }
86
87 /*
91 template<typename T1, typename T2>
92 constexpr pair<T1, T2>
93 make_pair(T1 &&t1, T2 &&t2)
94 { return std::make_pair(std::move(t1), std::move(t2)); }
95 */
96
102 template <typename T>
103 using optional = std::optional<T>;
104
108 template <typename T>
109 constexpr optional<T>
111 {
112 return optional<T>();
113 }
114
118 template <typename T>
119 constexpr optional<T>
121 {
122 return std::make_optional(t);
123 }
124
125 /*
129 template<typename T>
130 constexpr optional<T>
131 make_optional(T &&t)
132 { return std::make_optional(std::move(t)); }
133 */
134}
135
136#endif // ADIAR_TYPES_H
consumer< ValueType > make_consumer(OutputIt &&iter)
Wrap an iterator into a consumer function.
Definition functional.h:71
Core types.
Definition adiar.h:40
std::pair< T1, T2 > pair
A pair of values.
Definition types.h:75
replace_type
Possible guarantees of a variable permutation/remapping m of type int -> int.
Definition types.h:32
constexpr pair< T1, T2 > make_pair(const T1 &t1, const T2 &t2)
Create an adiar::pair, deducing the target type based on the types of the arguments.
Definition types.h:82
std::optional< T > optional
An optional value, i.e. a possibly existent value.
Definition types.h:103
constexpr optional< T > make_optional()
Create an empty adiar::optional, i.e. None.
Definition types.h:110
assignment
Possible values to assign a variable.
Definition types.h:13