00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4ExampleController.h"
00015
00016 #include "Riostream.h"
00017
00018 #include "TObject.h"
00019 #include "TCanvas.h"
00020
00021 #include "TGo4Log.h"
00022 #include "TGo4Status.h"
00023 #include "TGo4Command.h"
00024
00025 #include "TGo4ComAction1.h"
00026
00027 TGo4ExampleController::TGo4ExampleController() :
00028 fxPreviousData(0), fxCanvas(0)
00029 {
00030 TRACE((15,"TGo4ExampleController::TGo4ExampleController() constructor",__LINE__, __FILE__));
00031 fxCanvas=new TCanvas("Example Display","Go4 controller canvas",3);
00032 }
00033
00034 TGo4ExampleController::~TGo4ExampleController()
00035 {
00036 TRACE((15,"TGo4ExampleController::~TGo4ExampleController() destructor",__LINE__, __FILE__));
00037 delete fxPreviousData;
00038 delete fxCanvas;
00039 }
00040
00041 void TGo4ExampleController::DisplayData(TObject* data)
00042 {
00043 TRACE((12,"TGo4ExampleController::DisplayData(TNamed*)",__LINE__, __FILE__));
00044 if(data)
00045 {
00046 delete fxPreviousData;
00047 fxPreviousData=data;
00048 cout << "ExampleController received data object:"<<endl;
00049 cout << "Classname:"<< data->ClassName()<<", Name:" << data->GetName()<< endl;
00050 fxCanvas->cd();
00051 fxPreviousData->Draw();
00052 fxCanvas->Modified();
00053 fxCanvas->Update();
00054 }
00055 else
00056 {
00057 cout << "ExampleController has NULL data object"<<endl;
00058 }
00059 }
00060
00061 void TGo4ExampleController::DisplayLog(TGo4Status* status)
00062 {
00063 TRACE((12,"TGo4ExampleController::DisplayLog(TGo4Status*)",__LINE__, __FILE__));
00064 if(status)
00065 {
00066 cout << "ExampleController received status object:"<<endl;
00067 if(status->InheritsFrom("TGo4ExampleClientStatus"))
00068 {
00069 status->PrintStatus();
00070 }
00071 else
00072 {
00073 cout << status->GetName()<< endl;
00074 }
00075 delete status;
00076 }
00077 else
00078 {
00079 cout << "ExampleController has NULL status object"<<endl;
00080 }
00081
00082 }
00083
00084 TGo4Command* TGo4ExampleController::GetCommand()
00085 {
00086 TRACE((12,"TGo4ExampleController::GetCommand()",__LINE__, __FILE__));
00087
00088 TGo4Command* com = new TGo4ComAction1();
00089 return com;
00090 }