VR-Exchange 2.4 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
smSubscribableMessageQueue.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2015 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 = 255;
40 
41  public:
42 
47  DtSubscribableMessageQueue( const DtString& name, DtU8 subscriberId );
48 
50  virtual ~DtSubscribableMessageQueue();
51 
53  virtual bool isEmpty();
54 
56  virtual bool isSubscribed( DtU8 subscriberId ) const;
57 
60  virtual DtU32 subscriberDrops( DtU8 subscriberId ) const;
61 
67  virtual void sendMessage( const void* message, unsigned int size,
68  bool global = false );
69 
73  virtual void* message( unsigned int* outSize = 0 );
74 
80  virtual void unsubscribe( DtU8 id );
81 
87  void subscribe( DtU8 id );
88 
92  virtual void resetQueue( DtU32 numberOfBuckets, DtU32 payloadSize );
93 
95  virtual std::ostream& printDataToStream( std::ostream& str ) const;
96 
100  static unsigned int poolSize( DtU32 numberOfBuckets, DtU32 payloadSize );
101 
103  virtual DtString name() const;
104 
106  DtQueueHeader* queueHeader() const;
107 
109  DtU32 numberOfBuckets() const;
110 
112  DtU32 payloadSize() const;
113 
116  virtual char* payloadInBucket( unsigned int bucketNum ) const;
117 
119  virtual DtBucketHeader* bucketHeader( unsigned int bucketNum ) const;
120 
121  protected:
122 
124  virtual void lockForWrite();
125 
127  virtual void unlockForWrite();
128 
129  private:
130 
133 
135  DtSubscribableMessageQueue& operator = (const DtSubscribableMessageQueue& other );
136 
137  protected:
138 
139  DtSharedMemoryPoolClient* myShmPool;
142  std::vector<char> myReadBuffer;
143 
144  };
145 
146 }

Document ID: Generated on Thu Jul 23 10:25:22 EDT 2015 from SVN revision 155065
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)