12#ifndef ALICEO2_DATASAMPLINGPOLICY_H
13#define ALICEO2_DATASAMPLINGPOLICY_H
27#include <boost/property_tree/ptree_fwd.hpp>
39 using PathVectorBase = std::vector<std::pair<framework::InputSpec, framework::OutputSpec>>;
40 class PathMap :
public PathVectorBase
47 return std::find_if(begin(),
end(), [input](
const auto& el) {
82 const std::string&
getName()
const;
98 std::vector<std::unique_ptr<DataSamplingCondition>> mConditions;
99 std::string mFairMQOutputChannel;
102 uint32_t mTotalAcceptedMessages = 0;
103 uint32_t mTotalEvaluatedMessages = 0;
A standarised data sampling condition, to decide if given data sample should be passed forward.
void setFairMQOutputChannel(std::string)
Sets a raw fair::mq::Channel. Deprecated, do not use.
static DataSamplingPolicy fromConfiguration(const boost::property_tree::ptree &)
Configures a policy using structured configuration entry.
uint32_t getTotalEvaluatedMessages() const
~DataSamplingPolicy()=default
Destructor.
static header::DataDescription createPolicyDataDescription(std::string policyName, size_t id)
std::string getFairMQOutputChannelName() const
void registerPath(const framework::InputSpec &, const framework::OutputSpec &)
Adds a new association between inputs and outputs.
DataSamplingPolicy(DataSamplingPolicy &&)=default
Move constructor.
const PathMap & getPathMap() const
void registerCondition(std::unique_ptr< DataSamplingCondition > &&)
Adds a new association between inputs and outputs.
const framework::OutputSpec * match(const framework::ConcreteDataMatcher &input) const
Returns true if this policy requires data with given InputSpec.
static header::DataOrigin createPolicyDataOrigin()
const std::string & getFairMQOutputChannel() const
bool decide(const o2::framework::DataRef &)
Returns true if user-defined conditions of sampling are fulfilled.
const std::string & getName() const
uint32_t getTotalAcceptedMessages() const
DataSamplingPolicy & operator=(DataSamplingPolicy &&)=default
Move assignment.
framework::Output prepareOutput(const framework::ConcreteDataMatcher &input, framework::Lifetime lifetime=framework::Lifetime::Timeframe) const
Returns Output for given InputSpec to pass data forward.
GLuint const GLchar * name
Lifetime
Possible Lifetime of objects being exchanged by the DPL.
A header which contains some meta-data generated by Data Sampling.
static bool match(InputSpec const &spec, ConcreteDataMatcher const &target)