GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4MbsFileParameter.cxx
Go to the documentation of this file.
1 // $Id: TGo4MbsFileParameter.cxx 2627 2019-10-01 08:02:45Z 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 "TGo4MbsFileParameter.h"
15 
16 #include "TObjString.h"
17 
18 #include "TGo4Log.h"
19 #include "TGo4Status.h"
20 #include "Go4EventServerTypes.h"
21 
22 const char* TGo4MbsFile__fgcNOTAGFILE = "GO4-NOLMDTAG";
23 
26  fxTagFile(),
27  fxMoreFiles()
28 {
29  GO4TRACE((14,"TGo4MbsFileParameter::TGo4MbsFileParameter()", __LINE__, __FILE__));
31 }
32 
35  fxTagFile(),
36  fxMoreFiles()
37 {
38  GO4TRACE((14,"TGo4MbsFileParameter::TGo4MbsFileParameter(const char*,...)", __LINE__, __FILE__));
40 }
41 
43 {
44  GO4TRACE((14,"TGo4MbsFileParameter::~TGo4MbsFileParameter()", __LINE__, __FILE__));
45 }
46 
47 void TGo4MbsFileParameter::AddMoreFile(const char* more)
48 {
49  TGo4Log::Debug("Add more lmd file %s", more);
50 
51  fxMoreFiles.SetOwner(kTRUE);
52  fxMoreFiles.Add(new TObjString(more));
53 }
54 
55 const char* TGo4MbsFileParameter::GetMoreName(Int_t n) const
56 {
57  return (n>=0) && (n<=fxMoreFiles.GetLast()) ? fxMoreFiles.At(n)->GetName() : 0;
58 }
59 
60 
61 Int_t TGo4MbsFileParameter::PrintParameter(Text_t* buffer, Int_t buflen)
62 {
63  GO4TRACE((12,"TGo4MbsFileParameter::PrintParameter()",__LINE__, __FILE__));
64  Int_t locallen=128000;
65  Text_t localbuf[128000];
66  if(buflen<0 && buffer!=0)
67  return 0;
68  Int_t size=0;
69  Int_t restlen = locallen;
70  Text_t* current = localbuf;
71 
72  Int_t delta = TGo4MbsSourceParameter::PrintParameter(current,restlen);
73  restlen-=delta;
74  current+= delta;
75  current=TGo4Status::PrintBuffer(current,restlen, "Tagfile: %s \n",GetTagName());
76  if(buffer==0)
77  {
78  std::cout << localbuf << std::endl;
79  }
80  else
81  {
82  size=locallen-restlen;
83  if(size>buflen-1)
84  size=buflen-1;
85  strncpy(buffer,localbuf,size);
86  }
87  return size;
88 }
89 
91 {
92  GO4TRACE((12,"TGo4MbsFileParameter::UpdateFrom()",__LINE__, __FILE__));
93  if((rhs!=0) && rhs->InheritsFrom(TGo4MbsFileParameter::Class())) {
94  TGo4MbsFileParameter* mbspar=dynamic_cast<TGo4MbsFileParameter*>(rhs);
95  if(!mbspar) return kFALSE;
96  if(!TGo4MbsSourceParameter::UpdateFrom(rhs)) return kFALSE;
97  SetTagName(mbspar->GetTagName());
98  return kTRUE;
99  }
100 
101  return kFALSE;
102 }
const char * TGo4MbsFile__fgcNOTAGFILE
void SetTagName(const char *name)
virtual Int_t PrintParameter(Text_t *buffer=0, Int_t buflen=0)
virtual Int_t PrintParameter(Text_t *buffer=0, Int_t buflen=0)
const char * GetMoreName(Int_t n) const
void AddMoreFile(const char *more)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
virtual Bool_t UpdateFrom(TGo4Parameter *rhs)
static Text_t * PrintBuffer(char *buffer, Int_t &buflen, const char *text,...)
Definition: TGo4Status.cxx:84
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274
const char * GetTagName() const