Salome HOME
e23568ed2f0d9402bfc63c1040a70629879c3fe9
[modules/gui.git] / src / Session / Session_ServerCheck.hxx
1 //  Copyright (C) 2007-2008  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.
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 // File   : Session_ServerCheck.hxx
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25 #if !defined(SESSION_SERVERCHECK_HXX)
26 #define SESSION_SERVERCHECK_HXX
27
28 #include "SALOME_Session.hxx"
29
30 #include <QThread> 
31 #include <QMutex>
32
33 class QWaitCondition;
34
35 class SESSION_EXPORT Session_ServerCheck : public QThread
36 {
37   class Locker;
38
39 public:
40   Session_ServerCheck( QMutex*, QWaitCondition* );
41   virtual ~Session_ServerCheck();
42
43   QString         currentMessage();
44   QString         error();
45
46   int             currentStep();
47   int             totalSteps();
48
49 protected:
50   virtual void    run();
51
52 private:
53   void            setStep( const int );
54   void            setError( const QString& msg );
55
56 private:
57   QMutex          myDataMutex;         //!< data mutex
58   QMutex*         myMutex;             //!< splash mutex
59   QWaitCondition* myWC;                //!< splash wait condition
60
61   bool            myCheckCppContainer; //!< flag : check C++ container
62   bool            myCheckPyContainer;  //!< flag : check Python container
63   bool            myCheckSVContainer;  //!< flag : check supervision container
64   int             myAttempts;          //!< number of attemtps to get response from server
65   int             myDelay;             //!< delay between attempts in microseconds
66   int             myCurrentStep;       //!< current step
67   QString         myMessage;           //!< current information message
68   QString         myError;             //!< error message
69
70   friend class Locker;
71 };
72
73 #endif  // SESSION_SERVERCHECK_HXX