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