Version: 9.16.0
SALOME_CPythonHelper.hxx
Go to the documentation of this file.
1// Copyright (C) 2019-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19// Author : Anthony GEAY (EDF R&D)
20
21#pragma once
22
23#include "SALOME_Container.hxx"
24
25#include "Python.h"
26
27#include <string>
28#include <vector>
29
31{
32 public:
33 void initializePython(int argc, char *argv[]);
34 void allowPythonCallsFromDifferentThread() const;
35 void registerToSalomePiDict(const std::string& processName, long pid) const;
36 std::vector<long> evalVL(const std::string& pyCode) const;
37 std::string evalS(const std::string& pyCode) const;
38 virtual ~SALOME_CPythonHelper();
39 PyObject *getGlobals() const { return _globals; }
40 PyObject *getLocals() const { return _locals; }
41 PyObject *getPickler() const { return _pickler; }
42 static SALOME_CPythonHelper *Singleton();
43 static void KillSingleton();
44 private:
46 private:
47 PyObject *_globals = nullptr;
48 PyObject *_locals = nullptr;
49 PyObject *_pickler = nullptr;
50 PyObject *_subprocess = nullptr;
51};
#define CONTAINER_EXPORT
Definition: SALOME_Container.hxx:37
Definition: SALOME_CPythonHelper.hxx:31
PyObject * getGlobals() const
Definition: SALOME_CPythonHelper.hxx:39
static SALOME_CPythonHelper * _CPYTHONHELPER_INSTANCE
Definition: SALOME_CPythonHelper.hxx:45
PyObject * getPickler() const
Definition: SALOME_CPythonHelper.hxx:41
PyObject * getLocals() const
Definition: SALOME_CPythonHelper.hxx:40
argv
Definition: envSalome.py:42