Salome HOME
Copyright update 2021
[tools/libbatch.git] / src / Core / JobId.hxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /*
23  * JobId.hxx : 
24  *
25  * Auteur : Ivan DUTKA-MALEN - EDF R&D
26  * Date   : Septembre 2003
27  * Projet : SALOME 2
28  *
29  */
30
31 #ifndef _JOBID_H_
32 #define _JOBID_H_
33
34
35 #include "Defines.hxx"
36
37 #include "JobInfo.hxx"
38 #include "BatchManager.hxx"
39
40 namespace Batch {
41
42   class BatchManager;
43
44   class BATCH_EXPORT JobId
45   {
46     friend class BatchManager;
47
48   public:
49     // Constructeur standard et destructeur
50     JobId();
51     virtual ~JobId();
52
53     // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
54     JobId(Batch::BatchManager *, const std::string & ref);
55
56     // Operateur d'affectation entre objets
57     virtual JobId & operator =(const Batch::JobId &);
58
59     // Constructeur par recopie
60     JobId(const Batch::JobId &);
61
62     // Accesseur pour la reference interne
63     virtual std::string getReference() const;
64
65     // Permet de recharger un job depuis un fichier
66     virtual void setReference(const std::string & new_reference);
67
68     // Methodes pour le controle du job
69     virtual void deleteJob() const; // retire un job du gestionnaire
70     virtual void holdJob() const; // suspend un job en file d'attente
71     virtual void releaseJob() const; // relache un job suspendu
72     virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente
73     virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente
74     virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente
75     virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente
76     virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente
77     virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job
78
79     // Methodes pour l'interfacage avec Python (SWIG)
80     // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
81     std::string  __str__() const; // SWIG : affichage en Python
82     std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
83
84   protected:
85     Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job
86     std::string _reference; // reference du job au sein du BatchManager
87
88   private:
89
90   };
91
92 }
93
94 #endif