GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
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"
23#include "TGo4Log.h"
24
25const 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
44void 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
62void 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
79void TGo4EventSource::Clear(Option_t *)
80{
81 // dummy clear, may be implemented by user
82 TGo4Log::Info("Default clear of eventsource %s", GetName());
83}
84
86{
87 return GetName();
88}
89
91{
92 return cl->InheritsFrom(TGo4EventElement::Class());
93}
#define GO4TRACE(X)
Definition TGo4Log.h:25
Exception to throw on event source timeout.
Exception to be thrown on error of event source.
virtual const char * GetActiveName() const
Access to the name of the currently active source.
static const Int_t fgiTIMEOUTDEFAULT
Default timeout in seconds for event input.
void SetErrMess(const char *txt)
To be used for modification of the message by the event source implementation.
void SetEventStatus(Int_t status)
Status of the last event.
virtual Bool_t CheckEventClass(TClass *cl)
Check that event class is supported by event source.
void ThrowError(Int_t creastat, Int_t errstat, const char *message,...)
Exception thrower.
void ThrowEOF(Int_t creastat, Int_t errstat, const char *message,...)
EOF thrower.
virtual ~TGo4EventSource()
void SetCreateStatus(Int_t status)
Status value of event source init (file/server open).
void Clear(Option_t *opt="") override
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:294