Back to index

salome-gui  6.5.0
Session_ServerLauncher.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME Session : implementation of Session_ServerLauncher.hxx
00024 //  File   : Session_ServerLauncher.hxx
00025 //  Author : Paul RASCLE, EDF
00026 
00027 #ifndef _SESSION_SERVERLAUNCHER_HXX_
00028 #define _SESSION_SERVERLAUNCHER_HXX_
00029 
00030 #include "SALOME_Session.hxx"
00031 
00032 #include <CORBA.h> 
00033 #include <list>
00034 #include <vector>
00035 #include <string>
00036 #include <QThread>
00037 
00038 class SESSION_EXPORT ServArg
00039   {
00040   public:
00041     int _servType;
00042     int _firstArg;
00043     int _lastArg;
00044     inline ServArg(int servType=0, int firstArg=0, int lastArg=0);
00045 };
00046 
00047 inline ServArg::ServArg(int servType, int firstArg, int lastArg):
00048   _servType(servType),_firstArg(firstArg),_lastArg(lastArg)
00049 {}
00050 
00051 class Session_ServerThread;
00052 
00053 class QMutex;
00054 class QWaitCondition;
00055 
00056 class SESSION_EXPORT Session_ServerLauncher: public QThread
00057 {
00058 public:
00059   Session_ServerLauncher();
00060   Session_ServerLauncher(int argc,
00061                          char ** argv, 
00062                          CORBA::ORB_ptr orb, 
00063                          PortableServer::POA_ptr poa,
00064                          QMutex *GUIMutex,
00065                          QWaitCondition *ServerLaunch,
00066                          QMutex *SessionMutex,
00067                          QWaitCondition *SessionStarted);
00068   virtual ~Session_ServerLauncher();
00069   void run();
00070   void KillAll();
00071 
00072 protected:
00073   void CheckArgs();
00074   void ActivateAll();
00075 
00076 private:
00077   int                              _argc;
00078   char**                           _argv;
00079   CORBA::ORB_var                    _orb;
00080   PortableServer::POA_var          _root_poa;
00081   QMutex*                          _GUIMutex;
00082   QWaitCondition*                  _ServerLaunch;
00083   QMutex*                          _SessionMutex;
00084   QWaitCondition*                  _SessionStarted;
00085   std::list<ServArg>               _argServToLaunch;
00086   std::vector<std::string>         _argCopy;
00087   std::list<Session_ServerThread*> _serverThreads;
00088 };
00089 
00090 #endif
00091