Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <SharedQueue.h>
Inheritance diagram for SharedQueue< maxsize, maxentries >:
This doesn't gain you much functionality over the Aperios messages - in fact, you lose some because you have to poll this for new data whereas Aperios will notify you.
However, the big advantage of this is that you don't have any lag time from the system in sending the message from one process to the other - it's instantly available. Also, you can poll for new data from within a loop, whereas you cannot check to see if you have any messages waiting from Aperios until you exit to the system.
This makes no assumptions about the data to be stored - it's all just an array of bytes
Assumptions are made about reception usage: all entries will be processed and then cleared so that the queue is emptied. You cannot pop the front, only clear the whole thing. This assumption allows much simpler/faster access. (Otherwise we need to implement a circular buffer and worry about wrap around. *shrug* Not too hard, but unnecessary complication for now.)
Definition at line 27 of file SharedQueue.h.
Public Member Functions | |
SharedQueue () | |
constructor | |
template<class T> bool | SharedQueue (const T &obj) |
inserts a class into the queue | |
void * | reserve (unsigned int size) |
reserves a number of bytes in the queue, LEAVES QUEUE LOCKED, call done when finished | |
void | done () |
call this when you're finished filling in a buffer you received from reserve | |
bool | clear (unsigned int taken) |
checks to see if the number taken by the reader is the number added, and then clears | |
unsigned int | size () const |
| |
unsigned int | size (unsigned int i) const |
| |
const void * | data (unsigned int i) const |
| |
Static Public Attributes | |
const unsigned int | MAX_SIZE = maxsize |
maximum capacity of data storage for the queue | |
const unsigned int | MAX_ENTRIES = maxentries |
maximum number of entries that can be queued | |
Protected Types | |
typedef LockScope< ProcessID::NumProcesses > | AutoLock |
for convenience in locking functions | |
Protected Member Functions | |
unsigned int | buf_end () |
| |
unsigned int | round_up (unsigned int sz) |
| |
Protected Attributes | |
MutexLock< ProcessID::NumProcesses > | lock |
provides mutual exclusion on non-const functions | |
char | buf [MAX_SIZE] |
data storage | |
unsigned int | len |
holds number of entries | |
entry_t | entries [MAX_ENTRIES] |
holds entry information |
|
for convenience in locking functions
Definition at line 71 of file SharedQueue.h. |
|
constructor
Definition at line 90 of file SharedQueue.h. |
|
inserts a class into the queue
|
|
Definition at line 63 of file SharedQueue.h. |
|
checks to see if the number taken by the reader is the number added, and then clears This will allow you to process entries without locking the entire queue, but still not worry about missing one (or more) if it was added while you were processing the last one. Definition at line 124 of file SharedQueue.h. References SharedQueue< maxsize, maxentries >::AutoLock, ProcessID::getID(), SharedQueue< maxsize, maxentries >::len, SharedQueue< maxsize, maxentries >::lock, and SharedQueue< maxsize, maxentries >::size(). |
|
Definition at line 59 of file SharedQueue.h. |
|
call this when you're finished filling in a buffer you received from reserve
Definition at line 44 of file SharedQueue.h. |
|
reserves a number of bytes in the queue, LEAVES QUEUE LOCKED, call done when finished
Definition at line 111 of file SharedQueue.h. References SharedQueue< maxsize, maxentries >::AutoLock, SharedQueue< maxsize, maxentries >::buf, SharedQueue< maxsize, maxentries >::buf_end(), SharedQueue< maxsize, maxentries >::entries, ProcessID::getID(), SharedQueue< maxsize, maxentries >::len, SharedQueue< maxsize, maxentries >::lock, SharedQueue< maxsize, maxentries >::MAX_ENTRIES, SharedQueue< maxsize, maxentries >::MAX_SIZE, and SharedQueue< maxsize, maxentries >::round_up(). |
|
Definition at line 66 of file SharedQueue.h. |
|
Definition at line 56 of file SharedQueue.h. |
|
Definition at line 53 of file SharedQueue.h. |
|
data storage
Definition at line 74 of file SharedQueue.h. |
|
holds entry information
Definition at line 86 of file SharedQueue.h. |
|
holds number of entries
Definition at line 83 of file SharedQueue.h. |
|
provides mutual exclusion on non-const functions
Definition at line 69 of file SharedQueue.h. |
|
maximum number of entries that can be queued
Definition at line 32 of file SharedQueue.h. |
|
maximum capacity of data storage for the queue
Definition at line 30 of file SharedQueue.h. |
Tekkotsu v1.4 |
Generated Sat Jul 19 00:09:10 2003 by Doxygen 1.3.2 |