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