LDMX Software
StorageControl.h
Go to the documentation of this file.
1
7#ifndef FRAMEWORK_STORAGECONTROL_H_
8#define FRAMEWORK_STORAGECONTROL_H_
9
10#include <regex>
11#include <string>
12#include <vector>
13
14namespace framework {
15
28 public:
36 enum class Hint {
37 NoOpinion = 0,
38 Undefined = -1,
39 ShouldKeep = 1,
40 MustKeep = 10,
41 ShouldDrop = 2,
42 MustDrop = 20
43 }; // enum Hint
44
45 public:
47 void setDefaultKeep(bool keep) { defaultIsKeep_ = keep; }
48
52 void resetEventState();
53
69 void addHint(const std::string& processor_name, Hint hint,
70 const std::string& purposeString);
71
81 void addRule(const std::string& processor_pat,
82 const std::string& purpose_pat);
83
100 bool keepEvent(bool event_completed) const;
101
102 private:
106 bool defaultIsKeep_{true};
107
114 std::vector<Hint> hints_;
115
127 std::vector<std::pair<std::regex, std::regex>> rules_;
128};
129
134 StorageControl::Hint::ShouldKeep;
135
140 StorageControl::Hint::ShouldDrop;
141
142} // namespace framework
143
144#endif
Class which encapsulates storage control functionality, used by the Process class.
void setDefaultKeep(bool keep)
Set the default state.
void addHint(const std::string &processor_name, Hint hint, const std::string &purposeString)
Add a storage hint for a given processor.
std::vector< std::pair< std::regex, std::regex > > rules_
Collection of rules allowing certain processors or purposes to be considered ("listened to") during t...
bool keepEvent(bool event_completed) const
Determine if the current event should be kept, based on the defined rules.
std::vector< Hint > hints_
Collection of hints from the event processors.
void addRule(const std::string &processor_pat, const std::string &purpose_pat)
Add a listening rule.
bool defaultIsKeep_
Default state for storage control.
void resetEventState()
Reset the event-by-event state.
Hint
Hints that can be provided by processors to the storage controller.
All classes in the ldmx-sw project use this namespace.
Definition PerfDict.cxx:45
constexpr StorageControl::Hint hint_shouldKeep
storage control hint alias for backwards compatibility
constexpr StorageControl::Hint hint_shouldDrop
storage control hint alias for backwards compatibility