Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
MessageQueueBase Class Reference#include <MessageQueue.h>
Inheritance diagram for MessageQueueBase:
![]() Detailed DescriptionDefines the interface for sending new shared memory regions between processes.This base class holds all of the template-independent code to allow general operations on MessageQueues. The templated version of MessageQueue provides concrete implementation, which is what you would instantiate. Each message entails its own shared memory region, as compared to SharedQueue, where a single large buffer is maintained, and all messages are copied into the common buffer. This class is better for large regions since it can avoid copying data around.
Definition at line 30 of file MessageQueue.h.
Member Typedef Documentation
The storage type for message entry indicies. This index is to be used with accessor functions, but may be recycled for a new message after all receivers have read the previous message. If you wish to have a unique message identifier, see getMessageSN() Definition at line 58 of file MessageQueue.h.
a typedef to make it easier to obtain a lock on the queue for the extent of a scope
Definition at line 126 of file MessageQueue.h.
Member Enumeration Documentationan enumerations of policies for dealing with overflow, pass to setOverflowPolicy()
Definition at line 138 of file MessageQueue.h.
Constructor & Destructor Documentation
this shouldn't be called...
Member Function Documentation
add one to the receiver reference count
Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MessageReceiver::launched(), and MessageReceiver::MessageReceiver().
remove one from the receiver reference count
Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MessageReceiver::finish(), and MessageReceiver::~MessageReceiver().
registers a semaphore which should be raised whenever a message is marked read The number of these are limited to the MAX_SENDERS template parameter of MessageQueue... returns false if too many are already registered You probably don't want to call this directly, use a MessageQueueStatusThread Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MessageQueueStatusThread::addStatusListener().
removes a semaphore from the status listener list
Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MessageQueueStatusThread::cancelled().
post a message into the queue -- a shared reference is added, the caller retains control current reference Thus, if you are sending a region and do not intend to use it again, either pass true for autoDereference or call RCRegion::RemoveReference() after sending to free the sender's memory. If no one dereferences the region, you can continue to access the region, even as the receiver accesses it as well. Thus if both sides retain references, you can use the region as a shared memory area for future communication. (beware of race conditions!) If rcr is NULL, an empty message will be sent (there's still some overhead to this -- may want to consider a semaphore instead of a MessageQueue if all you're going to do is 'ping' another process with empty messages) Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MotionManager::doAddMotion(), SoundManager::loadBuffer(), SoundManager::play(), IPCEventTranslator::post(), SoundManager::release(), and MotionManager::removeMotion().
request access to a particular message, increments read counter -- do not call more than once per receiver! The message is marked read and will be popped from the queue if all receivers have read the message as well. The caller inherits a reference to the returned region -- call RemoveReference when you are done with it Referenced by MessageReceiver::getNextMessage(). request access to a particular message, does not mark message -- call as often as you like The caller inherits a reference to the returned region -- call RemoveReference when you are done with it Referenced by MessageReceiver::peekNextMessage().
increments read counter -- do not call more than once per receiver per message!
Referenced by MessageReceiver::markRead().
Each message gets a unique, monotonically increasing serial number; this function returns that number (MessageQueue::serialNumber).
Referenced by MessageReceiver::findCurrentMessage(), MessageReceiver::getNextMessage(), MessageReceiver::markRead(), IPCEventTranslator::post(), and MessageReceiver::processNextMessage().
Checks to see how many messages have been processed (read by all receivers and removed from queue).
Definition at line 117 of file MessageQueue.h. Referenced by MessageQueueStatusThread::addStatusListener(), getMessagesUnread(), IPCEventTranslator::post(), and MessageQueueStatusThread::run().
Returns the number of messages which have been sent.
Definition at line 120 of file MessageQueue.h. Referenced by getMessagesUnread().
returns a reference to the queue's inter-process lock
Definition at line 128 of file MessageQueue.h. Referenced by MessageReceiver::getNextMessage(), and MessageReceiver::peekNextMessage().
return oldest message still in the queue (may or may not have been read by this process)
Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. return the next message in the queue (may or may not have been read by this process)
Referenced by MessageReceiver::findCurrentMessage(), MessageReceiver::getNextMessage(), and MessageReceiver::markRead(). return the previous message in the queue (may or may not have been read by this process)
Referenced by MessageReceiver::findCurrentMessage().
return most recent message added to the queue (may or may not have been read by this process)
Implemented in MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >. Referenced by MessageReceiver::findCurrentMessage(), and IPCEventTranslator::post().
returns true if it is the one-past-the-end of the queue
Referenced by MessageReceiver::findCurrentMessage(), MessageReceiver::getNextMessage(), MessageReceiver::markRead(), and MessageReceiver::peekNextMessage().
allows you to pick how to handle running out of space in the queue, see OverflowPolicy_t
Definition at line 145 of file MessageQueue.h.
returns the current overflow policy, see OverflowPolicy_t
Definition at line 147 of file MessageQueue.h.
gets semgr
Definition at line 152 of file MessageQueue.h. Referenced by MessageQueueStatusThread::addStatusListener(), MessageQueueStatusThread::cancelled(), WorldStatePool::doneWritingState(), MessageReceiver::finish(), WorldStatePool::getCurrentReadState(), WorldStatePool::getCurrentWriteState(), WorldStatePool::isComplete(), MessageReceiver::launched(), MessageReceiver::markRead(), MessageReceiver::MessageReceiver(), MessageQueueStatusThread::run(), MessageReceiver::runloop(), MessageReceiver::stop(), MessageQueueStatusThread::stop(), MessageReceiver::waitNextMessage(), WorldStatePool::WorldStatePool(), and MessageReceiver::~MessageReceiver().
once called, any messages put into the queue must pass through filter first (note: there can only be one filter per process!) if a filter was previously registered, it is replaced with the new filter Definition at line 156 of file MessageQueue.h.
this shouldn't be called...
Member Data Documentation
the global semaphore manager, needs to be set (once, globally) via setSemaphoreManager() before any receivers are added
Definition at line 165 of file MessageQueue.h. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::addReadStatusListener(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::addReceiver(), getSemaphoreManager(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReadStatusListener(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and setSemaphoreManager().
a lock to grant serial access to the queue
Definition at line 167 of file MessageQueue.h. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::addReadStatusListener(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::addReceiver(), close(), getLock(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::isEnd(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::newer(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::newest(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::older(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::oldest(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReadStatusListener(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
the choice of how to handle message overflow -- see OverflowPolicy_t
Definition at line 168 of file MessageQueue.h. Referenced by getOverflowPolicy(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and setOverflowPolicy().
if true, new messages will be rejected
Definition at line 169 of file MessageQueue.h. Referenced by close(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
if true, output will be sent on cerr when overflow occurs
Definition at line 170 of file MessageQueue.h. Referenced by getReportDroppings(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage(), and setReportDroppings().
number of messages which have been sent (serial number of next message)
Definition at line 171 of file MessageQueue.h. Referenced by getMessagesSent(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
how many receivers to expect
Definition at line 172 of file MessageQueue.h. Referenced by MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::addReceiver(), getNumReceivers(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
number of messages which have been read and removed from queue
Definition at line 173 of file MessageQueue.h. Referenced by getMessagesRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::markRead(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::readMessage(), MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::removeReceiver(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
provides storage of one message filter per process
Definition at line 174 of file MessageQueue.h. Referenced by addMessageFilter(), MessageQueueBase(), removeMessageFilter(), and MessageQueue< MAX_UNREAD, MAX_RECEIVERS, MAX_SENDERS >::sendMessage().
The documentation for this class was generated from the following files: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:32 2007 by Doxygen 1.5.4 |