00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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();
00072 }
00073 else
00074 {
00075 cout << status->GetName()<< endl;
00076 }
00077 delete status;
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
00090 TGo4Command* com = new TGo4ComAction1();
00091 return com;
00092 }
00093
00094