VR-Exchange 2.7 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
smSubscribableMessageQueue.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2016 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <portal/messageQueue.h>
13 #include <vlutil/vlShmPool.h>
14 
15 namespace MAKVrExchange
16 {
17 
18  struct DtQueueHeader;
19  struct DtBucketHeader;
20 
35  {
36  public:
37 
39  static const unsigned int theMaxSubscribers = 256;
40 
43  static unsigned long theLockFailureTimeoutMs;
44 
45  public:
46 
56  DtSubscribableMessageQueue( const DtString& name, DtU8 subscriberId );
57 
59  virtual ~DtSubscribableMessageQueue();
60 
62  virtual bool isEmpty();
63 
65  virtual bool isSubscribed( DtU8 subscriberId ) const;
66 
69  virtual DtU32 subscriberDrops( DtU8 subscriberId ) const;
70 
76  virtual void sendMessage( const void* message, unsigned int size,
77  bool global = false );
78 
82  virtual void* message( unsigned int* outSize = 0 );
83 
89  virtual void unsubscribe( DtU8 id );
90 
96  void subscribe( DtU8 id );
97 
101  virtual void resetQueue( DtU32 numberOfBuckets, DtU32 payloadSize );
102 
104  virtual std::ostream& printDataToStream( std::ostream& str ) const;
105 
109  static unsigned int poolSize( DtU32 numberOfBuckets, DtU32 payloadSize );
110 
112  virtual DtString name() const;
113 
115  DtQueueHeader* queueHeader() const;
116 
118  DtU32 numberOfBuckets() const;
119 
121  DtU32 payloadSize() const;
122 
125  virtual char* payloadInBucket( unsigned int bucketNum ) const;
126 
128  virtual DtBucketHeader* bucketHeader( unsigned int bucketNum ) const;
129 
131  virtual int usedBucketCount() const;
132 
133  private:
134 
137 
139  DtSubscribableMessageQueue& operator = (const DtSubscribableMessageQueue& other );
140 
141  protected:
142 
143  std::vector<char> myReadBuffer;
146 
147  DtSharedMemoryPoolClient* myShmPool;
148 
149  };
150 
151 }
DtString myShmName
Definition: smSubscribableMessageQueue.h:145
This is an abstract base class presenting an interface for a simple message queue.
Definition: messageQueue.h:22
#define DT_DLL_LIBPORTAL
Definition: include/portal/dllExport.h:20
Implements a message queue for multiple subscribers.
Definition: smSubscribableMessageQueue.h:34
std::vector< char > myReadBuffer
Definition: smSubscribableMessageQueue.h:143
static unsigned long theLockFailureTimeoutMs
The timeout for lock attempts (in seconds).
Definition: smSubscribableMessageQueue.h:43
DtSharedMemoryPoolClient * myShmPool
Definition: smSubscribableMessageQueue.h:147
DtU8 mySubscriberId
Definition: smSubscribableMessageQueue.h:144
DtQueueHeader exists at the front of the message queue and contains useful information about the stat...
Definition: queueHeader.h:22
DtBucketHeader is a structure found at the front of each message to keep track of the number of bytes...
Definition: queueHeader.h:74
Contains the DtMessageQueue class declaration.

Document ID: Generated on Mon Apr 19 15:55:22 EDT 2021 from SVN revision 227909
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)