GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4TestThreadManager.cxx
Go to the documentation of this file.
1 // $Id: TGo4TestThreadManager.cxx 999 2013-07-25 11:58:59Z linev $
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 für 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 #include "TGo4TestThreadManager.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4ThreadHandler.h"
18 #include "TGo4TestRunnable.h"
19 
21  :TGo4ThreadManager(right)
22 {
23  GO4TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager copy ctor",__LINE__, __FILE__));
24 }
25 
27  :TGo4ThreadManager(name,kFALSE)
28 {
29  GO4TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager (const char* name) constructor",__LINE__, __FILE__));
30  fxControlRunnable=new TGo4TestRunnable("ControlRunnable",this,1);
31  TGo4TestRunnable* th1run= new TGo4TestRunnable("HistogramMaker1",this,4);
32  TGo4TestRunnable* th2run= new TGo4TestRunnable("HistogramMaker2",this,4);
33  //TGo4TestRunnable* th3run= new TGo4TestRunnable("dummy action 3",this,0);
34  TGo4TestRunnable* th4run= new TGo4TestRunnable("Exceptiontester",this,6);
35  TGo4TestRunnable* th5run= new TGo4TestRunnable("Service thread",this,0);
36 
37  fxWorkHandler->NewThread("First Thread",th1run);
38  fxWorkHandler->NewThread("Second Thread",th2run);
39  fxWorkHandler->NewThread("Third Thread",th5run);
40  fxWorkHandler->NewThread("Fourth Thread",th4run);
42  TGo4Log::Info("thread manager: all threads added to handler");
43 
44  fxCanvas=new TCanvas(GetName(),"TestRunnable",1200,400);
45  fxPad1= new TPad("Pad1","TestRunnablePad",0.02,0.02,0.48,0.83,33);
46  fxPad2= new TPad("Pad2","TestRunnablePad",0.52,0.02,0.98,0.83,33);
47  fxCanvas->cd();
48  TGo4Log::Info("canvas drawn");
49  fxPad1->Draw();
50  fxCanvas->cd();
51  fxPad2->Draw();
52  TGo4Log::Info("pads drawn");
53  fxCanvas->Modified();
54  fxCanvas->Update();
55 
56  Launch();
57 }
58 
60 {
61  GO4TRACE((15,"TGo4TestThreadManager::~TGo4TestThreadManager destructor",__LINE__, __FILE__));
62  delete fxPad1;
63  delete fxPad2;
64  delete fxCanvas;
65 }
66 
68 {
69  GO4TRACE((14,"TGo4TestThreadManager::TestAction",__LINE__, __FILE__));
70  // no test action so far...
71  return 0;
72 }
73 
75 {
76  GO4TRACE((12,"TGo4TestThreadManager::GetCanvas",__LINE__, __FILE__));
77  return fxCanvas;
78 }
79 
81 {
82  GO4TRACE((12,"TGo4TestThreadManager::GetPad1",__LINE__, __FILE__));
83  return fxPad1;
84 }
85 
87 {
88  GO4TRACE((12,"TGo4TestThreadManager::GetPad2",__LINE__, __FILE__));
89  return fxPad2;
90 }
TGo4ThreadHandler * fxWorkHandler
Bool_t NewThread(const char *name, TGo4Runnable *runnable)
TGo4TestRunnable * fxControlRunnable
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static void Info(const char *text,...)
Definition: TGo4Log.cxx:283