GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4MbsSourceParameter.cxx
Go to the documentation of this file.
1 // $Id: TGo4MbsSourceParameter.cxx 999 2013-07-25 11:58:59Z 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 für 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 #include "Go4EventServerTypes.h"
19 
21  TGo4EventSourceParameter("MbsSource", 0),
22  fuStartEvent(0),
23  fuStopEvent(0),
24  fuEventInterval(0),
25  fiPort(0),
26  fiRetryCnt(0)
27 {
28  GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter()", __LINE__, __FILE__));
29 }
30 
32  TGo4EventSourceParameter(name, id),
33  fuStartEvent(0),
34  fuStopEvent(0),
35  fuEventInterval(0),
36  fiPort(0),
37  fiRetryCnt(0)
38 {
39  GO4TRACE((14,"TGo4MbsSourceParameter::TGo4MbsSourceParameter(const char*,...)", __LINE__, __FILE__));
40 }
41 
43 {
44  GO4TRACE((14,"TGo4MbsSourceParameter::~TGo4MbsSourceParameter()", __LINE__, __FILE__));
45 }
46 
47 Int_t TGo4MbsSourceParameter::PrintParameter(Text_t* buffer, Int_t buflen)
48 {
49  GO4TRACE((12,"TGo4MbsSourceParameter::PrintParameter()",__LINE__, __FILE__));
50  Int_t locallen=128000;
51  Text_t localbuf[128000];
52  if(buflen<0 && buffer!=0)
53  return 0;
54  Int_t size=0;
55  Int_t restlen=locallen;
56  Text_t* current=localbuf;
57 
58  Int_t delta=TGo4EventSourceParameter::PrintParameter(current,restlen);
59  restlen-=delta;
60  current+= delta;
61  current=TGo4Status::PrintIndent(current,restlen);
62  current=TGo4Status::PrintBuffer(current,restlen, " Startevent: \t%d",GetStartEvent());
63  current=TGo4Status::PrintBuffer(current,restlen, "\t Stopevent: \t%d \n",GetStopEvent());
64  current=TGo4Status::PrintIndent(current,restlen);
65  current=TGo4Status::PrintBuffer(current,restlen, " Event interval: \t%d\n",GetEventInterval());
66  if (GetPort()>0)
67  current=TGo4Status::PrintBuffer(current,restlen, " Server port: \t%d \n",GetPort());
68  if (GetRetryCnt()>0)
69  current=TGo4Status::PrintBuffer(current,restlen, " Retry cnt: \t%d \n",GetRetryCnt());
70 
71  if(buffer==0)
72  {
73  std::cout << localbuf << std::endl;
74  }
75  else
76  {
77  size=locallen-restlen;
78  if(size>buflen-1)
79  size=buflen-1;
80  strncpy(buffer,localbuf,size);
81  }
82  return size;
83 }
84 
86 {
87  GO4TRACE((12,"TGo4MbsSourceParameter::UpdateFrom()",__LINE__, __FILE__));
88  if((rhs!=0) && rhs->InheritsFrom(TGo4MbsSourceParameter::Class())) {
89  TGo4MbsSourceParameter* mbspar=dynamic_cast<TGo4MbsSourceParameter*>(rhs);
90  if(!mbspar) return kFALSE;
91  if(!TGo4EventSourceParameter::UpdateFrom(rhs)) return kFALSE;
92  SetStartEvent(mbspar->GetStartEvent());
93  SetStopEvent(mbspar->GetStopEvent());
95  SetPort(mbspar->GetPort());
96  SetRetryCnt(mbspar->GetRetryCnt());
97  return kTRUE;
98  }
99  return kFALSE;
100 }
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:85