Salome HOME
Update of CheckDone
[modules/smesh.git] / src / Tools / padder / meshjob / impl / MeshJobManager_i.hxx
1 // Copyright (C) 2011-2024  EDF
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
20 // Authors : Guillaume Boulant (EDF) - 01/03/2011
21
22 #ifndef _MESHJOBMANAGER_HXX_
23 #define _MESHJOBMANAGER_HXX_
24
25 // include the stubs generating from MESHJOB.idl
26 #include <SALOMEconfig.h>
27 #include CORBA_SERVER_HEADER(MESHJOB)
28 #include CORBA_SERVER_HEADER(SALOME_Component)
29 #include "SALOME_Component_i.hxx"
30
31 #include "SALOME_Launcher.hxx"
32 #include <vector>
33 #include <string>
34 #include <map>
35
36 #ifdef WIN32
37  #if defined MESHJOBMANAGERENGINE_EXPORTS || defined MeshJobManagerEngine_EXPORTS
38   #define MESHJOBMANAGERENGINE_EXPORT __declspec( dllexport )
39  #else
40   #define MESHJOBMANAGERENGINE_EXPORT __declspec( dllimport )
41  #endif
42 #else
43  #define MESHJOBMANAGERENGINE_EXPORT
44 #endif
45
46 //Engines::EngineComponent_var RetrievePadderMeshJobManagerInstance();
47
48 class MESHJOBMANAGERENGINE_EXPORT MeshJobManager_i: public virtual POA_MESHJOB::MeshJobManager,
49                                                     public Engines_Component_i
50 {
51 public:
52   MeshJobManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa,
53                    PortableServer::ObjectId * contId,
54                    const char *instanceName, const char *interfaceName, bool checkNS = true, bool regist = true);
55   ~MeshJobManager_i();
56
57   bool           configure  (const char *configId,
58                              const MESHJOB::ConfigParameter & configParameter);
59   CORBA::Long    initialize (const MESHJOB::MeshJobFileList & meshJobFileList,
60                              const MESHJOB::MeshJobParameterList & meshJobParameterList,
61                              const char *configId);
62   bool           start      (CORBA::Long jobId);
63   char*          getState   (CORBA::Long jobId);
64   MESHJOB::MeshJobResults * finalize(CORBA::Long jobId);
65   MESHJOB::MeshJobPaths *   getPaths(CORBA::Long jobId);
66   bool           clean      (CORBA::Long jobId);
67
68   char*          getLastErrorMessage();
69
70   static long JOBID_UNDEFINED;
71
72 private:
73   Engines::SalomeLauncher_var   _salomeLauncher;
74   Engines::ResourcesManager_var _resourcesManager;
75   
76   // This maps the config identifier to the config parameters. A
77   // config is a resource with additional data specifying the
78   // location of the binary program to be executed by the task
79   std::map<std::string, MESHJOB::ConfigParameter> _configMap;
80
81   // This maps a job identifier to its associated datetime tag. When
82   // a job is created during the initialize function, a datetime tag
83   // is associated to this job and can be used to characterized files
84   // and directories associated to this job.
85   std::map<long, long> _jobDateTimeMap;
86   std::map<long, MESHJOB::MeshJobPaths*> _jobPathsMap;
87
88   const char* _writeDataFile   (std::vector<MESHJOB::MeshJobFile> listConcreteMesh,
89                                 std::vector<MESHJOB::MeshJobFile> listSteelBarMesh,
90                                 const MESHJOB::MeshJobParameterList & meshJobParameterList);
91   const char* _writeScriptFile (const char * dataFileName, const char * configId);
92
93   std::vector<std::string> * _getResourceNames();
94
95   std::string _lastErrorMessage;
96
97 };
98
99 #endif
100