-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTVerb.hpp
118 lines (95 loc) · 5.05 KB
/
TVerb.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
///
/// Langulus::Flow
/// Copyright (c) 2017 Dimo Markov <[email protected]>
/// Part of the Langulus framework, see https://langulus.com
///
/// SPDX-License-Identifier: GPL-3.0-or-later
///
#pragma once
#include "Verb.hpp"
namespace Langulus::Flow
{
///
/// Statically typed verb, used as CRTP for all specific verbs
///
template<class VERB>
struct TVerb : Verb {
LANGULUS_BASES(Verb);
using VerbType = VERB;
///
/// Construction
///
constexpr TVerb() noexcept = default;
TVerb(const TVerb&);
TVerb(TVerb&&);
template<CT::Data T1, CT::Data...TN> requires CT::VerbMakable<T1, TN...>
TVerb(T1&&, TN&&...);
NOD() static VERB From(const Charge& = {}, VerbState = {});
NOD() static VERB From(CT::UnfoldInsertable auto&&, const Charge& = {}, VerbState = {});
NOD() VERB Fork(auto&&...) const noexcept;
///
/// Assignment
///
using Verb::operator =;
TVerb& operator = (const TVerb&);
TVerb& operator = (TVerb&&);
NOD() explicit operator Code() const;
NOD() explicit operator Text() const;
///
/// Assignment
///
template<CT::Data T1, CT::Data...TN>
requires CT::UnfoldInsertable<T1, TN...>
VERB& SetSource(T1&&, TN&&...);
template<CT::Data T1, CT::Data...TN>
requires CT::UnfoldInsertable<T1, TN...>
VERB& SetArgument(T1&&, TN&&...);
template<CT::Data T1, CT::Data...TN>
requires CT::UnfoldInsertable<T1, TN...>
VERB& SetOutput(T1&&, TN&&...);
///
/// Charge arithmetics
///
VERB operator * (Real) const;
VERB operator ^ (Real) const;
VERB& operator *= (Real) noexcept;
VERB& operator ^= (Real) noexcept;
///
/// Capsulation
///
NOD() Hash GetHash() const;
VERB& ShortCircuit(bool) noexcept;
VERB& Multicast(bool) noexcept;
VERB& SetVerbState(VerbState) noexcept;
VERB& Invert() noexcept;
VERB& SetMass(Real) noexcept;
VERB& SetRate(Real) noexcept;
VERB& SetTime(Real) noexcept;
VERB& SetPriority(Real) noexcept;
VERB& SetCharge(const Charge&) noexcept;
///
/// RTTI
///
template<CT::Verb>
NOD() constexpr bool IsVerb() const noexcept;
NOD() constexpr bool IsVerb(VMeta) const noexcept;
NOD() constexpr VMeta GetVerb() const noexcept;
NOD() constexpr Token GetToken() const;
///
/// Comparison
///
NOD() bool operator == (const CT::VerbBased auto&) const;
NOD() bool operator == (VMeta) const noexcept;
///
/// Insertion
///
VERB& operator << (CT::UnfoldInsertable auto&&);
VERB& operator >> (CT::UnfoldInsertable auto&&);
VERB& operator <<= (CT::UnfoldInsertable auto&&);
VERB& operator >>= (CT::UnfoldInsertable auto&&);
private:
// Functionality graveyard
using Verb::SetVerb;
using Verb::FromMeta;
};
} // namespace Langulus::Flow