Rivet API documentation

Rivet 4.1.3
ProjectionHandler.hh
1// -*- C++ -*-
2#ifndef RIVET_ProjectionHandler_HH
3#define RIVET_ProjectionHandler_HH
4
5// @todo all thread/mutex code belongs to a temporary fix to allow for
6// basic threading
7#include "Rivet/Projection.fhh"
8#include "Rivet/Config/RivetCommon.hh"
9#include <mutex>
10#include <thread>
11
12namespace Rivet {
13
14
16 typedef std::shared_ptr<const Projection> ProjHandle;
17
18 // Forward declaration.
20
44 public:
45
47 friend class ProjectionApplier;
48
50 typedef set<ProjHandle> ProjHandles;
51
54 typedef map<string, ProjHandle> NamedProjs;
55
57 enum ProjDepth { SHALLOW, DEEP };
58
59
60 private:
61
64 typedef map<const ProjectionApplier*, NamedProjs> NamedProjsMap;
65
68 NamedProjsMap _namedprojs;
69
72 ProjHandles _projs;
73
74
75 public:
76
79
81 ~ProjectionHandler() = default;
82
85
88
90 ProjectionHandler() = default;
91
92 public:
93
97 const Projection& registerProjection(const ProjectionApplier& parent,
98 const Projection& proj,
99 const string& name);
101
102
103 private:
104
107
110 ProjHandle _getEquiv(const Projection& proj) const;
111
113 unique_ptr<Projection> _clone(const Projection& proj);
114
116 const Projection& _register(const ProjectionApplier& parent, ProjHandle proj, const string& name);
117
119 string _getStatus() const;
120
122 bool _checkDuplicate(const ProjectionApplier& parent, const Projection& proj, const string& name) const;
123
125
126
127 public:
128
131
133 bool hasProjection(const ProjectionApplier& parent, const string& name) const;
134
140 const Projection& getProjection(const ProjectionApplier& parent, const string& name) const;
141
148 set<const Projection*> getChildProjections(const ProjectionApplier& parent,
149 ProjDepth depth = SHALLOW) const;
151
152
153 private:
154
156 void removeProjectionApplier(ProjectionApplier& parent);
157
158
159 private:
160
161 // /// Get map of named projections belonging to @a parent.
162 // /// Throws an exception if @a parent has not got any registered projections.
163 // const NamedProjs& namedProjs(const ProjectionApplier* parent) const {
164 // NamedProjsMap::const_iterator nps = _namedprojs.find(parent);
165 // if (nps == _namedprojs.end()) {
166 // stringstream ss;
167 // ss << "No NamedProjs registered for parent " << parent;
168 // throw Error(ss.str());
169 // }
170 // return *nps;
171 // }
172 };
173
174
175}
176
177#endif
Common base class for Projection and Analysis, used for internal polymorphism.
Definition ProjectionApplier.hh:22
const Projection & getProjection(const ProjectionApplier &parent, const string &name) const
set< const Projection * > getChildProjections(const ProjectionApplier &parent, ProjDepth depth=SHALLOW) const
ProjectionHandler & operator=(const ProjectionHandler &)=delete
The assignment operator is hidden.
bool hasProjection(const ProjectionApplier &parent, const string &name) const
Check if there is a name projection registered by parent.
set< ProjHandle > ProjHandles
Typedef for a vector of Projection pointers.
Definition ProjectionHandler.hh:50
ProjectionHandler()=default
The standard constructor.
ProjDepth
Enum to specify depth of projection search.
Definition ProjectionHandler.hh:57
friend class ProjectionApplier
ProjectionApplier's destructor needs to trigger cleaning up the proj handler repo.
Definition ProjectionHandler.hh:47
ProjectionHandler(const ProjectionHandler &)=delete
The copy constructor is hidden.
map< string, ProjHandle > NamedProjs
Typedef for the structure used to contain named projections for a particular containing Analysis or P...
Definition ProjectionHandler.hh:54
~ProjectionHandler()=default
Private destructor means no inheritance from this class.
Base class for all Rivet projections.
Definition Projection.hh:29
Definition LHCbCommon.hh:9
std::shared_ptr< const Projection > ProjHandle
Typedef for Projection (smart) pointer.
Definition ProjectionHandler.hh:16