SRS-control 0.1.4
Loading...
Searching...
No Matches
WriterConcept.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <concepts>
5#include <cstddef>
6#include <expected>
7#include <string_view>
8
9namespace srs::writer
10{
11
12 namespace internal
13 {
14
15 template <typename T>
16 class Dumpy
17 {
18 public:
19 auto operator()(std::size_t /*unused*/) -> T { return T{}; }
20 };
21
22 } // namespace internal
23
24 template <typename T>
25 concept WritableFile = requires(T writer, const internal::Dumpy<typename T::InputType>& converter) {
26 typename T::InputType;
27 typename T::OutputType;
28 requires std::derived_from<T, process::BaseTask<typename T::InputType, typename T::OutputType>>;
29 { writer.run(converter, 0) } -> std::same_as<std::expected<typename T::OutputType, std::string_view>>;
30 { writer.run(converter) } -> std::same_as<std::expected<typename T::OutputType, std::string_view>>;
31 { writer() } -> std::same_as<typename T::OutputType>;
32 { writer(0) } -> std::same_as<typename T::OutputType>;
33 requires not std::copyable<T>;
34 requires std::movable<T>;
35 };
36} // namespace srs::writer
auto operator()(std::size_t) -> T