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

/Go4Display/TGo4Display.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 "TGo4Display.h"
00017 
00018 #include <iostream.h>
00019 #include <unistd.h>
00020 
00021 #include "qwidget.h"
00022 
00023 #include "Go4Log/TGo4Log.h"
00024 #include "Go4CommandsAnalysis/TGo4AnalysisCommandList.h"
00025 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00026 #include "Go4StatusBase/TGo4CanvasWrapper.h"
00027 #include "Go4TaskHandler/TGo4TaskManager.h"
00028 #include "TGo4DisplayDrawerTimer.h"
00029 #include "TGo4DisplayLoggerTimer.h"
00030 
00031 const Long_t TGo4Display::fglDRAWTIMERPERIOD=100;    // time in ms 100
00032 const Long_t TGo4Display::fglLOGTIMERPERIOD=500;     // time in ms 1000
00033 
00034 
00035 
00036 TGo4Display::TGo4Display(UInt_t negotport, const char* hostname, Bool_t isserver)
00037    : TGo4Master("Display", 
00038                   isserver, // servermode
00039                   hostname, //for clientmode only
00040                   negotport // negotiationport
00041                   )
00042 {
00043    // start gui timers instead of threads
00044    fxDrawTimer= new TGo4DisplayDrawerTimer(this,fglDRAWTIMERPERIOD);
00045    fxLogTimer= new TGo4DisplayLoggerTimer(this,fglLOGTIMERPERIOD);
00046    fxDrawTimer->TurnOn();
00047    fxLogTimer->TurnOn();
00048 
00049     // Start the GUI Registry
00050    fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00051    fxTGo4GUIRegistry->SetDisplay(this);
00052    GetTask()->Launch();
00053 
00054 }
00055 
00056 
00057 TGo4Display::~TGo4Display()
00058 {
00059    TRACE((15,"TGo4Display::~TGo4Display()", __LINE__, __FILE__));
00060    //fxWorkHandler->CancelAll(); // make sure threads wont work on gui instance after it is deleted
00061    if(GetTask())
00062       GetTask()->GetWorkHandler()->CancelAll();
00063    delete fxDrawTimer;
00064    delete fxLogTimer;
00065    TGo4Log::Debug(" Display Task -- deleting gui main window ");
00066    QWidget* mw=fxTGo4GUIRegistry->GetMainWindow();
00067    delete mw;
00068    TGo4Log::Debug(" Display Task -- deleting gui registry ");
00069    delete fxTGo4GUIRegistry;
00070 }
00071 
00072 void TGo4Display::DisplayData(TObject* data)
00073 {
00074    TNamed* nam=dynamic_cast<TNamed*>(data);
00075    fxTGo4GUIRegistry->DisplayData(nam);
00076 }
00077 
00078 
00079 TGo4TaskHandlerCommandList* TGo4Display::CreateCommandList()
00080 {
00081    return ( new TGo4AnalysisCommandList());
00082 
00083 }
00084 
00085 void TGo4Display::DisplayLog(TGo4Status * Status)
00086 {
00087    fxTGo4GUIRegistry->DisplayLog(Status);
00088 }
00089 
00090 void TGo4Display::SetSlave(const char*node, const char* shell, const char* command)
00091 {
00092    TGo4Master::SetSlave(node,shell,command);
00093    fxTGo4GUIRegistry->SetClientNode(node); // remember for remote kill    
00094    fxTGo4GUIRegistry->SetClientShell(shell); // remember for remote kill    
00095    fxTGo4GUIRegistry->SetClientProgram(command); // remember for kill    
00096  
00097    
00098 }
00099 void TGo4Display::StartSlaveWindow(const char* command)
00100 {
00101    fxTGo4GUIRegistry->StartAnalysisWindow(command);   
00102 }
00103 
00104 Bool_t TGo4Display::DisconnectSlave(const char* name, Bool_t waitforslave)
00105 {
00106 fxTGo4GUIRegistry->StopMonitoring();
00107 Bool_t rev=TGo4Master::DisconnectSlave(name,waitforslave);
00108 if(rev) fxTGo4GUIRegistry->SetMasterMode(0);
00109 return rev;   
00110 }
00111 
00112 ClassImp(TGo4Display)
00113 
00114 //----------------------------END OF GO4 SOURCE FILE ---------------------

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