00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4MbsSourceParameter.h"
00015
00016 #include "TGo4Log.h"
00017 #include "TGo4Status.h"
00018 #include "Go4EventServerTypes.h"
00019
00020 TGo4MbsSourceParameter::TGo4MbsSourceParameter() :
00021 TGo4EventSourceParameter("MbsSource", 0),
00022 fuStartEvent(0),
00023 fuStopEvent(0),
00024 fuEventInterval(0),
00025 fiPort(0),
00026 fiRetryCnt(0)
00027 {
00028 GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter()", __LINE__, __FILE__));
00029 }
00030
00031 TGo4MbsSourceParameter::TGo4MbsSourceParameter(const char* name, Int_t id) :
00032 TGo4EventSourceParameter(name, id),
00033 fuStartEvent(0),
00034 fuStopEvent(0),
00035 fuEventInterval(0),
00036 fiPort(0),
00037 fiRetryCnt(0)
00038 {
00039 GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter(const char*,...)", __LINE__, __FILE__));
00040 }
00041
00042 TGo4MbsSourceParameter::~TGo4MbsSourceParameter()
00043 {
00044 GO4TRACE((14,"TGo4MbsSourceParameter::~TGo4MbsSourceParameter()", __LINE__, __FILE__));
00045 }
00046
00047 Int_t TGo4MbsSourceParameter::PrintParameter(Text_t* buffer, Int_t buflen)
00048 {
00049 GO4TRACE((12,"TGo4MbsSourceParameter::PrintParameter()",__LINE__, __FILE__));
00050 Int_t locallen=128000;
00051 Text_t localbuf[128000];
00052 if(buflen<0 && buffer!=0)
00053 return 0;
00054 Int_t size=0;
00055 Int_t restlen=locallen;
00056 Text_t* current=localbuf;
00057
00058 Int_t delta=TGo4EventSourceParameter::PrintParameter(current,restlen);
00059 restlen-=delta;
00060 current+= delta;
00061 current=TGo4Status::PrintIndent(current,restlen);
00062 current=TGo4Status::PrintBuffer(current,restlen, " Startevent: \t%d",GetStartEvent());
00063 current=TGo4Status::PrintBuffer(current,restlen, "\t Stopevent: \t%d \n",GetStopEvent());
00064 current=TGo4Status::PrintIndent(current,restlen);
00065 current=TGo4Status::PrintBuffer(current,restlen, " Event interval: \t%d\n",GetEventInterval());
00066 if (GetPort()>0)
00067 current=TGo4Status::PrintBuffer(current,restlen, " Server port: \t%d \n",GetPort());
00068 if (GetRetryCnt()>0)
00069 current=TGo4Status::PrintBuffer(current,restlen, " Retry cnt: \t%d \n",GetRetryCnt());
00070
00071 if(buffer==0)
00072 {
00073 std::cout << localbuf << std::endl;
00074 }
00075 else
00076 {
00077 size=locallen-restlen;
00078 if(size>buflen-1)
00079 size=buflen-1;
00080 strncpy(buffer,localbuf,size);
00081 }
00082 return size;
00083 }
00084
00085 Bool_t TGo4MbsSourceParameter::UpdateFrom(TGo4Parameter* rhs)
00086 {
00087 GO4TRACE((12,"TGo4MbsSourceParameter::UpdateFrom()",__LINE__, __FILE__));
00088 if((rhs!=0) && rhs->InheritsFrom(TGo4MbsSourceParameter::Class())) {
00089 TGo4MbsSourceParameter* mbspar=dynamic_cast<TGo4MbsSourceParameter*>(rhs);
00090 if(!mbspar) return kFALSE;
00091 if(!TGo4EventSourceParameter::UpdateFrom(rhs)) return kFALSE;
00092 SetStartEvent(mbspar->GetStartEvent());
00093 SetStopEvent(mbspar->GetStopEvent());
00094 SetEventInterval(mbspar->GetEventInterval());
00095 SetPort(mbspar->GetPort());
00096 SetRetryCnt(mbspar->GetRetryCnt());
00097 return kTRUE;
00098 }
00099 return kFALSE;
00100 }