1 // Copyright (C) 2024 CEA, EDF
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #include "SALOME_Launcher_defs.hxx"
26 #include "PythonCppUtils.hxx"
27 #include "Utils_CorbaException.hxx"
28 #include "SALOMEconfig.h"
30 #include CORBA_SERVER_HEADER(SALOME_LogManager)
36 class SALOME_NamingService_Abstract;
37 class SALOME_LogManager;
38 class SALOME_ContainerPerfLog;
39 class SALOME_ContainerScriptPerfLog;
41 class SALOMELAUNCHER_EXPORT SALOME_ContainerScriptExecPerfLog : public POA_Engines::ContainerScriptExecPerfLog
44 SALOME_ContainerScriptExecPerfLog(SALOME_ContainerScriptPerfLog *father):_father(father) { }
45 SALOME_ContainerScriptPerfLog *father() const { return _father; }
46 void setPyObj(PyObject *obj) { _pyExecutionLog.set(obj); }
47 PyObject *pyObj() { return _pyExecutionLog.get(); }
48 PortableServer::POA_var getPOA();
49 void assign(const SALOME::vectorOfByte& value) override;
50 SALOME::vectorOfByte *getObj() override;
55 AutoPyRef _pyExecutionLog;
56 SALOME_ContainerScriptPerfLog *_father = nullptr;
57 std::vector<char> _data;
60 class SALOMELAUNCHER_EXPORT SALOME_ContainerScriptPerfLog : public POA_Engines::ContainerScriptPerfLog
63 SALOME_ContainerScriptPerfLog(SALOME_ContainerPerfLog *father, const std::string& name, const std::string& code):_father(father),_name(name),_code(code) { }
64 SALOME_ContainerPerfLog *father() const { return _father; }
65 void setPyObj(PyObject *obj) { _pyScriptLog.set(obj); }
66 PyObject *pyObj() { return _pyScriptLog.get(); }
67 PortableServer::POA_var getPOA();
68 Engines::ContainerScriptExecPerfLog_ptr addExecutionSession() override;
69 Engines::ListOfContainerScriptExecPerfLog *listOfExecs() override;
70 char *getCode() override;
71 char *getName() override;
73 AutoPyRef _pyScriptLog;
74 SALOME_ContainerPerfLog *_father = nullptr;
77 std::vector< Engines::ContainerScriptExecPerfLog_var > _sessions;
80 class SALOMELAUNCHER_EXPORT SALOME_ContainerPerfLog : public POA_Engines::ContainerPerfLog
83 SALOME_ContainerPerfLog(SALOME_LogManager *father, const std::string& nameInNS, const std::string& logFile):_father(father),_name_in_ns(nameInNS),_log_file(logFile) { }
84 SALOME_LogManager *father() const { return _father; }
85 void setPyObj(PyObject *obj) { _pyContLog.set(obj); }
86 PyObject *pyObj() { return _pyContLog.get(); }
87 PortableServer::POA_var getPOA();
88 char *getLogFile() override;
89 char *getContainerEntryInNS() override;
90 Engines::ContainerScriptPerfLog_ptr addScript(const char *name, const char *code) override;
91 Engines::ListOfContainerScriptPerfLog *listOfScripts() override;
94 SALOME_LogManager *_father = nullptr;
95 std::string _name_in_ns;
96 std::string _log_file;
97 std::vector< Engines::ContainerScriptPerfLog_var > _scripts;
100 class SALOMELAUNCHER_EXPORT SALOME_LogManager : public POA_Engines::LogManager
103 SALOME_LogManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns = nullptr);
104 PortableServer::POA_var getPOA() { return _poa; }
105 PyObject *pyHelper() const { return _pyLogManager; }
106 virtual ~SALOME_LogManager() = default;
107 Engines::ContainerPerfLog_ptr declareContainer(const char *contInNS, const char *logfile) override;
108 Engines::ListOfContainerPerfLog *listOfContainerLogs() override;
110 PyObject *_pyLogManager = nullptr;
111 std::unique_ptr<SALOME_NamingService_Abstract> _NS;
112 PortableServer::POA_var _poa;
113 std::vector<Engines::ContainerPerfLog_var> _containers;
115 static const char NAME_IN_NS[];