/
LatencyBufferConcept.hpp
74 lines (55 loc) · 2.19 KB
/
LatencyBufferConcept.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* @file LatencyBufferBase.hpp Latency buffer interface class
*
* This is part of the DUNE DAQ , copyright 2020.
* Licensing/copyright details are in the COPYING file that you should have
* received with this code.
*/
#ifndef READOUTLIBS_INCLUDE_READOUTLIBS_CONCEPTS_LATENCYBUFFERCONCEPT_HPP_
#define READOUTLIBS_INCLUDE_READOUTLIBS_CONCEPTS_LATENCYBUFFERCONCEPT_HPP_
#include <nlohmann/json.hpp>
#include "appdal/LatencyBuffer.hpp"
#include <cstddef>
namespace dunedaq {
namespace readoutlibs {
/**
* Concept of a LatencyBuffer.
*
* @tparam RawType the type of contained elements
* @tparam KeyType the type of key for searchability
*/
template<class T>
class LatencyBufferConcept
{
public:
LatencyBufferConcept() {}
virtual ~LatencyBufferConcept() {}
LatencyBufferConcept(const LatencyBufferConcept&) = delete; ///< LatencyBufferConcept is not copy-constructible
LatencyBufferConcept& operator=(const LatencyBufferConcept&) =
delete; ///< LatencyBufferConcept is not copy-assginable
LatencyBufferConcept(LatencyBufferConcept&&) = delete; ///< LatencyBufferConcept is not move-constructible
LatencyBufferConcept& operator=(LatencyBufferConcept&&) = delete; ///< LatencyBufferConcept is not move-assignable
//! Configure the LB
virtual void conf(const appdal::LatencyBuffer* conf) = 0;
//! Unconfigure the LB
virtual void scrap(const nlohmann::json& cfg) = 0;
//! Occupancy of LB
virtual std::size_t occupancy() const = 0;
//! Move referenced object into LB
virtual bool write(T&& element) = 0;
//! Move object from LB to referenced
virtual bool read(T& element) = 0;
//! Write referenced object into LB without moving it
// virtual bool put(T& element) = 0;
//! Get pointer to the front of the LB
virtual const T* front() = 0;
//! Get pointer to the back of the LB
virtual const T* back() = 0;
//! Pop specified amount of elements from LB
virtual void pop(std::size_t amount) = 0;
//! Flush all elements from the latency buffer
virtual void flush() = 0;
};
} // namespace readoutlibs
} // namespace dunedaq
#endif // READOUTLIBS_INCLUDE_READOUTLIBS_CONCEPTS_LATENCYBUFFERCONCEPT_HPP_