QualityControl  1.5.1
O2 Data Quality Control Framework
UpdatePolicyManager.h
Go to the documentation of this file.
1 // Copyright CERN and copyright holders of ALICE O2. This software is
2 // distributed under the terms of the GNU General Public License v3 (GPL
3 // Version 3), copied verbatim in the file "COPYING".
4 //
5 // See http://alice-o2.web.cern.ch/license for full licensing information.
6 //
7 // In applying this license CERN does not waive the privileges and immunities
8 // granted to it by virtue of its status as an Intergovernmental Organization
9 // or submit itself to any jurisdiction.
10 
15 
16 #ifndef QC_CHECKER_POLICYMANAGER_H
17 #define QC_CHECKER_POLICYMANAGER_H
18 
19 #include <string>
20 #include <map>
21 #include <vector>
22 #include <functional>
23 #include <iosfwd>
24 
26 {
27 
28 using UpdatePolicyFunctionType = std::function<bool()>;
29 typedef uint32_t RevisionType;
30 
34 struct UpdatePolicy {
35  std::string actorName;
36  UpdatePolicyFunctionType isReady;
37  std::vector<std::string> inputObjects;
38  bool allInputObjects;
39  // TODO this line makes me think that lambdas are not enough because we actually need to store a state...
40  bool policyHelperFlag; // the purpose might change depending on policy,
41  RevisionType revision = 0;
42 
43  friend std::ostream& operator<<(std::ostream& out, const UpdatePolicy& updatePolicy); // output
44 };
45 
87 {
88  public:
94  void updateGlobalRevision();
102  void updateActorRevision(const std::string& actorName, RevisionType revision);
103  void updateActorRevision(std::string actorName);
111  void updateObjectRevision(std::string objectName, RevisionType revision);
112  void updateObjectRevision(std::string objectName);
121  void addPolicy(std::string actorName, std::string policyType, std::vector<std::string> objectNames, bool allObjects, bool policyHelper);
127  bool isReady(const std::string& actorName);
128 
129  private:
130  std::map<std::string /* Actor name */, UpdatePolicy> mPoliciesByActor;
131  RevisionType mGlobalRevision = 1;
132  std::map<std::string /* Object name */, RevisionType> mObjectsRevision;
133 };
134 
135 } // namespace o2::quality_control::checker
136 
137 #endif // QC_CHECKER_POLICYMANAGER_H
Definition: Aggregator.h:32
Definition: UpdatePolicyManager.h:86
Definition: UpdatePolicyManager.h:34