1 // Copyright (C) 2009 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _BL_JOBSMANAGER_HXX_
21 #define _BL_JOBSMANAGER_HXX_
24 #include "BL_SALOMEServices.hxx"
25 #include "BL_Traces.hxx"
26 #include "BL_Observer.hxx"
31 #include <omnithread.h>
38 JobsManager(BL::SALOMEServices * salome_services);
39 virtual ~JobsManager();
41 void setObserver(BL::Observer * observer);
43 BL::Job * addNewJob(const std::string & name);
44 void removeJob(const std::string & name);
46 BL::Job * getJob(const std::string & name);
47 std::map<std::string, BL::Job *> & getJobs();
49 bool job_already_exist(const std::string & name);
51 virtual void start_job(const std::string & name);
52 virtual void refresh_jobs();
53 virtual void get_results_job(const std::string & name);
55 static void starting_job_thread(void * object_ptr);
56 static void get_results_job_thread(void * object_ptr);
57 static void refresh_job(void * object_ptr);
61 BL::JobsManager * object_ptr;
66 BL::SALOMEServices * _salome_services;
67 BL::Observer * _observer;
70 typedef std::map<std::string, BL::Job *> _jobs_map;
72 _jobs_map::iterator _jobs_it;
74 omni_mutex _thread_mutex;
75 omni_mutex _thread_mutex_results;