#include <Queue.h>

Collaboration diagram for Ipc::OneToOneUniQueue:

Classes

class  Full
 
class  ItemTooLarge
 

Public Member Functions

 OneToOneUniQueue (const unsigned int aMaxItemSize, const int aCapacity)
 
unsigned int maxItemSize () const
 
int size () const
 
int capacity () const
 
int sharedMemorySize () const
 
bool empty () const
 
bool full () const
 
template<class Value >
bool pop (Value &value, QueueReader *const reader=NULL)
 returns true iff the value was set; [un]blocks the reader as needed More...
 
template<class Value >
bool push (const Value &value, QueueReader *const reader=NULL)
 returns true iff the caller must notify the reader of the pushed item More...
 
template<class Value >
bool peek (Value &value) const
 returns true iff the value was set; the value may be stale! More...
 

Static Public Member Functions

static int Bytes2Items (const unsigned int maxItemSize, int size)
 
static int Items2Bytes (const unsigned int maxItemSize, const int size)
 

Private Attributes

unsigned int theIn
 input index, used only in push() More...
 
unsigned int theOut
 output index, used only in pop() More...
 
std::atomic< uint32_t > theSize
 number of items in the queue More...
 
const unsigned int theMaxItemSize
 maximum item size More...
 
const uint32_t theCapacity
 maximum number of items, i.e. theBuffer size More...
 
char theBuffer []
 

Detailed Description

Lockless fixed-capacity queue for a single writer and a single reader.

If the queue is empty, the reader is considered "blocked" and needs an out-of-band notification message to notice the next pushed item.

Current implementation assumes that the writer cannot get blocked: if the queue is full, the writer will just not push and come back later (with a different value). We can add support for blocked writers if needed.

Definition at line 88 of file Queue.h.

Constructor & Destructor Documentation

Ipc::OneToOneUniQueue::OneToOneUniQueue ( const unsigned int  aMaxItemSize,
const int  aCapacity 
)

Definition at line 75 of file Queue.cc.

References Must, theCapacity, and theMaxItemSize.

Member Function Documentation

int Ipc::OneToOneUniQueue::Bytes2Items ( const unsigned int  maxItemSize,
int  size 
)
static

Definition at line 84 of file Queue.cc.

References assert.

int Ipc::OneToOneUniQueue::capacity ( ) const
inline

Definition at line 99 of file Queue.h.

References theCapacity.

bool Ipc::OneToOneUniQueue::empty ( ) const
inline

Definition at line 102 of file Queue.h.

References theSize.

Referenced by peek(), and pop().

bool Ipc::OneToOneUniQueue::full ( ) const
inline

Definition at line 103 of file Queue.h.

References theCapacity, and theSize.

Referenced by push().

int Ipc::OneToOneUniQueue::Items2Bytes ( const unsigned int  maxItemSize,
const int  size 
)
static

Definition at line 92 of file Queue.cc.

References assert.

Referenced by sharedMemorySize(), and Ipc::OneToOneUniQueues::SharedMemorySize().

unsigned int Ipc::OneToOneUniQueue::maxItemSize ( ) const
inline

Definition at line 97 of file Queue.h.

References theMaxItemSize.

template<class Value >
bool Ipc::OneToOneUniQueue::peek ( Value &  value) const
template<class Value >
bool Ipc::OneToOneUniQueue::pop ( Value &  value,
QueueReader *const  reader = NULL 
)
template<class Value >
bool Ipc::OneToOneUniQueue::push ( const Value &  value,
QueueReader *const  reader = NULL 
)
int Ipc::OneToOneUniQueue::sharedMemorySize ( ) const
inline

Definition at line 100 of file Queue.h.

References Items2Bytes(), theCapacity, and theMaxItemSize.

int Ipc::OneToOneUniQueue::size ( ) const
inline

Member Data Documentation

char Ipc::OneToOneUniQueue::theBuffer[]
private

Definition at line 126 of file Queue.h.

Referenced by peek(), pop(), and push().

const uint32_t Ipc::OneToOneUniQueue::theCapacity
private

Definition at line 124 of file Queue.h.

Referenced by capacity(), full(), OneToOneUniQueue(), peek(), pop(), push(), and sharedMemorySize().

unsigned int Ipc::OneToOneUniQueue::theIn
private

Definition at line 119 of file Queue.h.

Referenced by push().

const unsigned int Ipc::OneToOneUniQueue::theMaxItemSize
private

Definition at line 123 of file Queue.h.

Referenced by maxItemSize(), OneToOneUniQueue(), peek(), pop(), push(), and sharedMemorySize().

unsigned int Ipc::OneToOneUniQueue::theOut
private

Definition at line 120 of file Queue.h.

Referenced by peek(), and pop().

std::atomic<uint32_t> Ipc::OneToOneUniQueue::theSize
private

Definition at line 122 of file Queue.h.

Referenced by empty(), full(), pop(), push(), and size().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors