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