Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4Display.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "Riostream.h"
00019 
00020 #include "TGo4Log.h"
00021 #include "TGo4ThreadHandler.h"
00022 #include "TGo4Task.h"
00023 #include "TGo4TaskManager.h"
00024 #include "TGo4DisplayDrawerTimer.h"
00025 #include "TGo4DisplayLoggerTimer.h"
00026 #include "TGo4Status.h"
00027 
00028 #include "TGo4AnalysisProxy.h"
00029 
00030 TGo4Display::TGo4Display(Bool_t isserver)
00031    : TGo4Master("Display",
00032                 isserver, // servermode
00033                 "dummy", //for clientmode only
00034                 1), // negotiationport
00035      fxAnalysis(0)
00036 {
00037    // start gui timers instead of threads
00038    fxDrawTimer= new TGo4DisplayDrawerTimer(this, 30);
00039    fxLogTimer= new TGo4DisplayLoggerTimer(this, 500);
00040    fxDrawTimer->TurnOn();
00041    fxLogTimer->TurnOn();
00042 
00043     // Start the GUI Registry
00044    GetTask()->Launch();
00045 }
00046 
00047 
00048 TGo4Display::~TGo4Display()
00049 {
00050    TRACE((15,"TGo4Display::~TGo4Display()", __LINE__, __FILE__));
00051    //fxWorkHandler->CancelAll(); // make sure threads wont work on gui instance after it is deleted
00052    if(GetTask())
00053       GetTask()->GetWorkHandler()->CancelAll();
00054    delete fxDrawTimer;
00055    delete fxLogTimer;
00056    if (fxAnalysis!=0)
00057      fxAnalysis->DisplayDeleted(this);
00058 //   cout <<"------- TGO4DISPLAY DESTRUCTOR FINISHED. ------" << endl;
00059 }
00060 
00061 void TGo4Display::DisplayData(TObject* data)
00062 {
00063    if (fxAnalysis!=0)
00064      fxAnalysis->ReceiveObject(dynamic_cast<TNamed*>(data));
00065    else
00066       delete data;
00067 }
00068 
00069 void TGo4Display::DisplayLog(TGo4Status * Status)
00070 {
00071    if (fxAnalysis!=0)
00072      fxAnalysis->ReceiveStatus(Status);
00073    else
00074      delete Status;
00075 }
00076 
00077 Bool_t TGo4Display::DisconnectSlave(const char* name, Bool_t waitforslave)
00078 {
00079 // Note: taskhandlerabortexception and shutdown of analysis server
00080 // both will schedule a TGo4ComDisconnectSlave into local command queue
00081 // of master task, calling TGo4Master::DisconnectSlave()
00082 // here we override this method to inform gui about this
00084 //
00085 // before disconnecting, gui might stop monitoring timers here....
00086 //...
00087   Bool_t rev=TGo4Master::DisconnectSlave(name,waitforslave); // should do all required things for disconnection
00088   // after disconnecting, gui might react on result by cleaning up browser, window caption etc.
00089   // for example:
00090   if(rev)
00091      {
00092        if (fxAnalysis!=0)
00093 
00094           fxAnalysis->DisplayDisconnected(this);
00095 
00096 //        cout <<"+++++++++ TGo4Display::DisconnectSlave success on disconnect!!!" << endl;
00097 //        cout <<"+++++++++ Please add something to inform GUI here about disconnected analysis!!!" << endl;
00098      }
00099    else
00100      {
00101 //        cout <<"+++++++++ TGo4Display::DisconnectSlave failed!!!" << endl;
00102 //        cout <<"+++++++++ Please add something to inform GUI here..." << endl;
00103      }
00104 
00105   return rev;
00106 }
00107 
00108 
00109 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:07 2008 for Go4-v3.04-1 by  doxygen 1.4.2