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