00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4TestThreadManager.h"
00017
00018 #include "Riostream.h"
00019
00020 #include "TGo4Log.h"
00021 #include "TGo4ThreadHandler.h"
00022 #include "TGo4TestRunnable.h"
00023
00024 TGo4TestThreadManager::TGo4TestThreadManager(const TGo4TestThreadManager &right)
00025 :TGo4ThreadManager(right)
00026 {
00027 TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager copy ctor",__LINE__, __FILE__));
00028 }
00029
00030 TGo4TestThreadManager::TGo4TestThreadManager (const char* name)
00031 :TGo4ThreadManager(name,kFALSE)
00032 {
00033 TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager (Text_t* name) constructor",__LINE__, __FILE__));
00034 fxControlRunnable=new TGo4TestRunnable("ControlRunnable",this,1);
00035 TGo4TestRunnable* th1run= new TGo4TestRunnable("HistogramMaker1",this,4);
00036 TGo4TestRunnable* th2run= new TGo4TestRunnable("HistogramMaker2",this,4);
00037
00038 TGo4TestRunnable* th4run= new TGo4TestRunnable("Exceptiontester",this,6);
00039 TGo4TestRunnable* th5run= new TGo4TestRunnable("Service thread",this,0);
00040
00041 fxWorkHandler->NewThread("First Thread",th1run);
00042 fxWorkHandler->NewThread("Second Thread",th2run);
00043 fxWorkHandler->NewThread("Third Thread",th5run);
00044 fxWorkHandler->NewThread("Fourth Thread",th4run);
00045 fxWorkHandler->NewThread("Control",fxControlRunnable);
00046 cout << "thread manager: all threads added to handler"<<endl;
00047
00048 fxCanvas=new TCanvas(GetName(),"TestRunnable",1200,400);
00049 fxPad1= new TPad("Pad1","TestRunnablePad",0.02,0.02,0.48,0.83,33);
00050 fxPad2= new TPad("Pad2","TestRunnablePad",0.52,0.02,0.98,0.83,33);
00051 fxCanvas->cd();
00052 cout <<"canvas drawn"<<endl;
00053 fxPad1->Draw();
00054 fxCanvas->cd();
00055 fxPad2->Draw();
00056 cout <<"pads drawn"<<endl;
00057 fxCanvas->Modified();
00058 fxCanvas->Update();
00059
00060 Launch();
00061 }
00062
00063 TGo4TestThreadManager::~TGo4TestThreadManager()
00064 {
00065 TRACE((15,"TGo4TestThreadManager::~TGo4TestThreadManager destructor",__LINE__, __FILE__));
00066 delete fxPad1;
00067 delete fxPad2;
00068 delete fxCanvas;
00069 }
00070
00071 Int_t TGo4TestThreadManager::TestAction ()
00072 {
00073 TRACE((14,"TGo4TestThreadManager::TestAction",__LINE__, __FILE__));
00074
00075 return 0;
00076 }
00077
00078 TCanvas* TGo4TestThreadManager::GetCanvas ()
00079 {
00080 TRACE((12,"TGo4TestThreadManager::GetCanvas",__LINE__, __FILE__));
00081 return fxCanvas;
00082 }
00083
00084 TPad* TGo4TestThreadManager::GetPad1 ()
00085 {
00086 TRACE((12,"TGo4TestThreadManager::GetPad1",__LINE__, __FILE__));
00087 return fxPad1;
00088 }
00089
00090 TPad* TGo4TestThreadManager::GetPad2 ()
00091 {
00092 TRACE((12,"TGo4TestThreadManager::GetPad2",__LINE__, __FILE__));
00093 return fxPad2;
00094 }
00095
00096