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_mux Class Template Reference

Inplace FIFO queue multiplexer/demultiplexer: Multiplex or demultiplexa single s3_inplace_fifo_base<T> into a number of virtual queues, which are also s3_inplace_fifo_base<T> 's. More...

#include <s3_inplace_fifo_mux.h>

Collaboration diagram for s3_inplace_fifo_mux:

Collaboration graph
[legend]
List of all members.

Public Methods

 s3_inplace_fifo_mux ()
 Default constructor that initialises the instance to the following state: is_started() == false auto_select == true no virtual queues no fifo queue. More...

 ~s3_inplace_fifo_mux ()
 Destructor: delete all the virtual queues - if is important to not refer to any queue returned by create_vqueue after this instance has destructed. More...

void start ()
 Start the mux. More...

void stop ()
 Stop the mux. More...

bool is_started () const
 Return whether this instance is in the started state. More...

s3_inplace_fifo_base< T > & create_vqueue ()
 Create a new virtual queue stub, add it at the end of the virtual queue list. More...

void destroy_vqueue (const s3_inplace_fifo_base< T > &vq)
 Remove the specified queue form the virtual queue list. More...

void set_queue (s3_inplace_fifo_base< T > &q)
 Set the actual queue s3_inplace_fifo_base<T> queue that this mux multiplexes. More...


Private Attributes

s3_mutex state_lock
s3_inplace_fifo_base< T > * queue
std::vector< s3_inplace_fifo_mux<
T >::stub_queue * > 
vqueue_list
int current_idx
bool started
bool auto_select

Friends

class stub_queue

Detailed Description

template<typename T>
class s3_inplace_fifo_mux< T >

Inplace FIFO queue multiplexer/demultiplexer: Multiplex or demultiplexa single s3_inplace_fifo_base<T> into a number of virtual queues, which are also s3_inplace_fifo_base<T> 's.

Definition at line 48 of file s3_inplace_fifo_mux.h.


Constructor & Destructor Documentation

template<typename T>
s3_inplace_fifo_mux< T >::s3_inplace_fifo_mux  
 

Default constructor that initialises the instance to the following state: is_started() == false auto_select == true no virtual queues no fifo queue.

  • * - * - * -

Definition at line 196 of file s3_inplace_fifo_mux.tcc.

References auto_select, current_idx, queue, started, and vqueue_list.

template<typename T>
s3_inplace_fifo_mux< T >::~s3_inplace_fifo_mux  
 

Destructor: delete all the virtual queues - if is important to not refer to any queue returned by create_vqueue after this instance has destructed.

Definition at line 207 of file s3_inplace_fifo_mux.tcc.

References vqueue_list.


Member Function Documentation

template<typename T>
s3_inplace_fifo_base< T > & s3_inplace_fifo_mux< T >::create_vqueue  
 

Create a new virtual queue stub, add it at the end of the virtual queue list.

A reference to this new queue is returned. This instance, and not the caller, owns the new queue. This may only be performed with the mux not in the started state and an s3_generic_exception is thrown if this condition is violated.

Precondition:
is_started() == false
Returns:
New s3_inplace_fifo_base<T> representing a virtual queue.

Definition at line 262 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, started, state_lock, stub_queue, s3_mutex::unlock, and vqueue_list.

template<typename T>
void s3_inplace_fifo_mux< T >::destroy_vqueue const s3_inplace_fifo_base< T > &    vq
 

Remove the specified queue form the virtual queue list.

The queue argument should be one that was returned by create_vqueue(). As the queue is destroyed during this method (delete 'ed), no operations should be attempted on it after this has been invoked. If q is not a queue that was returned by create_vqueue, it is not in the virtual queue list or this instance is in the started state, an s3_generic_exception is thrown.

Precondition:
is_started() == false
Parameters:
q  Reference to virtual queue that should be destroyed.

Definition at line 281 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, started, state_lock, s3_mutex::unlock, and vqueue_list.

template<typename T>
bool s3_inplace_fifo_mux< T >::is_started   const
 

Return whether this instance is in the started state.

Definition at line 251 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, started, state_lock, and s3_mutex::unlock.

template<typename T>
void s3_inplace_fifo_mux< T >::set_queue s3_inplace_fifo_base< T > &    q
 

Set the actual queue s3_inplace_fifo_base<T> queue that this mux multiplexes.

If this instance is in the started state, an s3_generic_exception is thrown.

Precondition:
is_started() == false
Parameters:
q  Reference to queue.

Definition at line 358 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, queue, started, state_lock, and s3_mutex::unlock.

template<typename T>
void s3_inplace_fifo_mux< T >::start  
 

Start the mux.

This indicates that everything has been setup and that the mux is ready for operation. The mux is in the started state when this call returns.

Precondition:
is_started() == false
Postcondition:
is_started() == true

Definition at line 219 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, started, state_lock, and s3_mutex::unlock.

template<typename T>
void s3_inplace_fifo_mux< T >::stop  
 

Stop the mux.

The mux is not in the started state when this call returns.

Precondition:
is_started() == true
Postcondition:
is_started() == false

Definition at line 235 of file s3_inplace_fifo_mux.tcc.

References s3_mutex::lock, started, state_lock, and s3_mutex::unlock.


Friends And Related Function Documentation

template<typename T>
friend class stub_queue [friend]
 

Definition at line 54 of file s3_inplace_fifo_mux.h.

Referenced by create_vqueue, and s3_inplace_fifo_mux::stub_queue::empty.


Member Data Documentation

template<typename T>
bool s3_inplace_fifo_mux::auto_select [private]
 

Definition at line 67 of file s3_inplace_fifo_mux.h.

Referenced by s3_inplace_fifo_mux.

template<typename T>
int s3_inplace_fifo_mux::current_idx [private]
 

Definition at line 63 of file s3_inplace_fifo_mux.h.

Referenced by s3_inplace_fifo_mux.

template<typename T>
s3_inplace_fifo_base<T>* s3_inplace_fifo_mux::queue [private]
 

Definition at line 59 of file s3_inplace_fifo_mux.h.

Referenced by s3_inplace_fifo_mux, and set_queue.

template<typename T>
bool s3_inplace_fifo_mux::started [private]
 

Definition at line 65 of file s3_inplace_fifo_mux.h.

Referenced by create_vqueue, destroy_vqueue, is_started, s3_inplace_fifo_mux, set_queue, start, and stop.

template<typename T>
s3_mutex s3_inplace_fifo_mux::state_lock [private]
 

Definition at line 57 of file s3_inplace_fifo_mux.h.

Referenced by create_vqueue, destroy_vqueue, is_started, set_queue, start, and stop.

template<typename T>
std::vector<s3_inplace_fifo_mux<T>::stub_queue*> s3_inplace_fifo_mux::vqueue_list [private]
 

Definition at line 61 of file s3_inplace_fifo_mux.h.

Referenced by create_vqueue, destroy_vqueue, s3_inplace_fifo_mux, and ~s3_inplace_fifo_mux.


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