Salome HOME
Porting to Mandrake 10.1 and new products:
[modules/kernel.git] / src / Batch / Batch_JobId.cxx
1 /*
2  * JobId.cxx : 
3  *
4  * Auteur : Ivan DUTKA-MALEN - EDF R&D
5  * Date   : Septembre 2003
6  * Projet : SALOME 2
7  *
8  */
9
10 #include "Batch_JobId.hxx"
11 #include "Batch_BatchManager.hxx"
12 #include <sstream>
13 #include <assert.h>
14 //#include "MEDMEM_STRING.hxx"
15 using namespace std;
16
17 namespace Batch {
18
19   // Constructeur standard
20   JobId::JobId() : _p_batchmanager(), _reference("undefined")
21   {
22     // Nothing to do
23   }
24
25   // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
26   JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref)
27   {
28     // Nothing to do
29   }
30
31   // Destructeur
32   JobId::~JobId()
33   {
34     // Nothing to do
35   }
36
37   // Operateur d'affectation entre objets
38   JobId & JobId::operator =(const JobId & jobid)
39   {
40     _p_batchmanager = jobid._p_batchmanager;
41     _reference      = jobid._reference;
42
43     return *this;
44   }
45
46   // Constructeur par recopie
47   JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference)
48   {
49     // Nothing to do
50   }
51
52   // Accesseur pour la reference interne
53   string JobId::getReference() const
54   {
55     return _reference;
56   }
57
58   // Methode pour le controle du job : retire le job du gestionnaire
59   void JobId::deleteJob() const
60   {
61     assert(_p_batchmanager != 0);
62     _p_batchmanager->deleteJob(*this);
63   }
64    
65   // Methode pour le controle du job : suspend le job en file d'attente
66   void JobId::holdJob() const
67   {
68     assert(_p_batchmanager != 0);
69     _p_batchmanager->holdJob(*this);
70   }
71
72   // Methode pour le controle du job : relache le job suspendu
73   void JobId::releaseJob() const
74   {
75     assert(_p_batchmanager != 0);
76     _p_batchmanager->releaseJob(*this);
77   }
78
79   // Methode pour le controle du job : modifie le job en file d'attente
80   void JobId::alterJob(const Parametre & param, const Environnement & env) const
81   {
82     assert(_p_batchmanager != 0);
83     _p_batchmanager->alterJob(*this, param, env);
84   }
85
86   // Methode pour le controle du job : modifie le job en file d'attente
87   void JobId::alterJob(const Parametre & param) const
88   {
89     assert(_p_batchmanager != 0);
90     _p_batchmanager->alterJob(*this, param);
91   }
92
93   // Methode pour le controle du job : modifie le job en file d'attente
94   void JobId::alterJob(const Environnement & env) const
95   {
96     assert(_p_batchmanager != 0);
97     _p_batchmanager->alterJob(*this, env);
98   }
99
100   // Methode pour le controle du job : renvoie l'etat du job
101   JobInfo JobId::queryJob() const
102   {
103     assert(_p_batchmanager != 0);
104     return _p_batchmanager->queryJob(*this);
105   }
106
107
108   // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
109   string JobId::__str__() const {
110     //MEDMEM::STRING str;
111     ostringstream str;
112     str << "<JobId (" << this << ") : referenced '" << _reference << "'>";
113     return str.str();
114   }
115
116 }