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

TGo4ExampleController.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 "TGo4ExampleController.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TObject.h"
00021 #include "TCanvas.h"
00022 
00023 #include "TGo4Log.h"
00024 #include "TGo4Status.h"
00025 #include "TGo4Command.h"
00026 
00027 #include "TGo4ComAction1.h"
00028 
00029 TGo4ExampleController::TGo4ExampleController() :
00030   fxPreviousData(0), fxCanvas(0)
00031 {
00032   TRACE((15,"TGo4ExampleController::TGo4ExampleController() constructor",__LINE__, __FILE__));
00033   fxCanvas=new TCanvas("Example Display","Go4 controller canvas",3);
00034 }
00035 
00036 TGo4ExampleController::~TGo4ExampleController()
00037 {
00038   TRACE((15,"TGo4ExampleController::~TGo4ExampleController() destructor",__LINE__, __FILE__));
00039   delete fxPreviousData;
00040   delete fxCanvas;
00041 }
00042 
00043 void TGo4ExampleController::DisplayData(TObject* data)
00044 {
00045    TRACE((12,"TGo4ExampleController::DisplayData(TNamed*)",__LINE__, __FILE__));
00046   if(data)
00047     {
00048      delete fxPreviousData;
00049      fxPreviousData=data;
00050       cout << "ExampleController received data object:"<<endl;
00051       cout << "Classname:"<< data->ClassName()<<", Name:" << data->GetName()<< endl;
00052       fxCanvas->cd();
00053       fxPreviousData->Draw();
00054       fxCanvas->Modified();
00055       fxCanvas->Update();
00056     }
00057   else
00058     {
00059       cout << "ExampleController has NULL data object"<<endl;
00060     }
00061 }
00062 
00063 void TGo4ExampleController::DisplayLog(TGo4Status* status)
00064 {
00065   TRACE((12,"TGo4ExampleController::DisplayLog(TGo4Status*)",__LINE__, __FILE__));
00066   if(status)
00067     {
00068       cout << "ExampleController received status object:"<<endl;
00069       if(status->InheritsFrom("TGo4ExampleClientStatus"))
00070          {
00071             status->PrintStatus(); // display client status object
00072          }
00073      else
00074       {
00075             cout << status->GetName()<< endl; // status message
00076       }
00077       delete status; // avoid memory leak
00078     }
00079   else
00080     {
00081       cout << "ExampleController has NULL status object"<<endl;
00082     }
00083 
00084 }
00085 
00086 TGo4Command* TGo4ExampleController::GetCommand()
00087 {
00088   TRACE((12,"TGo4ExampleController::GetCommand()",__LINE__, __FILE__));
00089     // this function simulates a user input of a command, e.g. using a cli or a gui
00090     TGo4Command* com = new TGo4ComAction1();
00091     return com;
00092 }
00093 
00094 //----------------------------END OF GO4 SOURCE FILE ---------------------

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