GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4Display.cxx
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#include "TGo4Display.h"
15
16#include "TGo4Log.h"
17#include "TGo4ThreadHandler.h"
18#include "TGo4Task.h"
21#include "TGo4Status.h"
22
23#include "TGo4AnalysisProxy.h"
24#include "TGo4Slot.h"
25
26
28 : TGo4Master("Display",
29 isserver, // servermode
30 "dummy", //for clientmode only
31 0), // negotiationport - 0 = root will find next free port automatically
32 fxAnalysis(nullptr)
33{
34 // start gui timers instead of threads
35 fxDrawTimer = new TGo4DisplayDrawerTimer(this, 30);
36 fxLogTimer = new TGo4DisplayLoggerTimer(this, 500);
37 fxDrawTimer->TurnOn();
38 fxLogTimer->TurnOn();
39
40 // Start the GUI Registry
41 GetTask()->Launch();
42}
43
44
46{
47 GO4TRACE((15,"TGo4Display::~TGo4Display()", __LINE__, __FILE__));
48 //fxWorkHandler->CancelAll(); // make sure threads wont work on gui instance after it is deleted
49 if(GetTask())
51 delete fxDrawTimer;
52 delete fxLogTimer;
53 if (fxAnalysis) {
54 fxAnalysis->DisplayDeleted(this); // will also clear back referenc to us
55 TGo4Slot *pslot = fxAnalysis->ParentSlot();
56 if (pslot) {
57 pslot->Delete();
58 } else {
59 delete fxAnalysis; // regularly, we cleanup the analysis proxy.
60 }
61 }
62 TGo4Log::Info("------- TGO4DISPLAY DESTRUCTOR FINISHED. ------");
63}
64
65void TGo4Display::DisplayData(TObject *data)
66{
67 if (fxAnalysis)
68 fxAnalysis->ReceiveObject(dynamic_cast<TNamed*>(data));
69 else
70 delete data;
71}
72
74{
75 if (fxAnalysis)
76 fxAnalysis->ReceiveStatus(status);
77 else
78 delete status;
79}
80
81Bool_t TGo4Display::DisconnectSlave(const char *name, Bool_t waitforslave)
82{
83
84 // Note: taskhandlerabortexception and shutdown of analysis server
85 // both will schedule a TGo4ComDisconnectSlave into local command queue
86 // of master task, calling TGo4Master::DisconnectSlave()
87 // here we override this method to inform gui about this
89 //
90 // before disconnecting, gui might stop monitoring timers here....
91 //...
92 Bool_t rev = TGo4Master::DisconnectSlave(name, waitforslave); // should do all required things for disconnection
93 // after disconnecting, gui might react on result by cleaning up browser, window caption etc.
94 // for example:
95 if (rev && fxAnalysis)
96 fxAnalysis->DisplayDisconnected(this);
97
98 return rev;
99}
100
#define GO4TRACE(X)
Definition TGo4Log.h:25
timer which belongs to the Display, used instead of a thread to avoid conflicts with the Qt GUI inter...
timer which belongs to the Display, used instead of a thread to avoid conflicts with the Qt GUI inter...
TGo4DisplayDrawerTimer * fxDrawTimer
Timer for drawing job.
Definition TGo4Display.h:42
void DisplayLog(TGo4Status *Status)
Bool_t DisconnectSlave(const char *name=nullptr, Bool_t waitforslave=kTRUE) override
Add functionality to reset gui appearance here:
TGo4DisplayLoggerTimer * fxLogTimer
Timer for status logging job.
Definition TGo4Display.h:45
void DisplayData(TObject *)
virtual ~TGo4Display()
TGo4AnalysisProxy * fxAnalysis
Definition TGo4Display.h:47
TGo4Display(Bool_t isserver=kTRUE)
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:294
virtual Bool_t DisconnectSlave(const char *name=nullptr, Bool_t waitforslave=kTRUE)
void Delete(Option_t *opt="") override
Definition TGo4Slot.cxx:171
TGo4Task * GetTask() const
Int_t CancelAll()
Cancel all Threads in the thread list.
TGo4ThreadHandler * GetWorkHandler() const
Access to ThreadHandler for working threads.
void Launch()
This Method has to be called to create the startup threads and to turn on the application control tim...