S3FC project page S3FC home page

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

s3_inplace_fifo_base Class Template Reference

Abstract Base Class (ABC) used to derive FIFO queue classes allowing inplace operation. More...

#include <s3_inplace_fifo_base.h>

Inheritance diagram for s3_inplace_fifo_base:

Inheritance graph
[legend]
Collaboration diagram for s3_inplace_fifo_base:

Collaboration graph
[legend]
List of all members.

Public Methods

void push (const T &t)
 Insert data at candidate production slot (queue head). More...

virtual T pop ()
 Remove and return data at candidate consumption slot (queue tail). More...

virtual T * open_input ()=0
 Acquire the next available production slot. More...

virtual T * nbl_open_input ()=0
 Non-blocking version of open_input(). More...

virtual void close_input (const T *t=0)=0
 Close a producer slot, making it available for consumption. More...

virtual T * open_output ()=0
 Acquire the next available consumption slot. More...

virtual T * nbl_open_output ()=0
 Non-blocking version of open_output(). More...

virtual void close_output (const T *t=0)=0
 Close a previously acquired consumer slot, freeing it. More...


Detailed Description

template<typename T>
class s3_inplace_fifo_base< T >

Abstract Base Class (ABC) used to derive FIFO queue classes allowing inplace operation.

It extends the interface of the s3_fifo_base to include calls to open and close producer and consumer slots. Templated on the type of objects stored in the queue. Each slot can only be acquired once for production and once for consumption. Slots are acquired for consumption in the same order the were acquired for production.

Definition at line 51 of file s3_inplace_fifo_base.h.


Member Function Documentation

template<typename T>
virtual void s3_inplace_fifo_base< T >::close_input const T *    t = 0 [pure virtual]
 

Close a producer slot, making it available for consumption.

This must be called when production has finished, to make this slot available. In a queue capable of multiple concurrent producers, the pointer obtained from the corresponding open_input() call should also be passed as an argument. A default argument of 0 allows this as a void call in the case of a single-producer queue. If a 0 argument is passed to a multiple-producer queue, the call is ignored. This allows easy migration between blocking and non-blocking calls.

Parameters:
t  Slot address obtained when open_input() was called.

Implemented in s3_fifo_queue.

Referenced by s3_inplace_fifo_base< s3_message >::push.

template<typename T>
virtual void s3_inplace_fifo_base< T >::close_output const T *    t = 0 [pure virtual]
 

Close a previously acquired consumer slot, freeing it.

This must be called when consumption has finished, to make this slot available. In a queue capable of multiple concurrent consumers. the pointer obtained from the corresponding open_output() call should also be passed as an argument. A default argument of 0 allows this as a void call in the case of a single-consumer queue. If a 0 argument is passed to a multiple-producer queue, the call is ignored. This allows easy migration between blocking and non-blocking calls.

Parameters:
t  Slot address obtained when open_output() was called.

Implemented in s3_fifo_queue.

Referenced by s3_inplace_fifo_base< s3_message >::pop.

template<typename T>
virtual T* s3_inplace_fifo_base< T >::nbl_open_input   [pure virtual]
 

Non-blocking version of open_input().

Perform the following as a single atomic operation:

      if ! empty():
         return open_input()
   else:
      return 0
      

Implemented in s3_fifo_queue.

template<typename T>
virtual T* s3_inplace_fifo_base< T >::nbl_open_output   [pure virtual]
 

Non-blocking version of open_output().

Perform the following as a single atomic operation:

      if ! full():
         return open_output()
   else:
      return 0
      

Implemented in s3_fifo_queue.

template<typename T>
virtual T* s3_inplace_fifo_base< T >::open_input   [pure virtual]
 

Acquire the next available production slot.

A pointer to an object, type T, stored in the queue. The slot contents can be manipulated and close_input() should be called if the operation on the acquired slot is done. The slot storage is owned by the queue and should not be messed with (deleted). In a queue capable of multiple concurrent producers, this pointer should also be passed to the corresponding close_input() call.

Returns:
Pointer to next available queue slot.

Implemented in s3_fifo_queue.

Referenced by s3_inplace_fifo_base< s3_message >::push.

template<typename T>
virtual T* s3_inplace_fifo_base< T >::open_output   [pure virtual]
 

Acquire the next available consumption slot.

A pointer to an object, type T, stored in the queue. The slot contents can be manipulated and close_output() should be called if the operation on the acquired slot is done. The slot storage is owned by the queue and should not be messed with (deleted). In a queue capable of multiple concurrent consumers, this pointer should also be passed to the corresponding close_output() call.

Returns:
Pointer to next available queue slot.

Implemented in s3_fifo_queue.

Referenced by s3_inplace_fifo_base< s3_message >::pop.

template<typename T>
virtual T s3_inplace_fifo_base< T >::pop   [inline, virtual]
 

Remove and return data at candidate consumption slot (queue tail).

This is implemented using the assignment operator to extract the object from the queue and the copy constructor to return it. T should be default-constructable.

Returns:
The element at the tail of the queue.

Implements s3_fifo_base.

Reimplemented in s3_inplace_fifo_mux::stub_queue.

Definition at line 74 of file s3_inplace_fifo_base.h.

Referenced by s3_post_office::main_loop.

template<typename T>
void s3_inplace_fifo_base< T >::push const T &    t [inline, virtual]
 

Insert data at candidate production slot (queue head).

This is implemented using the assignment operator, T::operator=(const T&)

Parameters:
t  Object to push into queue head.

Implements s3_fifo_base.

Reimplemented in s3_inplace_fifo_mux::stub_queue.

Definition at line 60 of file s3_inplace_fifo_base.h.

Referenced by s3_post_office::main_loop.


The documentation for this class was generated from the following file:
Send comments to: s3fc@stonethree.com SourceForge Logo