Telamon
NormalizedRepresentation.hh
Go to the documentation of this file.
1 
5 #ifndef TELAMON_NORMALIZED_REPRESENTATION_HH
6 #define TELAMON_NORMALIZED_REPRESENTATION_HH
7 
8 #include <concepts>
9 #include <variant>
10 #include <vector>
11 #include <thread>
12 #include <algorithm>
13 #include <ranges>
14 #include <mutex>
15 #include <numeric>
16 #include <utility>
17 #include <iterator>
18 #include <optional>
19 
20 #include <extern/expected_lite/expected.hpp>
21 
22 #include "Versioning.hh"
23 
25 namespace telamon_simulator {
26 
29 template<typename Commit>
30 concept Commits = requires (Commit desc) {
31  requires std::ranges::input_range<Commit>;
32  requires CasWithVersioning<std::ranges::range_value_t<Commit>>;
33 };
34 
40 template<typename LockFree>
41 concept NormalizedRepresentation = requires (LockFree lf,
42  ContentionFailureCounter &contention,
43  const typename LockFree::Input &inp,
44  const typename LockFree::Commit &desc,
45  const nonstd::expected<std::monostate, std::optional<int>> &executed
46 ){
47  typename LockFree::Input;
48  typename LockFree::Output;
49  typename LockFree::Commit;
50 
51  requires Commits<typename LockFree::Commit>;
52  requires std::is_copy_constructible_v<typename LockFree::Commit>;
53 
54  { lf.generator(inp, contention) } -> std::same_as<std::optional<typename LockFree::Commit>>;
55  { lf.wrap_up(executed, desc, contention) } -> std::same_as<nonstd::expected<std::optional<typename LockFree::Output>, std::monostate>>;
56  { lf.fast_path(inp, contention) } -> std::same_as<std::optional<typename LockFree::Output>>;
57 };
58 
59 }
60 
61 #endif // TELAMON_NORMALIZED_REPRESENTATION_HH
Definitions of ContentionFailureCounter, CasStatus, CasDescriptor, CasWithVersioning,...
Measures the contention which was encountered during simulation.
Definition: Versioning.hh:13
This module encapsulates the implementation of the simulator.
Definition: NormalizedRepresentation.hh:25
concept Commits
Requires commit to be iterable and its items to satisfy CasWithVersioning.
Definition: NormalizedRepresentation.hh:30
concept NormalizedRepresentation
Here are the operations which are required to be described in the lock-free algorithm in order to use...
Definition: NormalizedRepresentation.hh:41