Line data Source code
1 : /**
2 : * @file GenericReceiverConcept.hpp Generic IOManager Receiver concept
3 : *
4 : * This is part of the DUNE DAQ , copyright 2020.
5 : * Licensing/copyright details are in the COPYING file that you should have
6 : * received with this code.
7 : */
8 : #ifndef ASIOLIBS_SRC_GENERICRECEIVERCONCEPT_HPP_
9 : #define ASIOLIBS_SRC_GENERICRECEIVERCONCEPT_HPP_
10 :
11 : #include "iomanager/Receiver.hpp"
12 :
13 : #include <memory>
14 :
15 : namespace dunedaq::asiolibs {
16 :
17 : class GenericReceiverConcept
18 : {
19 : public:
20 : struct TypeErasedPayload {
21 : /**
22 : * @brief Keeps the payload's memory alive
23 : */
24 : std::shared_ptr<const void> owner;
25 : /**
26 : * @brief Pointer to payload bytes
27 : */
28 : const void* data;
29 : /**
30 : * @brief Number of bytes
31 : */
32 : std::size_t size;
33 : };
34 :
35 0 : virtual ~GenericReceiverConcept() = default;
36 : virtual std::optional<TypeErasedPayload> try_receive(dunedaq::iomanager::Receiver::timeout_t timeout) = 0;
37 : };
38 :
39 : } // namespace dunedaq::asiolibs
40 :
41 : #endif // ASIOLIBS_SRC_GENERICRECEIVERCONCEPT_HPP_
|