GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4MbsSourceParameter.cxx
Go to the documentation of this file.
1 // $Id: TGo4MbsSourceParameter.cxx 2748 2020-04-16 09:50:56Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4MbsSourceParameter.h"
15 
16 #include "TGo4Log.h"
17 #include "TGo4Status.h"
18 
20  TGo4EventSourceParameter("MbsSource", 0),
21  fuStartEvent(0),
22  fuStopEvent(0),
23  fuEventInterval(0),
24  fiPort(0),
25  fiRetryCnt(0)
26 {
27  GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter()", __LINE__, __FILE__));
28 }
29 
31  TGo4EventSourceParameter(name, id),
32  fuStartEvent(0),
33  fuStopEvent(0),
34  fuEventInterval(0),
35  fiPort(0),
36  fiRetryCnt(0)
37 {
38  GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter(const char*,...)", __LINE__, __FILE__));
39 }
40 
42 {
43  GO4TRACE((14,"TGo4MbsSourceParameter::~TGo4MbsSourceParameter()", __LINE__, __FILE__));
44 }
45 
46 Int_t TGo4MbsSourceParameter::PrintParameter(Text_t* buffer, Int_t buflen)
47 {
48  GO4TRACE((12,"TGo4MbsSourceParameter::PrintParameter()",__LINE__, __FILE__));
49  Int_t locallen=128000;
50  Text_t localbuf[128000];
51  if(buflen<0 && buffer!=0)
52  return 0;
53  Int_t size=0;
54  Int_t restlen=locallen;
55  Text_t* current=localbuf;
56 
57  Int_t delta=TGo4EventSourceParameter::PrintParameter(current,restlen);
58  restlen-=delta;
59  current+= delta;
60  current=TGo4Status::PrintIndent(current,restlen);
61  current=TGo4Status::PrintBuffer(current,restlen, " Startevent: \t%d",GetStartEvent());
62  current=TGo4Status::PrintBuffer(current,restlen, "\t Stopevent: \t%d \n",GetStopEvent());
63  current=TGo4Status::PrintIndent(current,restlen);
64  current=TGo4Status::PrintBuffer(current,restlen, " Event interval: \t%d\n",GetEventInterval());
65  if (GetPort()>0)
66  current=TGo4Status::PrintBuffer(current,restlen, " Server port: \t%d \n",GetPort());
67  if (GetRetryCnt()>0)
68  current=TGo4Status::PrintBuffer(current,restlen, " Retry cnt: \t%d \n",GetRetryCnt());
69 
70  if(buffer==0)
71  {
72  std::cout << localbuf << std::endl;
73  }
74  else
75  {
76  size=locallen-restlen;
77  if(size>buflen-1)
78  size=buflen-1;
79  strncpy(buffer,localbuf,size);
80  }
81  return size;
82 }
83 
85 {
86  GO4TRACE((12,"TGo4MbsSourceParameter::UpdateFrom()",__LINE__, __FILE__));
87  if((rhs!=0) && rhs->InheritsFrom(TGo4MbsSourceParameter::Class())) {
88  TGo4MbsSourceParameter* mbspar=dynamic_cast<TGo4MbsSourceParameter*>(rhs);
89  if(!mbspar) return kFALSE;
90  if(!TGo4EventSourceParameter::UpdateFrom(rhs)) return kFALSE;
91  SetStartEvent(mbspar->GetStartEvent());
92  SetStopEvent(mbspar->GetStopEvent());
94  SetPort(mbspar->GetPort());
95  SetRetryCnt(mbspar->GetRetryCnt());
96  return kTRUE;
97  }
98  return kFALSE;
99 }
void SetStartEvent(UInt_t firstindex)
void SetStopEvent(UInt_t lastindex)
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
static Text_t * PrintIndent(Text_t *buffer, Int_t &buflen)
Definition: TGo4Status.cxx:72
virtual Int_t PrintParameter(Text_t *buffer=0, Int_t buflen=0)
virtual Int_t PrintParameter(Text_t *buffer=0, Int_t buflen=0)
void SetEventInterval(UInt_t skipinterval)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:84