Salome HOME
merge from branch BR_For40_DSC tag mergeto_V4_1_0_maintainance_29may08
[modules/kernel.git] / src / Batch / Batch_Job.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 /*
21  * Job.cxx : 
22  *
23  * Auteur : Ivan DUTKA-MALEN - EDF R&D
24  * Date   : Septembre 2003
25  * Projet : SALOME 2
26  *
27  */
28
29 #include "Batch_Job.hxx"
30 #include "Batch_Parametre.hxx"
31 #include <sstream>
32 //#include "MEDMEM_STRING.hxx"
33 using namespace std;
34
35 namespace Batch {
36
37   // Constructeur
38   Job::Job() : _param(), _env()
39   {
40     // Nothing to do
41   }
42
43
44   // Constructeur
45   Job::Job(Parametre param) : _param(param), _env()
46   {
47     // Nothing to do
48   }
49
50
51   // Constructeur
52   Job::Job(Environnement env) : _param(), _env(env)
53   {
54     // Nothing to do
55   }
56
57
58   // Constructeur
59   Job::Job(Parametre param, Environnement env) : _param(param), _env(env)
60   {
61     // Nothing to do
62   }
63
64   // Operateur pour l'affichage sur un stream
65   ostream & operator <<(ostream & os, const Job & job)
66   {
67     return os << job.__str__();
68   }
69
70   // Accesseur
71   Batch::Parametre Job::getParametre() const
72   {
73     return _param;
74   }
75
76   // Accesseur
77   void Job::setParametre(const Batch::Parametre & param)
78   {
79     _param = param;
80   }
81
82   // Accesseur
83   Environnement Job::getEnvironnement() const
84   {
85     return _env;
86   }
87
88   // Accesseur
89   void Job::setEnvironnement(const Environnement & env)
90   {
91     _env = env;
92   }
93
94
95   // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
96   string Job::__str__() const {
97     //MEDMEM::STRING str;
98     ostringstream str;
99     str << "<Job (" << this << ") :" << endl;
100     str << "  Parametre :" << endl;
101     Parametre::const_iterator itp;
102     for(itp=_param.begin(); itp!=_param.end(); itp++) {
103       str << "   * " << (*itp).first << " : " << (*itp).second << endl;
104     }
105     str << "  Environnement :" << endl;
106     Environnement::const_iterator ite;
107     for(ite=_env.begin(); ite!=_env.end(); ite++) {
108       str << "   * " << (*ite).first << " : " << (*ite).second << endl;
109     }
110     str << " >";
111     return str.str();
112   }
113
114
115 }