Belle II Software  release-08-01-10
Framework.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 <boost/python/list.hpp>
12 #include <boost/python/dict.hpp>
13 
14 #include <framework/core/Module.h>
15 #include <framework/core/Path.h>
16 
17 #include <string>
18 
19 namespace Belle2 {
27  class Framework {
28  public:
32  Framework();
33 
37  virtual ~Framework();
38 
47  static void addModuleSearchPath(const std::string& path);
48 
54  static void setExternalsPath(const std::string& path);
55 
68  static ModulePtr registerModule(const std::string& moduleName);
69 
83  static ModulePtr registerModule(const std::string& moduleName, const std::string& sharedLibPath);
84 
94  static void process(PathPtr startPath, long maxEvent = 0);
95 
99  static void setNumberProcesses(int numProcesses);
100 
104  static int getNumberProcesses();
105 
111  static void setPicklePath(const std::string& path);
112 
118  static std::string getPicklePath();
119 
125  static void setStreamingObjects(const boost::python::list& streamingObjects);
126 
132  static void setRealm(const std::string& realm);
133 
134 
158  static std::string findFile(const std::string& filename, const std::string& type, bool ignore_errors = false);
159 
160  //--------------------------------------------------
161  // Python API
162  //--------------------------------------------------
163 
169  static boost::python::list getModuleSearchPathsPython();
170 
176  static boost::python::dict getAvailableModulesPython();
177 
183  static boost::python::list getRegisteredModulesPython();
184 
188  static void exposePythonAPI();
189  };
190 
192 } //end of namespace Belle2
This class combines all subsystems of the framework, and exports the main interface to Python.
Definition: Framework.h:27
static boost::python::list getRegisteredModulesPython()
Returns a list of all registered modules.
Definition: Framework.cc:260
static std::string findFile(const std::string &filename, const std::string &type, bool ignore_errors=false)
Find a file.
Definition: Framework.cc:217
static boost::python::list getModuleSearchPathsPython()
Returns a list of all module search paths known to the framework.
Definition: Framework.cc:241
static void setNumberProcesses(int numProcesses)
Function to set number of worker processes for parallel processing.
Definition: Framework.cc:168
static void exposePythonAPI()
Exposes methods of the Framework class to Python.
Definition: Framework.cc:291
static void setRealm(const std::string &realm)
Function to set the execution realm.
Definition: Framework.cc:197
static boost::python::dict getAvailableModulesPython()
Returns a dictionary containing the found modules and the filenames of the shared libraries in which ...
Definition: Framework.cc:251
static void setStreamingObjects(const boost::python::list &streamingObjects)
Function to set streaming objects for Tx module.
Definition: Framework.cc:191
static std::string getPicklePath()
Function to get the path to the file where the pickled path is stored.
Definition: Framework.cc:186
static ModulePtr registerModule(const std::string &moduleName)
Registers a new module to the framework and returns a shared pointer.
Definition: Framework.cc:76
static void setPicklePath(const std::string &path)
Function to set the path to the file where the pickled path is stored.
Definition: Framework.cc:180
static void setExternalsPath(const std::string &path)
Sets the path in which the externals of the framework are located.
Definition: Framework.cc:70
virtual ~Framework()
Destructor.
Definition: Framework.cc:51
static int getNumberProcesses()
Function to get number of worker processes for parallel processing.
Definition: Framework.cc:174
Framework()
Constructor.
Definition: Framework.cc:39
static void addModuleSearchPath(const std::string &path)
Adds a new filepath to the list of filepaths which are searched for modules.
Definition: Framework.cc:64
static void process(PathPtr startPath, long maxEvent=0)
Processes up to maxEvent events by starting with the first module in the specified path.
Definition: Framework.cc:88
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:28
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:40
Abstract base class for different kinds of events.