DABC (Data Acquisition Backbone Core)  2.9.9
eventsapi.h
Go to the documentation of this file.
1 // $Id: eventsapi.h 4470 2020-04-15 12:58:02Z linev $
2 
3 /************************************************************
4  * The Data Acquisition Backbone Core (DABC) *
5  ************************************************************
6  * Copyright (C) 2009 - *
7  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
8  * Planckstr. 1, 64291 Darmstadt, Germany *
9  * Contact: http://dabc.gsi.de *
10  ************************************************************
11  * This software can be used under the GPL license *
12  * agreements as stated in LICENSE.txt file *
13  * which is part of the distribution. *
14  ************************************************************/
15 
16 #ifndef DABC_eventsapi
17 #define DABC_eventsapi
18 
19 #include <cstdint>
20 
21 #ifndef DABC_Object
22 #include "dabc/Object.h"
23 #endif
24 
25 #ifndef DABC_Buffer
26 #include "dabc/Buffer.h"
27 #endif
28 
29 #ifndef DABC_Pointer
30 #include "dabc/Pointer.h"
31 #endif
32 
35 namespace dabc {
36 
44  class EventsIterator : public Object {
45  public:
46  EventsIterator(const std::string &name) : Object(name, flAutoDestroy) {}
47  virtual ~EventsIterator() {}
48 
49  virtual bool Assign(const Buffer& buf) = 0;
50  virtual void Close() = 0;
51 
52  virtual bool NextEvent() = 0;
53  virtual void* Event() = 0;
54  virtual BufferSize_t EventSize() = 0;
55 
56  unsigned NumEvents(const Buffer& buf);
57  };
58 
59  class EventsIteratorRef : public Reference {
61  };
62 
63  // ----------------------------------------------------------------------------------------
64 
65 
73  class EventsProducer : public Object {
74  public:
75  EventsProducer(const std::string &name) : Object(name, flAutoDestroy) {}
76  virtual ~EventsProducer() {}
77 
78  virtual bool Assign(const Buffer& buf) = 0;
79  virtual void Close() = 0;
80 
81  virtual bool GenerateEvent(uint64_t evid, uint64_t subid, uint64_t raw_size) = 0;
82  };
83 
84 
85  class EventsProducerRef : public Reference {
87  };
88 }
89 
90 #endif
#define DABC_REFERENCE(RefClass, ParentClass, T)
Definition: Reference.h:222
Reference on memory from memory pool.
Definition: Buffer.h:135
Iterator over events in dabc::Buffer class.
Definition: eventsapi.h:44
virtual void Close()=0
virtual bool Assign(const Buffer &buf)=0
virtual BufferSize_t EventSize()=0
virtual bool NextEvent()=0
unsigned NumEvents(const Buffer &buf)
Definition: eventsapi.cxx:20
EventsIterator(const std::string &name)
Definition: eventsapi.h:46
virtual ~EventsIterator()
Definition: eventsapi.h:47
virtual void * Event()=0
Producer of the events.
Definition: eventsapi.h:73
virtual ~EventsProducer()
Definition: eventsapi.h:76
virtual bool GenerateEvent(uint64_t evid, uint64_t subid, uint64_t raw_size)=0
EventsProducer(const std::string &name)
Definition: eventsapi.h:75
virtual void Close()=0
virtual bool Assign(const Buffer &buf)=0
Base class for most of the DABC classes.
Definition: Object.h:116
@ flAutoDestroy
object will be automatically destroyed when no references exists, normally set in constructor,...
Definition: Object.h:167
Reference on the arbitrary object
Definition: Reference.h:73
Event manipulation API.
Definition: api.h:23
uint32_t BufferSize_t
Definition: Buffer.h:32