Belle II Software light-2406-ragdoll
Path.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/PathElement.h>
12#include <memory>
13#include <list>
14
15namespace boost {
16 namespace python {
17 class list;
18 }
19}
20
21namespace Belle2 {
27 class Path;
28 class Module;
29
30 //------------------------------------------------------
31 // Define convenient typdefs
32 //------------------------------------------------------
33
35 typedef std::shared_ptr<Path> PathPtr;
36
38 class Path : public PathElement {
39
40 public:
41
46
51
62 void addModule(const std::shared_ptr<Module>& module);
63
65 bool isEmpty() const;
66
70 std::list<std::shared_ptr<Module> > getModules() const override;
71
82 std::list<std::shared_ptr<Module> > buildModulePathList(bool unique = true) const;
83
87 void putModules(const std::list<std::shared_ptr<Module> >& mlist);
88
94 bool contains(const std::string& moduleType) const;
95
101 std::shared_ptr<PathElement> clone() const override;
102
103
104 //--------------------------------------------------
105 // Python API
106 //--------------------------------------------------
107
109 void addPath(const PathPtr& path);
110
112 void forEach(const std::string& loopObjectName, const std::string& arrayName, PathPtr path);
113
115 void doWhile(PathPtr path, const std::string& condition, unsigned int maxIterations);
116
118 void addIndependentPath(const PathPtr& independent_path, std::string ds_ID, const boost::python::list& merge_back);
119
121 void addIndependentMergePath(const PathPtr& independent_path, std::string ds_ID, const boost::python::list& merge_back,
122 std::string consistency_check, bool event_mixing, bool mergeSameFile);
123
124
129 std::string getPathString() const override;
130
132 static void exposePythonAPI();
133
134
135 private:
136
137 std::list<std::shared_ptr<PathElement> > m_elements;
139 friend class PathIterator;
140 };
141
143} // end namespace Belle2
Base for classes that can be elements of a Path.
Definition: PathElement.h:27
Iterator over a Path (returning Module pointers).
Definition: PathIterator.h:26
Implements a path consisting of Module and/or Path objects.
Definition: Path.h:38
void addIndependentMergePath(const PathPtr &independent_path, std::string ds_ID, const boost::python::list &merge_back, std::string consistency_check, bool event_mixing, bool mergeSameFile)
See 'pydoc3 basf2.Path'.
Definition: Path.cc:135
void forEach(const std::string &loopObjectName, const std::string &arrayName, PathPtr path)
See 'pydoc3 basf2.Path'.
Definition: Path.cc:95
std::list< std::shared_ptr< PathElement > > m_elements
The list of path elements (Modules and sub-Paths)
Definition: Path.h:137
void doWhile(PathPtr path, const std::string &condition, unsigned int maxIterations)
See 'pydoc3 basf2.Path'.
Definition: Path.cc:102
std::list< std::shared_ptr< Module > > buildModulePathList(bool unique=true) const
Builds a list of all modules which could be executed during the data processing.
Definition: Path.cc:67
static void exposePythonAPI()
Exposes methods of the Path class to Python.
Definition: Path.cc:238
void putModules(const std::list< std::shared_ptr< Module > > &mlist)
Replaces all Modules and sub-Paths with the specified Module list.
Definition: Path.cc:89
Path()
Constructor.
void addPath(const PathPtr &path)
See 'pydoc3 basf2.Path'.
Definition: Path.cc:37
void addModule(const std::shared_ptr< Module > &module)
Adds a module to the path.
Definition: Path.cc:32
bool isEmpty() const
Returns true if this Path doesn't contain any elements.
Definition: Path.cc:45
~Path()
Destructor.
std::shared_ptr< PathElement > clone() const override
Create an independent copy of this path, recreating all contained modules with the same parameters.
Definition: Path.cc:186
void addIndependentPath(const PathPtr &independent_path, std::string ds_ID, const boost::python::list &merge_back)
See 'pydoc3 basf2.Path'.
Definition: Path.cc:109
bool contains(const std::string &moduleType) const
Does this Path contain a module of the given type?
Definition: Path.cc:178
std::list< std::shared_ptr< Module > > getModules() const override
Returns a list of the modules in this path.
Definition: Path.cc:50
std::string getPathString() const override
return a string of the form [module a -> module b -> [another path]]
Definition: Path.cc:206
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24