ifw-daq  1.0.0
IFW Data Acquisition modules
ocmifFake.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 <Ocmif.hpp>
5 namespace ocmif {
6 
7 struct 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 
39 struct DaqStatusFake : DaqStatus {
40  std::string m_id;
41  std::string m_message;
42  ocmif::DaqState m_state;
43  ocmif::DaqSubState m_sub_state;
44  bool m_error;
45  double m_timestamp;
46 
47  std::string getId() const override {
48  return m_id;
49  }
50  void setId(std::string const& id) override {
51  m_id = id;
52  }
53  std::string getMessage() const override {
54  return m_message;
55  }
56  void setMessage(std::string const& message) override {
57  m_message = message;
58  }
59  ocmif::DaqState getState() const override {
60  return m_state;
61  }
62  void setState(ocmif::DaqState s) override {
63  m_state = s;
64  }
65  ocmif::DaqSubState getSubState() const override {
66  return m_sub_state;
67  }
68  void setSubState(ocmif::DaqSubState s) override {
69  m_sub_state = s;
70  }
71  bool getError() const override {
72  return m_error;
73  }
74  void setError(bool e) override {
75  m_error = e;
76  }
77  double getTimestamp() const override {
78  return m_timestamp;
79  }
80  void setTimestamp(double d) override {
81  m_timestamp = d;
82  }
83 
84  // Mal pub/sub API which has nothing to do with req rep.
85  bool hasKey() const override {
86  return false;
87  }
88  bool keyEquals(const DaqStatus& other) const override {
89  return false;
90  }
91  std::unique_ptr<DaqStatus> cloneKey() const override {
92  return {};
93  }
94  std::unique_ptr<DaqStatus> clone() const override {
95  return {};
96  }
97 };
98 
99 struct AwaitDaqReplyFake : AwaitDaqReply {
100  AwaitDaqReplyFake() : m_timeout(false), m_status(std::make_shared<DaqStatusFake>()) {
101  }
102  bool getTimeout() const override {
103  return m_timeout;
104  }
105  void setTimeout(bool t) override {
106  m_timeout = t;
107  }
108  std::shared_ptr<ocmif::DaqStatus> getStatus() const override {
109  return m_status;
110  }
111 
112  // Mal pub/sub API which has nothing to do with req rep.
113  bool hasKey() const override {
114  return false;
115  }
116  bool keyEquals(const AwaitDaqReply& other) const override {
117  return false;
118  }
119  std::unique_ptr<AwaitDaqReply> cloneKey() const override {
120  return {};
121  }
122  std::unique_ptr<AwaitDaqReply> clone() const override {
123  return {};
124  }
125 
126  bool m_timeout;
127  std::shared_ptr<DaqStatusFake> m_status;
128 };
129 
130 } // namespace ocmif
131 #endif // #ifndef DAQ_OCM_SERVER_FAKE_OCM_SERVER_IF_HPP_
ocmif::DaqReplyFake::cloneKey
std::unique_ptr< DaqReply > cloneKey() const override
Definition: ocmifFake.hpp:31
ocmif::DaqStatusFake::getSubState
ocmif::DaqSubState getSubState() const override
Definition: ocmifFake.hpp:65
ocmif::DaqStatusFake::getTimestamp
double getTimestamp() const override
Definition: ocmifFake.hpp:77
ocmif::DaqStatusFake::setTimestamp
void setTimestamp(double d) override
Definition: ocmifFake.hpp:80
ocmif::AwaitDaqReplyFake::hasKey
bool hasKey() const override
Definition: ocmifFake.hpp:113
ocmif::DaqReplyFake::getError
bool getError() const override
Definition: ocmifFake.hpp:18
ocmif::DaqStatusFake::setSubState
void setSubState(ocmif::DaqSubState s) override
Definition: ocmifFake.hpp:68
ocmif::AwaitDaqReplyFake::m_status
std::shared_ptr< DaqStatusFake > m_status
Definition: ocmifFake.hpp:127
ocmif::DaqStatusFake
Definition: ocmifFake.hpp:39
ocmif::DaqStatusFake::m_error
bool m_error
Definition: ocmifFake.hpp:44
ocmif::AwaitDaqReplyFake::clone
std::unique_ptr< AwaitDaqReply > clone() const override
Definition: ocmifFake.hpp:122
ocmif::DaqReplyFake::getId
std::string getId() const override
Definition: ocmifFake.hpp:11
ocmif::AwaitDaqReplyFake
Definition: ocmifFake.hpp:99
ocmif::DaqStatusFake::setMessage
void setMessage(std::string const &message) override
Definition: ocmifFake.hpp:56
ocmif::DaqStatusFake::setId
void setId(std::string const &id) override
Definition: ocmifFake.hpp:50
ocmif::DaqStatusFake::setState
void setState(ocmif::DaqState s) override
Definition: ocmifFake.hpp:62
ocmif::DaqReplyFake::m_id
std::string m_id
Definition: ocmifFake.hpp:8
ocmif::DaqStatusFake::setError
void setError(bool e) override
Definition: ocmifFake.hpp:74
ocmif::DaqStatusFake::m_sub_state
ocmif::DaqSubState m_sub_state
Definition: ocmifFake.hpp:43
ocmif::DaqStatusFake::hasKey
bool hasKey() const override
Definition: ocmifFake.hpp:85
ocmif::DaqStatusFake::getState
ocmif::DaqState getState() const override
Definition: ocmifFake.hpp:59
ocmif::DaqStatusFake::clone
std::unique_ptr< DaqStatus > clone() const override
Definition: ocmifFake.hpp:94
ocmif::DaqReplyFake::setError
void setError(bool error) override
Definition: ocmifFake.hpp:21
ocmif::AwaitDaqReplyFake::m_timeout
bool m_timeout
Definition: ocmifFake.hpp:126
ocmif::DaqStatusFake::m_timestamp
double m_timestamp
Definition: ocmifFake.hpp:45
ocmif::DaqReplyFake::hasKey
bool hasKey() const override
Definition: ocmifFake.hpp:25
ocmif::DaqStatusFake::getId
std::string getId() const override
Definition: ocmifFake.hpp:47
ocmif::AwaitDaqReplyFake::AwaitDaqReplyFake
AwaitDaqReplyFake()
Definition: ocmifFake.hpp:100
ocmif
Definition: conversion.cpp:15
ocmif::DaqReplyFake
Definition: ocmifFake.hpp:7
ocmif::DaqReplyFake::keyEquals
bool keyEquals(const DaqReply &other) const override
Definition: ocmifFake.hpp:28
ocmif::DaqStatusFake::m_message
std::string m_message
Definition: ocmifFake.hpp:41
ocmif::DaqReplyFake::m_error
bool m_error
Definition: ocmifFake.hpp:9
ocmif::DaqStatusFake::cloneKey
std::unique_ptr< DaqStatus > cloneKey() const override
Definition: ocmifFake.hpp:91
ocmif::DaqStatusFake::getMessage
std::string getMessage() const override
Definition: ocmifFake.hpp:53
ocmif::DaqReplyFake::setId
void setId(std::string const &id) override
Definition: ocmifFake.hpp:14
ocmif::AwaitDaqReplyFake::getTimeout
bool getTimeout() const override
Definition: ocmifFake.hpp:102
ocmif::AwaitDaqReplyFake::keyEquals
bool keyEquals(const AwaitDaqReply &other) const override
Definition: ocmifFake.hpp:116
ocmif::DaqStatusFake::m_id
std::string m_id
Definition: ocmifFake.hpp:40
ocmif::DaqReplyFake::clone
std::unique_ptr< DaqReply > clone() const override
Definition: ocmifFake.hpp:34
ocmif::AwaitDaqReplyFake::setTimeout
void setTimeout(bool t) override
Definition: ocmifFake.hpp:105
ocmif::DaqStatusFake::keyEquals
bool keyEquals(const DaqStatus &other) const override
Definition: ocmifFake.hpp:88
ocmif::AwaitDaqReplyFake::getStatus
std::shared_ptr< ocmif::DaqStatus > getStatus() const override
Definition: ocmifFake.hpp:108
ocmif::DaqStatusFake::getError
bool getError() const override
Definition: ocmifFake.hpp:71
ocmif::DaqStatusFake::m_state
ocmif::DaqState m_state
Definition: ocmifFake.hpp:42
ocmif::AwaitDaqReplyFake::cloneKey
std::unique_ptr< AwaitDaqReply > cloneKey() const override
Definition: ocmifFake.hpp:119