Project
Loading...
Searching...
No Matches
Dispatcher.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#ifndef ALICEO2_DISPATCHER_H
18#define ALICEO2_DISPATCHER_H
19
20#include <string>
21#include <vector>
22#include <memory>
23
26#include "Framework/Task.h"
27
28#include <fairmq/FwdDecls.h>
30
31namespace o2::monitoring
32{
33class Monitoring;
34}
35
36namespace o2::utilities
37{
38
39class DataSamplingHeader;
40class DataSamplingPolicy;
41
43{
44 public:
46 Dispatcher(const std::string name, const std::string reconfigurationSource);
48 ~Dispatcher() override;
49
51 void init(framework::InitContext& ctx) override;
53 void run(framework::ProcessingContext& ctx) override;
54
56 void registerPolicy(std::unique_ptr<DataSamplingPolicy>&&);
58 size_t numberOfPolicies();
59
60 const std::string& getName();
65
66 private:
67 DataSamplingHeader prepareDataSamplingHeader(const DataSamplingPolicy& policy);
68 header::Stack extractAdditionalHeaders(const char* inputHeaderStack) const;
69 void reportStats(monitoring::Monitoring& monitoring) const;
70 void send(framework::DataAllocator& dataAllocator, const framework::DataRef& inputData, const framework::Output& output) const;
71
72 std::string mName;
73 DataSamplingHeader::DeviceIDType mDeviceID = "invalid";
74 std::string mReconfigurationSource;
75 // policies should be shared between all pipeline threads
76 std::vector<std::shared_ptr<DataSamplingPolicy>> mPolicies;
77};
78
79} // namespace o2::utilities
80
81#endif //ALICEO2_DISPATCHER_H
A declaration of O2 Data Sampling Header.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
std::vector< o2::mid::ColumnData > inputData
o2::monitoring::Monitoring Monitoring
void run(framework::ProcessingContext &ctx) override
Dispatcher process callback.
void registerPolicy(std::unique_ptr< DataSamplingPolicy > &&)
Register a Data Sampling Policy.
framework::Inputs getInputSpecs()
Assembles InputSpecs of all registered policies in a single vector, removing overlapping entries.
size_t numberOfPolicies()
Returns the number of registered policies.
framework::Outputs getOutputSpecs()
void init(framework::InitContext &ctx) override
Dispatcher init callback.
framework::Options getOptions()
~Dispatcher() override
Destructor.
const std::string & getName()
GLuint const GLchar * name
Definition glcorearb.h:781
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
A header which contains some meta-data generated by Data Sampling.
a move-only header stack with serialized headers This is the flat buffer where all the headers in a m...
Definition Stack.h:36