CGEM BOSS 6.6.5.f
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
 
 FIFOStream ()
 
 FIFOStream (const FIFOStream &other)
 
 ~FIFOStream ()
 
virtual void send (const Issue *i)
 Sends an issue into the stream.
 
virtual Issuereceive ()
 Receives an issue from the stream.
 
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 ()
 
virtual void send (const Issue *i)
 Sends an issue into the stream.
 
virtual Issuereceive ()
 Receives an issue from the stream.
 
virtual void print_to (std::ostream &stream) const
 
 Stream ()
 
 Stream (const Stream &other)
 
 operator std::string () const
 
virtual ~Stream ()
 
virtual void send (const Issue *i)
 Sends an issue into the stream.
 
virtual Issuereceive ()
 Receives an issue from the stream.
 
virtual void print_to (std::ostream &stream) const
 

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 Event/ers/ers-00-00-03/ers/FIFOStream.h.

Constructor & Destructor Documentation

◆ FIFOStream() [1/4]

ers::FIFOStream::FIFOStream ( )

Definition at line 28 of file FIFOStream.cxx.

28: Stream() {}

◆ FIFOStream() [2/4]

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
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~FIFOStream() [1/2]

ers::FIFOStream::~FIFOStream ( )

Definition at line 37 of file FIFOStream.cxx.

37{}

◆ FIFOStream() [3/4]

ers::FIFOStream::FIFOStream ( )

◆ FIFOStream() [4/4]

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

◆ ~FIFOStream() [2/2]

ers::FIFOStream::~FIFOStream ( )

Member Function Documentation

◆ print_to() [1/2]

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

◆ print_to() [2/2]

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

Reimplemented from ers::Stream.

◆ receive() [1/2]

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

◆ receive() [2/2]

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

Receives an issue from the stream.

Reads an isssue on the stream

Returns
the issue that has been read
Note
This implementation always returns a null pointer

Reimplemented from ers::Stream.

◆ send() [1/2]

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

◆ send() [2/2]

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

Sends an issue into the stream.

Sends the issue to the stream.

Parameters
ithe issue to send
Note
This implementation silently discards the Issue

Reimplemented from ers::Stream.

Member Data Documentation

◆ FIFO_STREAM_KEY

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

Key for FIFO stream

Definition at line 27 of file Event/ers/ers-00-00-03/ers/FIFOStream.h.

Referenced by print_to().

◆ m_issue_queue

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

Definition at line 25 of file Event/ers/ers-00-00-03/ers/FIFOStream.h.

Referenced by FIFOStream().


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