CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PythonManager.h
Go to the documentation of this file.
1 //
2 // Smart reference + singleton to handle Python interpreter
3 //
4 //
5 // Original Author: Chris D Jones & Benedikt Hegner
6 // Created: Sun Jul 22 11:03:53 CEST 2006
7 //
8 
9 #ifndef FWCore_Python_PythonManager_h
10 #define FWCore_Python_PythonManager_h
11 
13 
14 extern "C" {
15  //this is the entry point into the libFWCorePython python module
16  void initlibFWCorePython();
17  //void initROOT();
18 }
19 
20 void pythonToCppException(const std::string& iType);
21 
22  class PythonManagerHandle;
23 
24  class PythonManager {
25  public:
26  friend class PythonManagerHandle;
27  static PythonManagerHandle handle();
28 
29  private:
30  PythonManager();
31  ~PythonManager() { Py_Finalize(); }
32  void increment() { ++refCount_; }
33  void decrement() { --refCount_; if(0==refCount_) delete this; }
34  unsigned long refCount_;
35  std::string initCommand_;
36  };
37 
39  public:
41 
43  manager_(iM) {
45  }
46 
48  manager_(iRHS.manager_) {
50  }
51 
52  private:
55  };
56 #endif // FWCore_Python_PythonManager_h
void pythonToCppException(const std::string &iType)
Definition: PythonManager.cc:5
void increment()
Definition: PythonManager.h:32
PythonManager & manager_
Definition: PythonManager.h:54
void decrement()
Definition: PythonManager.h:33
std::string initCommand_
Definition: PythonManager.h:35
unsigned long refCount_
Definition: PythonManager.h:34
PythonManagerHandle(PythonManager &iM)
Definition: PythonManager.h:42
const PythonManagerHandle & operator=(const PythonManagerHandle &)
static PythonManagerHandle handle()
void initlibFWCorePython()
PythonManagerHandle(const PythonManagerHandle &iRHS)
Definition: PythonManager.h:47