GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ExampleController.cxx
Go to the documentation of this file.
1 // $Id: TGo4ExampleController.cxx 2757 2020-04-16 11:45:21Z linev $
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 "TGo4ExampleController.h"
15 
16 #include <iostream>
17 #include "TCanvas.h"
18 
19 #include "TGo4Log.h"
20 #include "TGo4Status.h"
21 
22 #include "TGo4ComAction1.h"
23 
25  fxPreviousData(0), fxCanvas(0)
26 {
27  GO4TRACE((15,"TGo4ExampleController::TGo4ExampleController() constructor",__LINE__, __FILE__));
28  fxCanvas=new TCanvas("Example Display","Go4 controller canvas",3);
29 }
30 
32 {
33  GO4TRACE((15,"TGo4ExampleController::~TGo4ExampleController() destructor",__LINE__, __FILE__));
34  delete fxPreviousData;
35  delete fxCanvas;
36 }
37 
39 {
40  GO4TRACE((12,"TGo4ExampleController::DisplayData(TNamed*)",__LINE__, __FILE__));
41  if(data)
42  {
43  delete fxPreviousData;
44  fxPreviousData=data;
45  std::cout << "ExampleController received data object:"<<std::endl;
46  std::cout << "Classname:"<< data->ClassName()<<", Name:" << data->GetName()<< std::endl;
47  fxCanvas->cd();
48  fxPreviousData->Draw();
49  fxCanvas->Modified();
50  fxCanvas->Update();
51  }
52  else
53  {
54  std::cout << "ExampleController has NULL data object"<<std::endl;
55  }
56 }
57 
59 {
60  GO4TRACE((12,"TGo4ExampleController::DisplayLog(TGo4Status*)",__LINE__, __FILE__));
61  if(status)
62  {
63  std::cout << "ExampleController received status object:"<<std::endl;
64  if(status->InheritsFrom("TGo4ExampleClientStatus"))
65  {
66  status->PrintStatus(); // display client status object
67  }
68  else
69  {
70  std::cout << status->GetName()<< std::endl; // status message
71  }
72  delete status; // avoid memory leak
73  }
74  else
75  {
76  std::cout << "ExampleController has NULL status object"<<std::endl;
77  }
78 
79 }
80 
82 {
83  GO4TRACE((12,"TGo4ExampleController::GetCommand()",__LINE__, __FILE__));
84  // this function simulates a user input of a command, e.g. using a cli or a gui
85  TGo4Command* com = new TGo4ComAction1();
86  return com;
87 }
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
Definition: TGo4Status.cxx:53
#define GO4TRACE(X)
Definition: TGo4Log.h:26
void DisplayLog(TGo4Status *)