cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
print.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_BASIC_FUNCTIONS_PRINT_H
4#define pRC_CORE_BASIC_FUNCTIONS_PRINT_H
5
6#include <cstdio>
7
14
15namespace pRC
16{
17 template<Size N>
18 static inline auto print(String<N> const &string, std::FILE *stream)
19 {
21 [&string, &stream](auto const i)
22 {
23 if(string[i] != '\0')
24 {
25 std::fputc(string[i], stream);
26 }
27 });
28 }
29
30 template<class T, T... Is, class S>
31 static inline auto print(Sequence<T, Is...> const, S &&stream)
32 {
33 print(name<Sequence<T, Is...>>(), stream);
34 }
35
36 template<class S>
37 static inline auto print(Direction const direction, S &&stream)
38 {
39 switch(direction)
40 {
42 print("pRC::Direction::Leftwards", stream);
43 break;
45 print("pRC::Direction::Rightwards", stream);
46 break;
48 print("pRC::Direction::Upwards", stream);
49 break;
51 print("pRC::Direction::Downwards", stream);
52 break;
54 print("pRC::Direction::Forwards", stream);
55 break;
57 print("pRC::Direction::Backwards", stream);
58 break;
59 default:
60 print("pRC::Direction::Unknown", stream);
61 break;
62 }
63 }
64
65 template<class S>
66 static inline auto print(Context const context, S &&stream)
67 {
68 switch(context)
69 {
71 print("pRC::Context::CompileTime", stream);
72 break;
74 print("pRC::Context::RunTime", stream);
75 break;
76 default:
77 print("pRC::Context::Unknown", stream);
78 break;
79 }
80 }
81}
82#endif // pRC_CORE_BASIC_FUNCTIONS_PRINT_H
Definition value.hpp:12
Definition sequence.hpp:29
Definition string.hpp:16
TN::Subscripts S
Definition externs_nonTT.hpp:9
pRC::Float<> T
Definition externs_nonTT.hpp:1
int i
Definition gmock-matchers-comparisons_test.cc:603
Definition cholesky.hpp:10
static auto print(String< N > const &string, std::FILE *stream)
Definition print.hpp:18
static constexpr auto name()
Definition type_name.hpp:11
Context
Definition context.hpp:9
static constexpr auto range(F &&f, Xs &&...args)
Definition range.hpp:18
Direction
Definition direction.hpp:9