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_PLUGINS_GENERICRECEIVERCONCEPT_HPP_
9 : #define ASIOLIBS_PLUGINS_GENERICRECEIVERCONCEPT_HPP_
10 :
11 : #include "iomanager/Receiver.hpp"
12 :
13 : namespace dunedaq::asiolibs {
14 :
15 : class GenericReceiverConcept
16 : {
17 : public:
18 : struct TypeErasedPayload {
19 : /**
20 : * @brief Keeps the payload's memory alive
21 : */
22 : std::shared_ptr<const void> owner;
23 : /**
24 : * @brief Pointer to payload bytes
25 : */
26 : const void* data;
27 : /**
28 : * @brief Number of bytes
29 : */
30 : std::size_t size;
31 : };
32 :
33 0 : virtual ~GenericReceiverConcept() = default;
34 : virtual std::optional<TypeErasedPayload> try_receive(dunedaq::iomanager::Receiver::timeout_t timeout) = 0;
35 : };
36 :
37 : } // namespace dunedaq::asiolibs
38 :
39 : #endif // ASIOLIBS_PLUGINS_GENERICRECEIVERCONCEPT_HPP_
|