Belle II Software  release-05-02-19
Framework.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010-2012 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Andreas Moll, Thomas Kuhr *
7  * R.Itoh, addition of parallel processing function *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <boost/python/list.hpp>
15 #include <boost/python/dict.hpp>
16 
17 #include <framework/core/Module.h>
18 #include <framework/core/Path.h>
19 
20 #include <string>
21 
22 namespace Belle2 {
30  class Framework {
31  public:
35  Framework();
36 
40  virtual ~Framework();
41 
50  static void addModuleSearchPath(const std::string& path);
51 
57  static void setExternalsPath(const std::string& path);
58 
71  static ModulePtr registerModule(const std::string& moduleName);
72 
86  static ModulePtr registerModule(const std::string& moduleName, const std::string& sharedLibPath);
87 
97  static void process(PathPtr startPath, long maxEvent = 0);
98 
102  static void setNumberProcesses(int numProcesses);
103 
107  static int getNumberProcesses();
108 
114  static void setPicklePath(const std::string& path);
115 
121  static std::string getPicklePath();
122 
128  static void setStreamingObjects(const boost::python::list& streamingObjects);
129 
130 
154  static std::string findFile(const std::string& filename, const std::string& type, bool ignore_errors = false);
155 
156  //--------------------------------------------------
157  // Python API
158  //--------------------------------------------------
159 
165  static boost::python::list getModuleSearchPathsPython();
166 
172  static boost::python::dict getAvailableModulesPython();
173 
179  static boost::python::list getRegisteredModulesPython();
180 
184  static void exposePythonAPI();
185  };
186 
188 } //end of namespace Belle2
Belle2::Framework::getRegisteredModulesPython
static boost::python::list getRegisteredModulesPython()
Returns a list of all registered modules.
Definition: Framework.cc:240
Belle2::Framework::setStreamingObjects
static void setStreamingObjects(const boost::python::list &streamingObjects)
Function to set streaming objects for Tx module.
Definition: Framework.cc:191
Belle2::Framework::setNumberProcesses
static void setNumberProcesses(int numProcesses)
Function to set number of worker processes for parallel processing.
Definition: Framework.cc:168
Belle2::Framework::exposePythonAPI
static void exposePythonAPI()
Exposes methods of the Framework class to Python.
Definition: Framework.cc:271
Belle2::Framework::findFile
static std::string findFile(const std::string &filename, const std::string &type, bool ignore_errors=false)
Find a file.
Definition: Framework.cc:197
Belle2::Framework::~Framework
virtual ~Framework()
Destructor.
Definition: Framework.cc:51
Belle2::Framework::getModuleSearchPathsPython
static boost::python::list getModuleSearchPathsPython()
Returns a list of all module search paths known to the framework.
Definition: Framework.cc:221
Belle2::Framework::getNumberProcesses
static int getNumberProcesses()
Function to get number of worker processes for parallel processing.
Definition: Framework.cc:174
Belle2::Framework::getPicklePath
static std::string getPicklePath()
Function to get the path to the file where the pickled path is stored.
Definition: Framework.cc:186
Belle2::Framework::setPicklePath
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
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Framework::getAvailableModulesPython
static boost::python::dict getAvailableModulesPython()
Returns a dictionary containing the found modules and the filenames of the shared libraries in which ...
Definition: Framework.cc:231
Belle2::Framework::process
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
Belle2::PathPtr
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:30
Belle2::ModulePtr
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:42
Belle2::Framework::Framework
Framework()
Constructor.
Definition: Framework.cc:39
Belle2::Framework::setExternalsPath
static void setExternalsPath(const std::string &path)
Sets the path in which the externals of the framework are located.
Definition: Framework.cc:70
Belle2::Framework::addModuleSearchPath
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
Belle2::Framework::registerModule
static ModulePtr registerModule(const std::string &moduleName)
Registers a new module to the framework and returns a shared pointer.
Definition: Framework.cc:76