GridFormat
0.6.0
I/O-Library for grid-like data structures
Toggle main menu visibility
Loading...
Searching...
No Matches
concepts.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2022-2023 Dennis Gläser <dennis.glaeser@iws.uni-stuttgart.de>
2
// SPDX-License-Identifier: MIT
8
#ifndef GRIDFORMAT_ENCODING_CONCEPTS_HPP_
9
#define GRIDFORMAT_ENCODING_CONCEPTS_HPP_
10
11
#include <cstddef>
12
#include <istream>
13
#include <span>
14
15
#include <gridformat/common/concepts.hpp>
16
#include <gridformat/common/serialization.hpp>
17
18
namespace
GridFormat::Concepts {
19
25
template
<
typename
T,
typename
S>
26
concept
Encoder
=
requires
(
const
T& encoder, S& stream) {
27
{ encoder(stream) } -> WriterFor<std::span<const std::byte>>;
28
};
29
34
template
<
typename
T>
35
concept
Decoder
=
requires
(
const
T& decoder,
36
std::istream& input_stream,
37
std::span<char> characters) {
38
{ decoder.decode(characters) } -> std::convertible_to<std::size_t>;
39
{ decoder.decode_from(input_stream, std::size_t{}) } -> std::same_as<Serialization>;
40
};
41
42
}
// namespace GridFormat::Concepts
43
44
#endif
// GRIDFORMAT_ENCODING_CONCEPTS_HPP_
GridFormat::Concepts::Decoder
Decoders allow decoding spans of characters or directly from an input stream.
Definition
concepts.hpp:35
GridFormat::Concepts::Encoder
Encoders allow wrapping of an output stream, yielding a stream that allows writing spans of data to i...
Definition
concepts.hpp:26
gridformat
encoding
concepts.hpp
Generated by
1.18.0