ifw-daq 3.1.0
IFW Data Acquisition modules
Loading...
Searching...
No Matches
daqifFake.hpp
Go to the documentation of this file.
1#ifndef DAQ_OCM_SERVER_FAKE_OCM_SERVER_IF_HPP_
2#define DAQ_OCM_SERVER_FAKE_OCM_SERVER_IF_HPP_
3
4#include <Daqif.hpp>
5namespace daqif {
6
7struct DaqReplyFake : DaqReply {
8 std::string m_id;
9 bool m_error;
10
11 std::string getId() const override {
12 return m_id;
13 }
14 void setId(std::string const& id) override {
15 m_id = id;
16 }
17
18 bool getError() const override {
19 return m_error;
20 }
21 void setError(bool error) override {
22 m_error = error;
23 }
24 // Mal pub/sub API which has nothing to do with req rep.
25 bool hasKey() const override {
26 return false;
27 }
28 bool keyEquals(const DaqReply& other) const override {
29 return false;
30 }
31 std::unique_ptr<DaqReply> cloneKey() const override {
32 return {};
33 }
34 std::unique_ptr<DaqReply> clone() const override {
35 return {};
36 }
37};
38
39struct DaqStatusFake : DaqStatus {
40 std::string m_id;
41 std::string m_file_id;
42 std::string m_message;
43 daqif::DaqState m_state;
44 daqif::DaqSubState m_sub_state;
45 bool m_error;
46 std::string m_result;
47 double m_timestamp;
48
49 std::string getId() const override {
50 return m_id;
51 }
52 void setId(std::string const& id) override {
53 m_id = id;
54 }
55 std::string getFileId() const override {
56 return m_file_id;
57 }
58 void setFileId(std::string const& id) override {
59 m_file_id = id;
60 }
61 std::string getMessage() const override {
62 return m_message;
63 }
64 void setMessage(std::string const& message) override {
65 m_message = message;
66 }
67 daqif::DaqState getState() const override {
68 return m_state;
69 }
70 void setState(daqif::DaqState s) override {
71 m_state = s;
72 }
73 daqif::DaqSubState getSubState() const override {
74 return m_sub_state;
75 }
76 void setSubState(daqif::DaqSubState s) override {
77 m_sub_state = s;
78 }
79 bool getError() const override {
80 return m_error;
81 }
82 void setError(bool e) override {
83 m_error = e;
84 }
85 std::string getResult() const override {
86 return m_result;
87 }
88 void setResult(std::string const& result) override {
89 m_result = result;
90 }
91 double getTimestamp() const override {
92 return m_timestamp;
93 }
94 void setTimestamp(double d) override {
95 m_timestamp = d;
96 }
97
98 // Mal pub/sub API which has nothing to do with req rep.
99 bool hasKey() const override {
100 return false;
101 }
102 bool keyEquals(const DaqStatus& other) const override {
103 return false;
104 }
105 std::unique_ptr<DaqStatus> cloneKey() const override {
106 return {};
107 }
108 std::unique_ptr<DaqStatus> clone() const override {
109 return {};
110 }
111};
112
113struct AwaitDaqReplyFake : AwaitDaqReply {
114 AwaitDaqReplyFake() : m_timeout(false), m_status(std::make_shared<DaqStatusFake>()) {
115 }
116 bool getTimeout() const override {
117 return m_timeout;
118 }
119 void setTimeout(bool t) override {
120 m_timeout = t;
121 }
122 std::shared_ptr<daqif::DaqStatus> getStatus() const override {
123 return m_status;
124 }
125
126 // This doesn't exist in older MAL versions so `override` is not specified.
127 // NOLINTNEXTLINE
128 void setStatus(std::shared_ptr<daqif::DaqStatus> const& status) {
129 m_status = status;
130 }
131
132 // Mal pub/sub API which has nothing to do with req rep.
133 bool hasKey() const override {
134 return false;
135 }
136 bool keyEquals(const AwaitDaqReply& other) const override {
137 return false;
138 }
139 std::unique_ptr<AwaitDaqReply> cloneKey() const override {
140 return {};
141 }
142 std::unique_ptr<AwaitDaqReply> clone() const override {
143 return {};
144 }
145
146 bool m_timeout;
147 std::shared_ptr<daqif::DaqStatus> m_status;
148};
149
150struct StorageStatusFake : StorageStatus {
151 uint64_t m_free = 0;
152 uint64_t m_available = 0;
153 uint64_t m_capacity = 0;
154
155 uint64_t getFree() const override {
156 return m_free;
157 }
158 void setFree(uint64_t free) override {
159 m_free = free;
160 }
161 uint64_t getCapacity() const override {
162 return m_capacity;
163 }
164 void setCapacity(uint64_t capacity) override {
165 m_capacity = capacity;
166 }
167 uint64_t getAvailable() const override {
168 return m_available;
169 }
170 void setAvailable(uint64_t available) override {
171 m_available = available;
172 }
173 // Mal pub/sub API which has nothing to do with req rep.
174 bool hasKey() const override {
175 return false;
176 }
177 bool keyEquals(const StorageStatus& other) const override {
178 return false;
179 }
180 std::unique_ptr<StorageStatus> cloneKey() const override {
181 return {};
182 }
183 std::unique_ptr<StorageStatus> clone() const override {
184 return {};
185 }
186};
187
188} // namespace daqif
189#endif // #ifndef DAQ_OCM_SERVER_FAKE_OCM_SERVER_IF_HPP_
Definition: main.cpp:24
bool getTimeout() const override
Definition: daqifFake.hpp:116
std::shared_ptr< DaqStatusFake > m_status
Definition: daqifFake.hpp:141
void setTimeout(bool t) override
Definition: daqifFake.hpp:119
std::unique_ptr< AwaitDaqReply > cloneKey() const override
Definition: daqifFake.hpp:139
std::shared_ptr< daqif::DaqStatus > m_status
Definition: daqifFake.hpp:147
std::shared_ptr< daqif::DaqStatus > getStatus() const override
Definition: daqifFake.hpp:122
bool hasKey() const override
Definition: daqifFake.hpp:133
std::unique_ptr< AwaitDaqReply > clone() const override
Definition: daqifFake.hpp:142
bool keyEquals(const AwaitDaqReply &other) const override
Definition: daqifFake.hpp:136
void setStatus(std::shared_ptr< daqif::DaqStatus > const &status)
Definition: daqifFake.hpp:128
bool hasKey() const override
Definition: daqifFake.hpp:25
void setError(bool error) override
Definition: daqifFake.hpp:21
std::string m_id
Definition: daqifFake.hpp:8
bool getError() const override
Definition: daqifFake.hpp:18
std::unique_ptr< DaqReply > clone() const override
Definition: daqifFake.hpp:34
void setId(std::string const &id) override
Definition: daqifFake.hpp:14
std::unique_ptr< DaqReply > cloneKey() const override
Definition: daqifFake.hpp:31
bool keyEquals(const DaqReply &other) const override
Definition: daqifFake.hpp:28
std::string getId() const override
Definition: daqifFake.hpp:11
void setError(bool e) override
Definition: daqifFake.hpp:82
std::string getMessage() const override
Definition: daqifFake.hpp:61
std::string getFileId() const override
Definition: daqifFake.hpp:55
daqif::DaqState getState() const override
Definition: daqifFake.hpp:67
void setSubState(daqif::DaqSubState s) override
Definition: daqifFake.hpp:76
std::string m_id
Definition: daqifFake.hpp:40
std::string getId() const override
Definition: daqifFake.hpp:49
std::string m_file_id
Definition: daqifFake.hpp:41
void setMessage(std::string const &message) override
Definition: daqifFake.hpp:64
bool getError() const override
Definition: daqifFake.hpp:79
bool hasKey() const override
Definition: daqifFake.hpp:99
void setTimestamp(double d) override
Definition: daqifFake.hpp:94
double getTimestamp() const override
Definition: daqifFake.hpp:91
daqif::DaqState m_state
Definition: daqifFake.hpp:43
void setId(std::string const &id) override
Definition: daqifFake.hpp:52
std::string m_result
Definition: daqifFake.hpp:46
std::string m_message
Definition: daqifFake.hpp:42
void setState(daqif::DaqState s) override
Definition: daqifFake.hpp:70
daqif::DaqSubState getSubState() const override
Definition: daqifFake.hpp:73
bool keyEquals(const DaqStatus &other) const override
Definition: daqifFake.hpp:102
void setResult(std::string const &result) override
Definition: daqifFake.hpp:88
std::unique_ptr< DaqStatus > clone() const override
Definition: daqifFake.hpp:108
void setFileId(std::string const &id) override
Definition: daqifFake.hpp:58
daqif::DaqSubState m_sub_state
Definition: daqifFake.hpp:44
std::unique_ptr< DaqStatus > cloneKey() const override
Definition: daqifFake.hpp:105
std::string getResult() const override
Definition: daqifFake.hpp:85
void setAvailable(uint64_t available) override
Definition: daqifFake.hpp:170
uint64_t getCapacity() const override
Definition: daqifFake.hpp:161
std::unique_ptr< StorageStatus > clone() const override
Definition: daqifFake.hpp:183
std::unique_ptr< StorageStatus > cloneKey() const override
Definition: daqifFake.hpp:180
void setCapacity(uint64_t capacity) override
Definition: daqifFake.hpp:164
bool hasKey() const override
Definition: daqifFake.hpp:174
bool keyEquals(const StorageStatus &other) const override
Definition: daqifFake.hpp:177
uint64_t getFree() const override
Definition: daqifFake.hpp:155
uint64_t getAvailable() const override
Definition: daqifFake.hpp:167
void setFree(uint64_t free) override
Definition: daqifFake.hpp:158