00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TGo4TestThreadManager.h"
00017
00018 #include <iostream.h>
00019
00020 #include "Go4Log/TGo4Log.h"
00021 #include "TGo4TestRunnable.h"
00022
00023 TGo4TestThreadManager::TGo4TestThreadManager(const TGo4TestThreadManager &right)
00024 :TGo4ThreadManager(right)
00025 {
00026 TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager copy ctor",__LINE__, __FILE__));
00027 }
00028
00029 TGo4TestThreadManager::TGo4TestThreadManager (Text_t* name)
00030 :TGo4ThreadManager(name,kFALSE)
00031 {
00032 TRACE((15,"TGo4TestThreadManager::TGo4TestThreadManager (Text_t* name) constructor",__LINE__, __FILE__));
00033 fxControlRunnable=new TGo4TestRunnable("ControlRunnable",this,1);
00034 TGo4TestRunnable* th1run= new TGo4TestRunnable("HistogramMaker1",this,4);
00035 TGo4TestRunnable* th2run= new TGo4TestRunnable("HistogramMaker2",this,4);
00036
00037 TGo4TestRunnable* th4run= new TGo4TestRunnable("Exceptiontester",this,6);
00038 TGo4TestRunnable* th5run= new TGo4TestRunnable("Service thread",this,0);
00039
00040 Text_t* txtbuffer= new Text_t[fguTEXTLENGTH];
00041
00042
00043
00044 fxWorkHandler->NewThread("First Thread",th1run);
00045 fxWorkHandler->NewThread("Second Thread",th2run);
00046 fxWorkHandler->NewThread("Third Thread",th5run);
00047 fxWorkHandler->NewThread("Fourth Thread",th4run);
00048 fxWorkHandler->NewThread("Control",fxControlRunnable);
00049 cout << "thread manager: all threads added to handler"<<endl;
00050 delete txtbuffer;
00051 fxCanvas=new TCanvas(GetName(),"TestRunnable",1200,400);
00052 fxPad1= new TPad("Pad1","TestRunnablePad",0.02,0.02,0.48,0.83,33);
00053 fxPad2= new TPad("Pad2","TestRunnablePad",0.52,0.02,0.98,0.83,33);
00054 fxCanvas->cd();
00055 cout <<"canvas drawn"<<endl;
00056 fxPad1->Draw();
00057 fxCanvas->cd();
00058 fxPad2->Draw();
00059 cout <<"pads drawn"<<endl;
00060 fxCanvas->Modified();
00061 fxCanvas->Update();
00062
00063 Launch();
00064 }
00065
00066
00067 TGo4TestThreadManager::~TGo4TestThreadManager()
00068 {
00069 TRACE((15,"TGo4TestThreadManager::~TGo4TestThreadManager destructor",__LINE__, __FILE__));
00070 delete fxPad1;
00071 delete fxPad2;
00072 delete fxCanvas;
00073 }
00074
00075
00076 TGo4TestThreadManager & TGo4TestThreadManager::operator=(const TGo4TestThreadManager &right)
00077 {
00078 TRACE((15,"TGo4TestThreadManager::operator=",__LINE__, __FILE__));
00079 if (&right!=this)
00080 {
00081 TRACE((14,"TGo4TestThreadManager::operator= processing copy",__LINE__, __FILE__));
00082 TGo4ThreadManager::operator=(right);
00083
00084 return *this;
00085 }
00086 else
00087 {
00088
00089 TRACE((14,"TGo4TestThreadManager::operator= source and destination objects are identical",__LINE__, __FILE__));
00090 return *this;
00091 }
00092 }
00093
00094
00095
00096 Int_t TGo4TestThreadManager::TestAction ()
00097 {
00098 TRACE((14,"TGo4TestThreadManager::TestAction",__LINE__, __FILE__));
00099
00100 return 0;
00101 }
00102
00103 TCanvas* TGo4TestThreadManager::GetCanvas ()
00104 {
00105 TRACE((12,"TGo4TestThreadManager::GetCanvas",__LINE__, __FILE__));
00106 return fxCanvas;
00107 }
00108
00109 TPad* TGo4TestThreadManager::GetPad1 ()
00110 {
00111 TRACE((12,"TGo4TestThreadManager::GetPad1",__LINE__, __FILE__));
00112 return fxPad1;
00113 }
00114
00115 TPad* TGo4TestThreadManager::GetPad2 ()
00116 {
00117 TRACE((12,"TGo4TestThreadManager::GetPad2",__LINE__, __FILE__));
00118 return fxPad2;
00119 }
00120
00121 ClassImp(TGo4TestThreadManager)
00122
00123
00124
00125
00126
00127