stream  0.10.0
stream analysis framework
Iterator.h
1 #ifndef BASE_ITERATOR_H
2 #define BASE_ITERATOR_H
3 
4 #include "base/Message.h"
5 
6 namespace base {
7 
10  class Iterator {
11  protected:
12  int fFormat;
13  void* fBuffer;
14  uint32_t fBufferLen;
15  uint32_t fBufferPos;
16  uint32_t fMsgSize;
17 
18  public:
19  Iterator(int fmt = formatNormal);
20 
21  ~Iterator();
22 
23  void setFormat(int fmt);
25  int getFormat() const { return fFormat; }
26 
28  uint32_t getMsgSize() const { return fMsgSize; }
29 
30  bool assign(void* buf, uint32_t len);
31 
33  inline bool islast() const { return fBufferPos >= fBufferLen; }
34 
36  inline static uint64_t FullTimeStamp(uint32_t epoch, uint16_t stamp)
37  { return ((uint64_t) epoch << 14) | (stamp & 0x3fff); }
38  };
39 }
40 
41 
42 #endif
iterator over raw data messages
Definition: Iterator.h:10
bool assign(void *buf, uint32_t len)
assign buffer
Definition: Iterator.cxx:35
int fFormat
format identifier
Definition: Iterator.h:12
uint32_t getMsgSize() const
get message size
Definition: Iterator.h:28
void setFormat(int fmt)
set format
Definition: Iterator.cxx:26
uint32_t fBufferLen
length of assigned buffer
Definition: Iterator.h:14
int getFormat() const
get format
Definition: Iterator.h:25
uint32_t fMsgSize
size of single message
Definition: Iterator.h:16
Iterator(int fmt=formatNormal)
constructor
Definition: Iterator.cxx:6
~Iterator()
destructor
Definition: Iterator.cxx:19
void * fBuffer
assigned buffer
Definition: Iterator.h:13
bool islast() const
returns true is last message was extracted from the buffer
Definition: Iterator.h:33
static uint64_t FullTimeStamp(uint32_t epoch, uint16_t stamp)
Expanded timestamp for 250 MHz * 14 bit epochs.
Definition: Iterator.h:36
uint32_t fBufferPos
current position
Definition: Iterator.h:15