BOSS 8.0.0
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
 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 ()
 Stream ()
 Stream (const Stream &other)
 operator std::string () const
virtual ~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 Event/ers/include/ers/FIFOStream.h.

Constructor & Destructor Documentation

◆ FIFOStream() [1/6]

ers::FIFOStream::FIFOStream ( )

Definition at line 28 of file FIFOStream.cxx.

28: Stream() {}

Referenced by FIFOStream().

◆ FIFOStream() [2/6]

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 {
33 Issue* cloned = other.m_issue_queue[i]->clone();
34 m_issue_queue.push_back( cloned );
35 } // for
36} // FIFOStream
std::deque< Issue * > m_issue_queue
Index other(Index i, Index j)

◆ ~FIFOStream() [1/3]

ers::FIFOStream::~FIFOStream ( )

Definition at line 38 of file FIFOStream.cxx.

38{}

◆ FIFOStream() [3/6]

ers::FIFOStream::FIFOStream ( )

◆ FIFOStream() [4/6]

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

◆ ~FIFOStream() [2/3]

ers::FIFOStream::~FIFOStream ( )

◆ FIFOStream() [5/6]

ers::FIFOStream::FIFOStream ( )

◆ FIFOStream() [6/6]

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

◆ ~FIFOStream() [3/3]

ers::FIFOStream::~FIFOStream ( )

Member Function Documentation

◆ print_to() [1/3]

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

Reimplemented from ers::Stream.

Definition at line 64 of file FIFOStream.cxx.

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

◆ print_to() [2/3]

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

Reimplemented from ers::Stream.

◆ print_to() [3/3]

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

Reimplemented from ers::Stream.

◆ receive() [1/3]

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 57 of file FIFOStream.cxx.

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

◆ receive() [2/3]

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.

◆ receive() [3/3]

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/3]

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 46 of file FIFOStream.cxx.

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

◆ send() [2/3]

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.

◆ send() [3/3]

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

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

Key for FIFO stream

Definition at line 28 of file Event/ers/include/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/include/ers/FIFOStream.h.

Referenced by FIFOStream(), print_to(), receive(), and send().


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