BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
ers::FIFOStream Class Reference

Queue stream. More...

#include <FIFOStream.h>

+ Inheritance diagram for ers::FIFOStream:

Public Member Functions

 FIFOStream ()
 
 FIFOStream (const FIFOStream &other)
 
 ~FIFOStream ()
 
virtual void send (const Issue *i)
 
virtual Issuereceive ()
 
virtual void print_to (std::ostream &stream) const
 
- Public Member Functions inherited from ers::Stream
 Stream ()
 
 Stream (const Stream &other)
 
 operator std::string () const
 
virtual ~Stream ()
 

Static Public Attributes

static const char *const FIFO_STREAM_KEY = "fifo"
 
- Static Public Attributes inherited from ers::Stream
static const char *const NULL_STREAM_KEY = "null"
 

Protected Attributes

std::deque< Issue * > m_issue_queue
 

Detailed Description

Queue stream.

This streams is used to transmit Issues inside a process.

Author
Matthias Wiesmann
Version
1.0
Note
This stream is not thread safe - it cannot depend on thread library.

Definition at line 22 of file FIFOStream.h.

Constructor & Destructor Documentation

◆ FIFOStream() [1/2]

ers::FIFOStream::FIFOStream ( )

Definition at line 28 of file FIFOStream.cxx.

28: Stream() {}

◆ FIFOStream() [2/2]

ers::FIFOStream::FIFOStream ( const FIFOStream & other)

Definition at line 30 of file FIFOStream.cxx.

30 : Stream(other) {
31 for(unsigned int i=0;i<other.m_issue_queue.size();i++) {
32 Issue *cloned = other.m_issue_queue[i]->clone();
33 m_issue_queue.push_back(cloned);
34 } // for
35} // FIFOStream
std::deque< Issue * > m_issue_queue
Definition FIFOStream.h:25
friend class Issue
Definition Stream.h:36
Index other(Index i, Index j)

◆ ~FIFOStream()

ers::FIFOStream::~FIFOStream ( )

Definition at line 37 of file FIFOStream.cxx.

37{}

Member Function Documentation

◆ print_to()

void ers::FIFOStream::print_to ( std::ostream & stream) const
virtual

Reimplemented from ers::Stream.

Definition at line 63 of file FIFOStream.cxx.

63 {
64 stream << ers::FIFOStream::FIFO_STREAM_KEY << ":[" ;
65 for(unsigned int i=0;i<m_issue_queue.size();i++) {
66 stream << m_issue_queue[i]->what() ;
67 if (i!=m_issue_queue.size()-1) {
68 stream << ", " ;
69 } // if not last
70 } // for elements
71 stream << "]" ;
72} // print_to
static const char *const FIFO_STREAM_KEY
Definition FIFOStream.h:27

◆ receive()

ers::Issue * ers::FIFOStream::receive ( )
virtual

Blocking read into the stream.

Returns
a reference to the next Issue
Note
This method is not implemented, pending some form of common TDAQ thread library.

Reimplemented from ers::Stream.

Definition at line 56 of file FIFOStream.cxx.

56 {
57 if (m_issue_queue.empty()) return 0 ;
58 Issue *issue = m_issue_queue[0] ;
59 m_issue_queue.pop_front();
60 return issue ;
61} // receive

◆ send()

void ers::FIFOStream::send ( const Issue * i)
virtual

Sends the issue into the stream. This method should put the issue into a FIFO queue and be non blocking

Parameters
ipointer to the issue to send
Note
This method is not implemented, pending some form of common TDAQ thread library.

Reimplemented from ers::Stream.

Definition at line 45 of file FIFOStream.cxx.

45 {
46 ERS_PRE_CHECK_PTR(issue_ptr);
47 Issue *cloned = issue_ptr->clone();
48 m_issue_queue.push_back(cloned);
49} // send
#define ERS_PRE_CHECK_PTR(p)

Member Data Documentation

◆ FIFO_STREAM_KEY

const char *const ers::FIFOStream::FIFO_STREAM_KEY = "fifo"
static

Key for FIFO stream

Definition at line 27 of file FIFOStream.h.

Referenced by print_to().

◆ m_issue_queue

std::deque<Issue*> ers::FIFOStream::m_issue_queue
protected

Definition at line 25 of file FIFOStream.h.

Referenced by FIFOStream().


The documentation for this class was generated from the following files: