DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
AbstractProcessor.hpp
Go to the documentation of this file.
1
9#ifndef TPGLIBS_ABSTRACTPROCESSOR_HPP_
10#define TPGLIBS_ABSTRACTPROCESSOR_HPP_
11
12#include <cstdint>
13#include <nlohmann/json.hpp>
14#include <memory>
15
16namespace tpglibs {
17
22template <class T>
25 std::shared_ptr<AbstractProcessor<T>> m_next_processor;
26
27 public:
29 using signal_type_t = T;
30
31 virtual ~AbstractProcessor() = default;
32
34 virtual void configure(const nlohmann::json& config, const int16_t* plane_numbers) = 0;
35
37 void set_next_processor(std::shared_ptr<AbstractProcessor<T>> next_processor) {
38 m_next_processor = next_processor;
39 }
40
42 virtual T process(const T& signal) {
43 if (m_next_processor) {
44 return m_next_processor->process(signal);
45 }
46 return signal;
47 }
48};
49
50} // namespace tpglibs
51
52#endif // TPGLIBS_ABSTRACTPROCESSOR_HPP_
Abstract signal processor.
T signal_type_t
Signal type to process on. General __m256i.
virtual T process(const T &signal)
Simple signal pass-through.
virtual ~AbstractProcessor()=default
std::shared_ptr< AbstractProcessor< T > > m_next_processor
Points to next processor in the chain.
virtual void configure(const nlohmann::json &config, const int16_t *plane_numbers)=0
Pure virtual function that will configure the processor using plane numbers.
void set_next_processor(std::shared_ptr< AbstractProcessor< T > > next_processor)
Setter for next processor.