GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventSource.cxx
Go to the documentation of this file.
1 // $Id: TGo4EventSource.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 "TGo4EventSource.h"
15 
16 #include <stdarg.h>
17 
18 #include "TClass.h"
19 
20 #include "TGo4EventElement.h"
22 #include "TGo4EventEndException.h"
23 #include "TGo4Log.h"
24 
25 const Int_t TGo4EventSource::fgiTIMEOUTDEFAULT=1; // source timeout default in seconds
26 
28  TNamed(name, "This is a Go4 Event Source"),
29  fiCreateStatus(0),
30  fiEventStatus(0)
31 {
32  GO4TRACE((15,"TGo4EventSource::TGo4EventSource()",__LINE__, __FILE__));
33 }
34 
36  TNamed("default eventsource","This is a Go4 EventSource"),
37  fiCreateStatus(0),
38  fiEventStatus(0)
39 {
40 }
41 
43 {
44  GO4TRACE((15,"TGo4EventSource::~TGo4EventSource()",__LINE__, __FILE__));
45 }
46 
47 void TGo4EventSource::ThrowError(Int_t crestat, Int_t errstat, const char* message,...)
48 {
49  //
50  UInt_t lbuflen = TGo4EventSource::fguTXTLEN;
51  char *txtbuf = new char[lbuflen];
52  va_list args;
53  va_start(args, message);
54  vsnprintf(txtbuf, lbuflen, message, args);
55  va_end(args);
56  if(crestat!=0)
57  SetCreateStatus(crestat);
58  if(errstat!=0)
59  SetEventStatus(errstat);
60  SetErrMess(txtbuf);
61  delete[] txtbuf;
62  throw TGo4EventErrorException(this);
63 }
64 
65 void TGo4EventSource::ThrowEOF(Int_t crestat, Int_t errstat, const char* message,...)
66 {
67  UInt_t lbuflen = TGo4EventSource::fguTXTLEN;
68  char *txtbuf = new char[lbuflen];
69  va_list args;
70  va_start(args, message);
71  vsnprintf(txtbuf, lbuflen, message, args);
72  va_end(args);
73  if(crestat!=0)
74  SetCreateStatus(crestat);
75  if(errstat!=0)
76  SetEventStatus(errstat);
77  SetErrMess(txtbuf);
78  delete[] txtbuf;
79  throw TGo4EventEndException(this);
80 }
81 
82 void TGo4EventSource::Clear(Option_t*)
83 {
84  // dummy clear, may be implemented by user
85  TGo4Log::Info("Default clear of eventsource %s", GetName());
86 }
87 
88 
90 {
91  return GetName();
92 }
93 
95 {
96  return cl->InheritsFrom(TGo4EventElement::Class());
97 }
void ThrowEOF(Int_t creastat, Int_t errstat, const char *message,...)
virtual ~TGo4EventSource()
virtual Bool_t CheckEventClass(TClass *cl)
void SetCreateStatus(Int_t status)
void ThrowError(Int_t creastat, Int_t errstat, const char *message,...)
void SetErrMess(const char *txt)
virtual const char * GetActiveName()
static const Int_t fgiTIMEOUTDEFAULT
void SetEventStatus(Int_t status)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static void Info(const char *text,...)
Definition: TGo4Log.cxx:297
virtual void Clear(Option_t *opt="")