DataQueue Class Reference

#include <QueueManager.hpp>

Public Member Functions

 DataQueue (const char *ds, int di)
 
 DataQueue (SessionID s, const char *ds, int di)
 
 DataQueue (const char *name, const char *ds, int di)
 
 ~DataQueue ()
 
void setName (const char *name)
 
void add (ServiceMessage &message)
 
void addLifo (QueueItem *item)
 
void addFifo (QueueItem *item)
 
void clear ()
 
QueueItemgetFirst ()
 
void addWaiter ()
 
void removeWaiter ()
 
void checkWaiters ()
 
void waitForData ()
 
bool hasWaiters ()
 
void pull (ServerQueueManager *manager, ServiceMessage &message)
 
bool pullData (ServerQueueManager *manager, ServiceMessage &message)
 
void addReference ()
 
size_t removeReference ()
 
bool hasReferences ()
 
void init ()
 
size_t getItemCount ()
 

Protected Attributes

DataQueuenext
 
size_t itemCount
 
size_t waiters
 
size_t references
 
SysSemaphore waitSem
 
QueueItemfirstItem
 
QueueItemlastItem
 
const char * queueName
 
SessionID session
 
const char * dbgds
 
int dbgdi
 

Friends

class QueueTable
 

Detailed Description

Definition at line 90 of file QueueManager.hpp.

Constructor & Destructor Documentation

◆ DataQueue() [1/3]

DataQueue::DataQueue ( const char *  ds,
int  di 
)
inline

Definition at line 94 of file QueueManager.hpp.

References init().

◆ DataQueue() [2/3]

DataQueue::DataQueue ( SessionID  s,
const char *  ds,
int  di 
)
inline

Definition at line 99 of file QueueManager.hpp.

References init(), and session.

◆ DataQueue() [3/3]

DataQueue::DataQueue ( const char *  name,
const char *  ds,
int  di 
)
inline

Definition at line 105 of file QueueManager.hpp.

References init(), and setName().

◆ ~DataQueue()

DataQueue::~DataQueue ( )

Perform cleanup for a delete data queue.

Definition at line 69 of file QueueManager.cpp.

References clear(), SysSemaphore::close(), queueName, and waitSem.

Member Function Documentation

◆ add()

void DataQueue::add ( ServiceMessage message)

◆ addFifo()

void DataQueue::addFifo ( QueueItem item)

Add an item to the queue in FIFO order.

Parameters
itemThe item to add.

Definition at line 147 of file QueueManager.cpp.

References checkWaiters(), firstItem, itemCount, lastItem, and QueueItem::next.

Referenced by add().

◆ addLifo()

void DataQueue::addLifo ( QueueItem item)

Add an item to a queue in LIFO order.

Parameters
itemThe item to add.

Definition at line 129 of file QueueManager.cpp.

References checkWaiters(), firstItem, itemCount, lastItem, and QueueItem::next.

Referenced by add().

◆ addReference()

void DataQueue::addReference ( )
inline

Definition at line 157 of file QueueManager.hpp.

References references.

Referenced by ServerQueueManager::createSessionQueue().

◆ addWaiter()

void DataQueue::addWaiter ( )
inline

Definition at line 124 of file QueueManager.hpp.

References waiters.

Referenced by pull().

◆ checkWaiters()

void DataQueue::checkWaiters ( )
inline

Definition at line 136 of file QueueManager.hpp.

References SysSemaphore::post(), waiters, and waitSem.

Referenced by addFifo(), and addLifo().

◆ clear()

void DataQueue::clear ( )

Clear all entries from the data queue.

Definition at line 82 of file QueueManager.cpp.

References firstItem, itemCount, lastItem, and QueueItem::next.

Referenced by ServerQueueManager::clearNamedQueue(), ServerQueueManager::clearSessionQueue(), and ~DataQueue().

◆ getFirst()

QueueItem * DataQueue::getFirst ( )

Pull the first item off the queue.

Returns
The QueueItem at the head of the queue, or NULL if the queue is empty.

Definition at line 171 of file QueueManager.cpp.

References firstItem, itemCount, lastItem, and QueueItem::next.

Referenced by pullData().

◆ getItemCount()

size_t DataQueue::getItemCount ( )
inline

Definition at line 174 of file QueueManager.hpp.

References itemCount.

Referenced by ServerQueueManager::getNamedQueueCount().

◆ hasReferences()

bool DataQueue::hasReferences ( )
inline

Definition at line 159 of file QueueManager.hpp.

References references.

◆ hasWaiters()

bool DataQueue::hasWaiters ( )
inline

◆ init()

void DataQueue::init ( void  )
inline

Definition at line 161 of file QueueManager.hpp.

References SysSemaphore::create(), firstItem, itemCount, lastItem, next, queueName, references, session, waiters, and waitSem.

Referenced by DataQueue().

◆ pull()

void DataQueue::pull ( ServerQueueManager manager,
ServiceMessage message 
)

Pull an item from the front of the queue.

Parameters
messageThe message from the client.

Definition at line 236 of file QueueManager.cpp.

References addWaiter(), if(), ServerQueueManager::lock, ServiceMessage::parameter1, pullData(), QUEUE_EMPTY, QUEUE_WAIT_FOR_DATA, removeWaiter(), ServiceMessage::setResult(), and waitForData().

Referenced by ServerQueueManager::pullFromNamedQueue(), and ServerQueueManager::pullFromSessionQueue().

◆ pullData()

bool DataQueue::pullData ( ServerQueueManager manager,
ServiceMessage message 
)

Attempt to pull data from a data queue and attach it to a return message.

Parameters
messageThe message being processed.
Returns
true if the queue had a data item, false if it was currently empty.

Definition at line 196 of file QueueManager.cpp.

References QueueItem::addTime, QueueItem::clear(), QueueItem::elementData, getFirst(), ServerQueueManager::lock, ServiceMessage::nameArg, ServiceMessage::parameter1, QUEUE_ITEM_PULLED, SysSemaphore::reset(), ServiceMessage::retainMessageData, ServiceMessage::setMessageData(), ServiceMessage::setResult(), QueueItem::size, and waitSem.

Referenced by pull().

◆ removeReference()

size_t DataQueue::removeReference ( )
inline

Definition at line 158 of file QueueManager.hpp.

References references.

Referenced by ServerQueueManager::deleteSessionQueue().

◆ removeWaiter()

void DataQueue::removeWaiter ( )
inline

Definition at line 129 of file QueueManager.hpp.

References waiters.

Referenced by pull().

◆ setName()

void DataQueue::setName ( const char *  name)
inline

Definition at line 113 of file QueueManager.hpp.

References dupString(), and queueName.

Referenced by ServerQueueManager::createUniqueQueue(), and DataQueue().

◆ waitForData()

void DataQueue::waitForData ( )
inline

Definition at line 144 of file QueueManager.hpp.

References dbgdi, dbgds, SysSemaphore::wait(), and waitSem.

Referenced by pull().

Friends And Related Function Documentation

◆ QueueTable

friend class QueueTable
friend

Definition at line 92 of file QueueManager.hpp.

Member Data Documentation

◆ dbgdi

int DataQueue::dbgdi
protected

Definition at line 188 of file QueueManager.hpp.

Referenced by waitForData().

◆ dbgds

const char* DataQueue::dbgds
protected

Definition at line 187 of file QueueManager.hpp.

Referenced by waitForData().

◆ firstItem

QueueItem* DataQueue::firstItem
protected

Definition at line 183 of file QueueManager.hpp.

Referenced by addFifo(), addLifo(), clear(), getFirst(), and init().

◆ itemCount

size_t DataQueue::itemCount
protected

Definition at line 179 of file QueueManager.hpp.

Referenced by addFifo(), addLifo(), clear(), getFirst(), getItemCount(), and init().

◆ lastItem

QueueItem* DataQueue::lastItem
protected

Definition at line 184 of file QueueManager.hpp.

Referenced by addFifo(), addLifo(), clear(), getFirst(), and init().

◆ next

DataQueue* DataQueue::next
protected

◆ queueName

const char* DataQueue::queueName
protected

Definition at line 185 of file QueueManager.hpp.

Referenced by init(), QueueTable::locate(), QueueTable::remove(), setName(), and ~DataQueue().

◆ references

size_t DataQueue::references
protected

Definition at line 181 of file QueueManager.hpp.

Referenced by addReference(), hasReferences(), init(), and removeReference().

◆ session

SessionID DataQueue::session
protected

Definition at line 186 of file QueueManager.hpp.

Referenced by DataQueue(), init(), QueueTable::locate(), and QueueTable::remove().

◆ waiters

size_t DataQueue::waiters
protected

Definition at line 180 of file QueueManager.hpp.

Referenced by addWaiter(), checkWaiters(), hasWaiters(), init(), and removeWaiter().

◆ waitSem

SysSemaphore DataQueue::waitSem
protected

Definition at line 182 of file QueueManager.hpp.

Referenced by checkWaiters(), init(), pullData(), waitForData(), and ~DataQueue().


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