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

/Go4CommandsAnalysis/TGo4ComSetParameter.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 "TGo4ComSetParameter.h"
00017 
00018 #include "Go4Log/TGo4Log.h"
00019 #include "Go4AnalysisClient/TGo4AnalysisClientImp.h"
00020 #include "Go4Analysis/TGo4AnalysisImp.h"
00021 
00022 TGo4ComSetParameter::TGo4ComSetParameter(const char* obname)
00023 :TGo4AnalysisObjectCommand("ANSetPara","Set new values to an existing parameter",obname),
00024 fxParameter(0)
00025 {
00026    TRACE((12,"TGo4ComSetParameter::TGo4ComSetParameter(const Text_t*) ctor",__LINE__, __FILE__));
00027    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00028                                                  // override default receiver
00029    SetProtection(kGo4ComModeController);
00030 }
00031 
00032 TGo4ComSetParameter::TGo4ComSetParameter()
00033 :TGo4AnalysisObjectCommand("ANSetPara","Set new values to an existing parameter","mypara"),
00034 fxParameter(0)
00035  {
00036    TRACE((12,"TGo4ComSetParameter::TGo4ComSetParameter() ctor",__LINE__, __FILE__));
00037    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00038                                                  // override default receiver
00039    SetProtection(kGo4ComModeController);
00040 }
00041 
00042 TGo4ComSetParameter::~TGo4ComSetParameter()
00043 {
00044    TRACE((12,"TGo4ComSetParameter::~TGo4ComSetParameter() dtor",__LINE__, __FILE__));
00045 }
00046 
00047 Int_t TGo4ComSetParameter::ExeCom()
00048 {
00049    TRACE((12,"TGo4ComSetParameter::ExeCom()",__LINE__, __FILE__));
00050 
00051    TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00052    if (cli!=0)
00053       {
00054       TRACE((11,"TGo4ComSetParameter::ExeCom() - found valid receiver",__LINE__, __FILE__));
00055          if(fxParameter==0)
00056             {
00057                cli->SendStatusMessage(3, kTRUE,"SetParameter - ERROR:  no settings specified for  %s",
00058                                                 GetObjectName());
00059                return 0;
00060             } else {}
00061          SetObjectName(fxParameter->GetName());
00062          TGo4Log::Debug(" %s : Setting parameter %s  ",
00063             GetName(), GetObjectName());
00064          TGo4Analysis* ana=TGo4Analysis::Instance();
00065          if(ana)
00066             {
00067                if(ana->SetParameter(GetObjectName(),fxParameter))
00068                   {
00069                     cli->SendStatusMessage(1, kTRUE,"Parameter %s was set to new values.",
00070                                                       GetObjectName());
00071                   }
00072                else
00073                   {
00074                      cli->SendStatusMessage(3, kTRUE,"SetParameter - ERROR: failed to set %s",
00075                                                       GetObjectName());
00076                   }
00077                if(fxParameter) delete fxParameter; // cleanup parameter on analysis side only,
00078                                                    // gui might own external parameter object
00079             } //    if(ana)
00080          else
00081             {
00082                 cli->SendStatusMessage(3, kTRUE," %s ERROR no analysis",
00083                                                  GetName());
00084             }
00085       }
00086    else
00087       {
00088          TRACE((11,"TGo4ComSetParameter::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00089          TGo4Log::Debug(" !!! %s : NO RECEIVER ERROR!!!",GetName());
00090          return 1;
00091       }
00092    return -1;
00093 }
00094 
00095 ClassImp(TGo4ComSetParameter)
00096 
00097 //----------------------------END OF GO4 SOURCE FILE ---------------------

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