![]() |
MAK RTIspy API Documentation for HLA Evolved
|
Implements a generic shared memory message queue for multiple subscribers. More...
Inheritance diagram for DtSmSubscribableMessageQueue__rti__:
Collaboration diagram for DtSmSubscribableMessageQueue__rti__:Classes | |
| struct | DtBucketHeader |
| DtBucketHeader is a structure found at the front of each message to keep track of the number of bytes used, fragmented message indications, the subscriber that enqueued the message, and the sender's sequence number. More... | |
| struct | DtQueueHeader |
| DtQueueHeader exists at the front of the message queue and contains useful information about the state of the queue. More... | |
Public Member Functions | |
| DtSmSubscribableMessageQueue__rti__ (const MAKRti::DtString &name) | |
| Creates an instance of a Shared Memory Queue with the given name IMPORTANT: memory with the given name must have already been alocated somewhere, This class will only attach to it. More... | |
| virtual | ~DtSmSubscribableMessageQueue__rti__ () |
| virtual int | subscribe (MAKRti::DtU32 subscriberId=DtSM_INVALID_SUBSCRIBER_ID) |
| Subscribe to the queue and set up subscriber-specific fields in the queue header. More... | |
| virtual void | unsubscribe (MAKRti::DtU32 id) |
| Unsubscribes subscriber id from the queue. More... | |
| virtual bool | isSubscribed (MAKRti::DtU32 subscriberId) const |
| Test if subscriberId is subscribed. More... | |
| virtual MAKRti::DtU32 | subscriberId () const |
| Return the assigned subscriber ID. More... | |
| virtual int | subscriberCount () const |
| Return the count of subscribers to the queue. More... | |
| virtual bool | isEmpty () |
| Returns true if the subscriber's queue has no unread messages. More... | |
| virtual bool | isEmpty (int *nextSize, MAKRti::DtU32 flagsMask=DtSMQ_FETCH_DEFAULT) |
| virtual void | setDefaultReadBehavior (MAKRti::DtU32 flagsMask) |
| Set the default behavior for detecting messages in the queue to skip or return messages with certain characteristics. More... | |
| virtual bool | sendMessage (const void *message, unsigned int size) |
| Sends a packet at address message of size bytes to the queue. More... | |
| virtual void * | message (unsigned int *outSize=0) |
| Returns a pointer to the message copied from shared memory or null if there are no messages to read. More... | |
| virtual void * | message (void *recvBuffer, unsigned int *outSize) |
| virtual void | resetQueue (MAKRti::DtU32 numberOfBuckets, MAKRti::DtU32 payloadSize) |
| Emptys the queue. More... | |
| virtual bool | sm_shutdown (bool ruthless=false) |
| Shutdown the queue. Does not free shared memory or other resources. More... | |
| virtual volatile MAKRti::DtU32 | queueState () const |
| returns current state indicating whether shutdown in progress More... | |
| virtual void | initSyncVars () |
| Initializes Shared Memory locks. More... | |
| virtual void | clearSyncVars () |
| This clears all synchronization variables and should only be called by the queue manager. More... | |
| virtual std::ostream & | printDataToStream (std::ostream &str) const |
| prints the state of the queue to the given stream More... | |
Static Public Member Functions | |
| static unsigned int | poolSize (MAKRti::DtU32 numberOfBuckets, MAKRti::DtU32 payloadSize) |
| Used to compute the size in bytes, required for a DtSmSubscribableMessageQueue instance using numberOfBuckets with a payload size of payloadSize. More... | |
Protected Member Functions | |
| virtual int | assignSubscriberId () |
| Requests next available subscriber ID. More... | |
| virtual unsigned int | maxSubscribers () const |
| Report configured maximum subscriber count. More... | |
| volatile DtQueueHeader * | queueHeader () const |
| returns a pointer to the queue header. More... | |
| virtual MAKRti::DtU32 | queueHeaderSize () const |
| report the size, in bytes, of the queue header More... | |
| virtual MAKRti::DtU32 | numberOfBuckets () const |
| Returns the number of buckets in this queue. More... | |
| virtual MAKRti::DtU32 | payloadSize () const |
| Returns the number of bytes available in an empty bucket payload. More... | |
| virtual volatile MAKRti::DtU32 | queueFront (unsigned int sub) const |
| Returns the index of the specified subscribers queue front, which. More... | |
| virtual volatile MAKRti::DtU32 | queueBack () const |
| Returns the back of this queue, which is the last bucket written to. More... | |
| virtual volatile MAKRti::DtU32 | queueBackstop () const |
| Returns the backstop of this queue, which is the last bucket all subscribers have read. More... | |
| virtual MAKRti::DtU32 | updateFront (unsigned int sub, unsigned int val) |
| Sets a new value for the specified subscriber's queue front. More... | |
| virtual MAKRti::DtU32 | updateBack (unsigned int val) |
| Sets a new value for the queue's back. More... | |
| virtual MAKRti::DtU32 | updateBackstop (unsigned int val) |
| Sets a new value for the queue's backstop. More... | |
| virtual void | setSubscribed (unsigned int sub, unsigned int val) |
| Set or clear the subscriber's subscribed bit in the queue header. More... | |
| virtual int | setSubscriberCount (MAKRti::DtU32 val) |
| Set the number of current subscribers. More... | |
| virtual int | incrementSubscriberCount () |
| Increment the number of subscribers by one. More... | |
| virtual int | decrementSubscriberCount () |
| Decrement the number of subscribers by one. More... | |
| virtual void | setState (MAKRti::DtU32 val) |
| Set the queue state. More... | |
| virtual volatile char * | payloadInBucket (unsigned int bucketNum) const |
| returns a pointer to the payload in the bucket. More... | |
| virtual volatile void * | bucketHeader (unsigned int bucketNum) const |
| returns a pointer to the message header at index More... | |
| virtual MAKRti::DtU32 | bucketHeaderSize () const |
| report the size, in bytes, of the bucket header More... | |
| virtual MAKRti::DtU32 | bucketSenderId (unsigned int bucketNum) const |
| return the bucket header field values More... | |
| virtual MAKRti::DtU32 | bucketMsgSn (unsigned int bucketNum) const |
| virtual MAKRti::DtU32 | bucketOutstandingReadCount (unsigned int bucketNum) const |
| virtual MAKRti::DtU32 | bucketPayloadLen (unsigned int bucketNum) const |
| virtual bool | bucketIsFirst (unsigned int bucketNum) const |
| virtual bool | bucketIsLast (unsigned int bucketNum) const |
| virtual void | setSenderId (unsigned int bucketNum, MAKRti::DtU32 sid) |
| change the value of bucket header fields More... | |
| virtual void | setMsgSn (unsigned int bucketNum, MAKRti::DtU32 seqnum) |
| virtual void | setOutstandingReadCount (unsigned int bucketNum, MAKRti::DtU32 val) |
| virtual void | decrementOutstandingReadCount (unsigned int bucketNum) |
| virtual void | setPayloadLen (unsigned int bucketNum, MAKRti::DtU32 len) |
| virtual void | setFirst (unsigned int bucketNum, MAKRti::DtU32 val) |
| virtual void | setLast (unsigned int bucketNum, MAKRti::DtU32 val) |
| virtual void | lockForRead () |
| Locks the queue for a read. More... | |
| virtual void | unlockForRead () |
| Unlocks the queue for a read. More... | |
| virtual void | lockForWrite () |
| Locks the queue for a write. More... | |
| virtual void | unlockForWrite () |
| Unlocks the queue for writes. More... | |
| virtual bool | stalledSubscribers (unsigned int bucketNum, unsigned int numStalled) |
| Record information about stalled subscriber. More... | |
| virtual bool | checkForStalls () |
| Determine if there are any subscribers stalled on the bucket immediately following the 'backstop' bucket. More... | |
| virtual pthread_rwlock_t * | rdWrLock () |
| For non-Win32 implementations the rwlock structure in the queue header must be accessed via inheritable methods in order for derived classes to be able to define a different queue header structure. More... | |
| virtual pthread_mutex_t * | orcMutex () |
Protected Attributes | |
| DtSharedMemoryPoolClient__rti__ * | myShmPool |
| !WIN32 More... | |
| MAKRti::DtString | myShmName |
| MAKRti::DtU32 | mySubscriberId |
| MAKRti::DtU32 | myMessagesSentCnt |
| DtIpcRdWrLock__rti__ * | myRdWrLock |
| DtIpcMutex__rti__ * | myOrcMutex |
| std::vector< char > | myReadBuffer |
| MAKRti::DtU32 | myDefaultReadMask |
| unsigned int | theMaxSubscribers |
| The maximum number of subscribers allowed in this queue. More... | |
Private Member Functions | |
| DtSmSubscribableMessageQueue__rti__ (const DtSmSubscribableMessageQueue__rti__ &other) | |
| Copy Ctor Not Implemented – Class Not Duplicable. More... | |
| DtSmSubscribableMessageQueue__rti__ & | operator= (const DtSmSubscribableMessageQueue__rti__ &other) |
| Assignment Operator Not Implimented – Class Not Duplicable. More... | |
Implements a generic shared memory message queue for multiple subscribers.
This is a fixed length queue comprised of fixed length message containers. It is implemented as a circular list that will not fill up. Any subscriber which has a queue full of unread messages will be unsubscribed. Subscribers are given a 32 bit ID and register their interest in messages merely by creating an instance of this class. A subscriber can unsubscribe themselves at any time. Before an instance of this class can be created there must already be a shared memory pool of the correct size open. The correct size is computed using DtSubscribableMessageQueue::poolSize(). Before a queue can be used one subscriber (and only one subscriber) must call queue->reset(...); queue->initSyncVars();
| DtSmSubscribableMessageQueue__rti__::DtSmSubscribableMessageQueue__rti__ | ( | const MAKRti::DtString & | name | ) |
Creates an instance of a Shared Memory Queue with the given name IMPORTANT: memory with the given name must have already been alocated somewhere, This class will only attach to it.
The memory must be at least as big as ::poolSize(), this queue can't check.
|
virtual |
|
private |
Copy Ctor Not Implemented – Class Not Duplicable.
|
protectedvirtual |
Requests next available subscriber ID.
|
protectedvirtual |
returns a pointer to the message header at index
|
protectedvirtual |
report the size, in bytes, of the bucket header
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
return the bucket header field values
|
protectedvirtual |
Determine if there are any subscribers stalled on the bucket immediately following the 'backstop' bucket.
|
virtual |
This clears all synchronization variables and should only be called by the queue manager.
|
protectedvirtual |
|
protectedvirtual |
Decrement the number of subscribers by one.
|
protectedvirtual |
Increment the number of subscribers by one.
|
virtual |
Initializes Shared Memory locks.
This should only be called after the queue is created, and only by one party, the queue manager.
|
virtual |
Returns true if the subscriber's queue has no unread messages.
Returns true if the queue has messages no messages in it, false if there is a message in the queue. If nextSize is not NULL the size of the next message is stored in that location. The flagsMask argument can control which messages the subscriber will detect in the queue (overrides default read behavior)
Implements DtMessageQueue__rti__.
|
virtual |
|
virtual |
Test if subscriberId is subscribed.
|
protectedvirtual |
Locks the queue for a read.
|
protectedvirtual |
Locks the queue for a write.
|
protectedvirtual |
Report configured maximum subscriber count.
|
virtual |
Returns a pointer to the message copied from shared memory or null if there are no messages to read.
If recvBuffer pointer is supplied the message will be copied to that location, rather than the intermediate local buffer. If outsize is passed then the size of the message is returned.
Implements DtMessageQueue__rti__.
|
virtual |
|
protectedvirtual |
Returns the number of buckets in this queue.
|
private |
Assignment Operator Not Implimented – Class Not Duplicable.
|
protectedvirtual |
|
protectedvirtual |
returns a pointer to the payload in the bucket.
Where a bucket is composed of the bucketHeader and the bucketPayload.
|
protectedvirtual |
Returns the number of bytes available in an empty bucket payload.
|
static |
Used to compute the size in bytes, required for a DtSmSubscribableMessageQueue instance using numberOfBuckets with a payload size of payloadSize.
Each bucket is the size of the payload + the size of a bucketHeader
|
virtual |
prints the state of the queue to the given stream
Implements DtMessageQueue__rti__.
|
protectedvirtual |
Returns the back of this queue, which is the last bucket written to.
|
protectedvirtual |
Returns the backstop of this queue, which is the last bucket all subscribers have read.
|
protectedvirtual |
Returns the index of the specified subscribers queue front, which.
is the last bucket the subscriber read from.
|
protected |
returns a pointer to the queue header.
|
protectedvirtual |
report the size, in bytes, of the queue header
|
virtual |
returns current state indicating whether shutdown in progress
|
protectedvirtual |
For non-Win32 implementations the rwlock structure in the queue header must be accessed via inheritable methods in order for derived classes to be able to define a different queue header structure.
|
virtual |
Emptys the queue.
This should only be called by the queue manager, as all unread messages are lost and all subscribers are unsubscribed.
|
virtual |
Sends a packet at address message of size bytes to the queue.
If the queue is full this message will knock the oldest message off the queue.
Implements DtMessageQueue__rti__.
|
virtual |
Set the default behavior for detecting messages in the queue to skip or return messages with certain characteristics.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
change the value of bucket header fields
|
protectedvirtual |
Set the queue state.
|
protectedvirtual |
Set or clear the subscriber's subscribed bit in the queue header.
|
protectedvirtual |
Set the number of current subscribers.
|
virtual |
Shutdown the queue. Does not free shared memory or other resources.
|
protectedvirtual |
Record information about stalled subscriber.
Unsubscribe stalled subscribers if necessary
|
virtual |
Subscribe to the queue and set up subscriber-specific fields in the queue header.
Return 0 on failure, 1 on success
|
virtual |
Return the count of subscribers to the queue.
|
virtual |
Return the assigned subscriber ID.
|
protectedvirtual |
Unlocks the queue for a read.
|
protectedvirtual |
Unlocks the queue for writes.
|
virtual |
Unsubscribes subscriber id from the queue.
This is called by the DTOR and should only be called by users of this class with caution. Unsubscribing will clear subscriber ID. (except the queue manager's ID, which is always reserved as 0) The queue manager may unsubscribe other subscribers without clearing that subscriber objects subscriber ID, so should be done only in extreme cases. Once unsubscribed, use subscribe() to get a new subscriber ID.
|
protectedvirtual |
Sets a new value for the queue's back.
Returns the next index, wrapping if necessary.
|
protectedvirtual |
Sets a new value for the queue's backstop.
Returns the next index, wrapping if necessary.
|
protectedvirtual |
Sets a new value for the specified subscriber's queue front.
Returns the next index, wrapping if necessary.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
!WIN32
|
protected |
|
protected |
The maximum number of subscribers allowed in this queue.