Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4ThreadManagerExample/TGo4TestThreadManager.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
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    //TGo4TestRunnable* th3run= new TGo4TestRunnable("dummy action 3",this,0);
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 //   strcpy(txtbuffer,"WorkHandlerOf_");
00042 //   strcat(txtbuffer,name);
00043 //   fxWorkHandler= new TGo4ThreadHandler(txtbuffer,this);
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          // to be ommitted
00084          return *this;
00085       }
00086    else
00087       {
00088          // copy is already source object
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   // no test action so far...
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 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:07 2005 for Go4-v2.10-5 by doxygen1.2.15