00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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();
00065 }
00066 else
00067 {
00068 cout << status->GetName()<< endl;
00069 }
00070 delete status;
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
00083 TGo4Command* com = new TGo4ComAction1();
00084 return com;
00085 }
00086
00087