OrderQueue Class Reference

A FIFO Data Structure (Queue) which we specialize to store Orders. More...

#include <orderqueue.h>

List of all members.

Public Member Functions

 OrderQueue (const OrderAllocator &order_alloc)
 Constructor.
 ~OrderQueue ()
 Destructor.
void PushBack (const Order &ord)
 Insert the provided order at the end of the queue. This operation is thread safe and will block until it can be completed.
Order PopFront ()
 Remove and return the front Order of the queue. This operation is thread safe and will block until it can be completed (if there are no orders in the queue, this operation will pend until one becomes available).
bool Empty ()
 Check if the queue is empty.

Private Attributes

OrderList order_list_
 Underlying non-thread-safe container used to store the Orders.
boost::interprocess::interprocess_mutex mutex_
 Mutex used to allow thread-safe access to the underlying order_list_.
boost::interprocess::interprocess_semaphore sem_fill_
 Semaphore used to track the size of the queue. The semaphore is incremented on calls to PushBack and decremented on calls to PopFront.

Detailed Description

A FIFO Data Structure (Queue) which we specialize to store Orders.

Definition at line 24 of file orderqueue.h.


Constructor & Destructor Documentation

OrderQueue::OrderQueue ( const OrderAllocator order_alloc  )  [explicit]

Constructor.

Parameters:
order_alloc Shared Memory Allocator from which Orders are allocated

Definition at line 16 of file orderqueue.cpp.

OrderQueue::~OrderQueue (  ) 

Destructor.

Definition at line 22 of file orderqueue.cpp.


Member Function Documentation

bool OrderQueue::Empty (  ) 

Check if the queue is empty.

Returns:
TRUE if the Queue is empty (size 0), FALSE otherwise.

Definition at line 57 of file orderqueue.cpp.

Here is the caller graph for this function:

Order OrderQueue::PopFront (  ) 

Remove and return the front Order of the queue. This operation is thread safe and will block until it can be completed (if there are no orders in the queue, this operation will pend until one becomes available).

Returns:
The front Order in the queue

Definition at line 40 of file orderqueue.cpp.

void OrderQueue::PushBack ( const Order ord  ) 

Insert the provided order at the end of the queue. This operation is thread safe and will block until it can be completed.

Parameters:
ord Order to insert

Definition at line 25 of file orderqueue.cpp.


Member Data Documentation

boost::interprocess::interprocess_mutex OrderQueue::mutex_ [private]

Mutex used to allow thread-safe access to the underlying order_list_.

Definition at line 74 of file orderqueue.h.

Underlying non-thread-safe container used to store the Orders.

Definition at line 68 of file orderqueue.h.

boost::interprocess::interprocess_semaphore OrderQueue::sem_fill_ [private]

Semaphore used to track the size of the queue. The semaphore is incremented on calls to PushBack and decremented on calls to PopFront.

Definition at line 81 of file orderqueue.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Generated on Mon May 31 15:35:43 2010 for Byzantine Generals Coding Sample by  doxygen 1.6.3