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 : /**
23 : * @brief Keeps the payload's memory alive
24 : */
25 : std::shared_ptr<const void> owner;
26 : /**
27 : * @brief Pointer to payload bytes
28 : */
29 : const void* data;
30 : /**
31 : * @brief Number of bytes
32 : */
33 : std::size_t size;
34 : };
35 :
36 0 : virtual ~GenericReceiverConcept() = default;
37 : virtual std::optional<TypeErasedPayload> try_receive(dunedaq::iomanager::Receiver::timeout_t timeout) = 0;
38 : };
39 :
40 : } // namespace dunedaq::asiolibs
41 :
42 : #endif // ASIOLIBS_SRC_GENERICRECEIVERCONCEPT_HPP_
|