GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4Runnable.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGo4Runnable_H
15 #define TGo4Runnable_H
16 
17 #include "TNamed.h"
18 
19 class TGo4Thread;
20 class TGo4ThreadManager;
21 class TGo4Exception;
22 
32 class TGo4Runnable : public TNamed {
33  friend class TGo4Thread;
34 
35  public:
36  TGo4Runnable(const TGo4Runnable &right);
37 
38  TGo4Runnable (const char *name, TGo4ThreadManager *man);
39 
40  virtual ~TGo4Runnable();
41 
42  void SetThread (TGo4Thread *gthread) { fxGo4Thread = gthread; }
43 
44  TGo4Thread *GetThread() const { return fxGo4Thread; }
45 
47 
48  protected:
49 
51 
53  virtual Int_t Run(void *ptr) = 0;
54 
56  virtual Int_t PreRun(void *ptr);
57 
59  virtual Int_t PostRun(void *ptr);
60 
62  virtual void ThreadCatch(TGo4Exception &ex);
63 
65  virtual void UnexpectedCatch();
66 
71 
75  TGo4Thread *fxGo4Thread{nullptr};
76 };
77 
78 #endif
TGo4Thread * GetThread() const
Definition: TGo4Runnable.h:44
virtual void ThreadCatch(TGo4Exception &ex)
TGo4ThreadManager * fxManager
Definition: TGo4Runnable.h:70
TGo4Thread * fxGo4Thread
Definition: TGo4Runnable.h:75
TGo4ThreadManager * GetThreadManager() const
Definition: TGo4Runnable.h:46
virtual ~TGo4Runnable()
virtual void UnexpectedCatch()
virtual Int_t PreRun(void *ptr)
void SetThread(TGo4Thread *gthread)
Definition: TGo4Runnable.h:42
virtual Int_t Run(void *ptr)=0
virtual Int_t PostRun(void *ptr)