Salome HOME
Initial commit
[modules/jobmanager.git] / src / engine / BL_Job.cxx
1 //  Copyright (C) 2009 CEA/DEN, 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
20 #include "BL_Job.hxx"
21
22 BL::Job::Job()
23 {
24   DEBTRACE("Creating BL::Job");
25   _name = "";
26   _yacs_file = "";
27   _command = "";
28   _batch_params.batch_directory = "";
29   _batch_params.expected_during_time = "";
30   _batch_params.expected_memory = "";
31   _batch_params.nb_proc = 0;
32   _files_params.result_directory = "";
33   _machine_choosed = "";
34   _state = BL::Job::CREATED;
35   _thread_state = BL::Job::NOTHING;
36   _salome_launcher_id = -1;
37 }
38
39 BL::Job::Job(const std::string & name)
40 {
41   DEBTRACE("Creating BL::Job with name : " << name);
42   _name = name;
43   _yacs_file = "";
44   _command = "";
45   _batch_params.batch_directory = "";
46   _batch_params.expected_during_time = "";
47   _batch_params.expected_memory = "";
48   _batch_params.nb_proc = 0;
49   _files_params.result_directory = "";
50   _machine_choosed = "";
51   _state = BL::Job::CREATED;
52   _thread_state = BL::Job::NOTHING;
53   _salome_launcher_id = -1;
54 }
55
56 BL::Job::~Job()
57 {}
58
59 void
60 BL::Job::setName(const std::string & name)
61 {
62   _name = name;
63 }
64
65 std::string
66 BL::Job::getName()
67 {
68   return _name;
69 }
70
71 void 
72 BL::Job::setType(BL::Job::JobType type)
73 {
74   _type = type;
75 }
76
77 BL::Job::JobType
78 BL::Job::getType()
79 {
80   return _type;
81 }
82
83 void 
84 BL::Job::setYACSFile(std::string & yacs_file)
85 {
86   _yacs_file = yacs_file;
87 }
88
89 std::string & 
90 BL::Job::getYACSFile()
91 {
92   return _yacs_file;
93 }
94
95 void 
96 BL::Job::setCommand(std::string & command)
97 {
98   _command = command;
99 }
100
101 std::string & 
102 BL::Job::getCommand()
103 {
104   return _command;
105 }
106
107 void 
108 BL::Job::setBatchParameters(BL::Job::BatchParam & param)
109 {
110   _batch_params.batch_directory = param.batch_directory;
111   _batch_params.expected_during_time = param.expected_during_time;
112   _batch_params.expected_memory = param.expected_memory;
113   _batch_params.nb_proc = param.nb_proc;
114 }
115
116 BL::Job::BatchParam & 
117 BL::Job::getBatchParameters()
118 {
119   return _batch_params;
120 }
121
122 void 
123 BL::Job::setFilesParameters(BL::Job::FilesParam & param)
124 {
125   _files_params.result_directory = param.result_directory;
126   _files_params.input_files_list = param.input_files_list;
127   _files_params.output_files_list = param.output_files_list;
128 }
129
130 BL::Job::FilesParam & 
131 BL::Job::getFilesParameters()
132 {
133   return _files_params;
134 }
135
136 void
137 BL::Job::setMachine(std::string & machine)
138 {
139   _machine_choosed = machine;
140 }
141
142 std::string &
143 BL::Job::getMachine()
144 {
145   return _machine_choosed;
146 }
147
148 void 
149 BL::Job::setState(BL::Job::State state)
150 {
151   _state = state;
152 }
153
154 BL::Job::State 
155 BL::Job::getState()
156 {
157   return _state;
158 }
159
160 void 
161 BL::Job::setThreadState(BL::Job::ThreadState state)
162 {
163   _thread_state = state;
164 }
165
166 BL::Job::ThreadState 
167 BL::Job::getThreadState()
168 {
169   return _thread_state;
170 }
171
172 void 
173 BL::Job::setSalomeLauncherId(int id)
174 {
175   _salome_launcher_id = id;
176 }
177
178 int 
179 BL::Job::getSalomeLauncherId()
180 {
181   return _salome_launcher_id;
182 }