Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4TaskHandlerExample/TGo4ExampleController.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 <iostream.h>
00019 
00020 #include "TGo4ComAction1.h"
00021 
00022 TGo4ExampleController::TGo4ExampleController() :
00023   fxPreviousData(0), fxCanvas(0)
00024 {
00025   TRACE((15,"TGo4ExampleController::TGo4ExampleController() constructor",__LINE__, __FILE__));
00026   fxCanvas=new TCanvas("Example Display","Go4 controller canvas",3);
00027 }
00028 
00029 TGo4ExampleController::~TGo4ExampleController()
00030 {
00031   TRACE((15,"TGo4ExampleController::~TGo4ExampleController() destructor",__LINE__, __FILE__));
00032   delete fxPreviousData;
00033   delete fxCanvas;
00034 }
00035 
00036 void TGo4ExampleController::DisplayData(TObject* data)
00037 {
00038    TRACE((12,"TGo4ExampleController::DisplayData(TNamed*)",__LINE__, __FILE__));
00039   if(data)
00040     {
00041      delete fxPreviousData;
00042      fxPreviousData=data;
00043       cout << "ExampleController received data object:"<<endl;
00044       cout << "Classname:"<< data->ClassName()<<", Name:" << data->GetName()<< endl;
00045       fxCanvas->cd();
00046       fxPreviousData->Draw();
00047       fxCanvas->Modified();
00048       fxCanvas->Update();
00049     }
00050   else
00051     {
00052       cout << "ExampleController has NULL data object"<<endl;
00053     }
00054 }
00055 
00056 void TGo4ExampleController::DisplayLog(TGo4Status* status)
00057 {
00058   TRACE((12,"TGo4ExampleController::DisplayLog(TGo4Status*)",__LINE__, __FILE__));
00059   if(status)
00060     {
00061       cout << "ExampleController received status object:"<<endl;
00062       if(status->InheritsFrom("TGo4ExampleClientStatus"))
00063          {
00064             status->PrintStatus(); // display client status object
00065          }
00066      else
00067       {
00068             cout << status->GetName()<< endl; // status message
00069       }
00070       delete status; // avoid memory leak
00071     }
00072   else
00073     {
00074       cout << "ExampleController has NULL status object"<<endl;
00075     }
00076 
00077 }
00078 
00079 TGo4Command* TGo4ExampleController::GetCommand()
00080 {
00081   TRACE((12,"TGo4ExampleController::GetCommand()",__LINE__, __FILE__));
00082     // this function simulates a user input of a command, e.g. using a cli or a gui
00083     TGo4Command* com = new TGo4ComAction1();
00084     return com;
00085 }
00086 
00087 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:07 2005 for Go4-v2.10-5 by doxygen1.2.15