GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventSource.cxx
Go to the documentation of this file.
1 // $Id: TGo4EventSource.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 "TGo4EventSource.h"
15 
16 #include "TClass.h"
17 #include "snprintf.h"
18 
19 #include "TGo4EventElement.h"
21 #include "TGo4EventEndException.h"
22 #include "TGo4Log.h"
23 
24 const Int_t TGo4EventSource::fgiTIMEOUTDEFAULT=1; // source timeout default in seconds
25 
27  TNamed(name, "This is a Go4 Event Source"),
28  fiCreateStatus(0),
29  fiEventStatus(0)
30 {
31  GO4TRACE((15,"TGo4EventSource::TGo4EventSource()",__LINE__, __FILE__));
32 }
33 
35  TNamed("default eventsource","This is a Go4 EventSource"),
36  fiCreateStatus(0),
37  fiEventStatus(0)
38 {
39 }
40 
42 {
43  GO4TRACE((15,"TGo4EventSource::~TGo4EventSource()",__LINE__, __FILE__));
44 }
45 
46 void TGo4EventSource::ThrowError(Int_t crestat, Int_t errstat, const char* message,...)
47 {
48  //
49  UInt_t lbuflen = TGo4EventSource::fguTXTLEN;
50  char* txtbuf = new char[lbuflen];
51  va_list args;
52  va_start(args, message);
53  vsnprintf(txtbuf, lbuflen, message, args);
54  va_end(args);
55  if(crestat!=0)
56  SetCreateStatus(crestat);
57  if(errstat!=0)
58  SetEventStatus(errstat);
59  SetErrMess(txtbuf);
60  delete[] txtbuf;
61  throw TGo4EventErrorException(this);
62 }
63 
64 void TGo4EventSource::ThrowEOF(Int_t crestat, Int_t errstat, const char* message,...)
65 {
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:283
virtual void Clear(Option_t *opt="")