VR-Exchange 2.2 API Documentation
queueManager.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2012 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <portal/pMessageFactory.h>
13 #include <portal/pControlMessage.h>
14 #include <portal/memoryManager.h>
15 
16 #include <vlutil/vlInetSocketMgr.h>
17 #include <vlutil/vlTime.h>
18 
19 #include <list>
20 #include <map>
21 
22 
23 namespace MAKVrExchange
24 {
25 
26  class DtPortalMessage;
27  class DtPortalObject;
28  class DtSubscribableMessageQueue;
29 
33  //
38  //
41  class DT_DLL_LIBPORTAL DtQueueManager
42  {
43  public:
44 
45  typedef void (*MessageCbFcn)( const DtPortalMessage& message, void* usr );
46 
47  public:
48 
54  DtQueueManager( DtU32 numberOfBucketsInQueue, DtU32 payloadSizePerBucket,
55  int port, DtU16 brokerId, const DtString& objectQueueName,
56  const DtString& interactionQueueName,
57  const DtString& controlQueueName );
58 
64  virtual ~DtQueueManager();
65 
66  public:
67 
68  virtual void send( DtPortalControlMessage& message );
69 
72  virtual void tick();
73 
77  virtual void requestBrokerShutdown();
78 
83  virtual void requestBrokerRestart( bool shouldMapMessagesOneToOne );
84 
91  virtual int connectedBrokerCount();
92 
96  virtual void pruneBrokerSocketMap();
97 
101 
102  virtual DtSubscribableMessageQueue* getControlMessageQueue() { return myControlMessageQueue;}
103  virtual DtSubscribableMessageQueue* getInteractionMessageQueue() { return myInteractionMessageQueue;}
104  virtual DtSubscribableMessageQueue* getObjectMessageQueue() { return myObjectMessageQueue;}
105 
107 
108  public:
109 
111  static DtQueueManager* create( DtU32 numberOfBucketsInQueue,
112  DtU32 payloadSizePerBucket, int port, DtU16 theBrokerId,
113  const DtString& objectQueueName, const DtString& interactionQueueName,
114  const DtString& controlQueueName );
115 
116  protected:
117 
119  virtual void addSocket( DtInetTcpSocket* sock );
120 
122  virtual void removeSocket( DtInetTcpSocket* sock );
123 
125  virtual void removeUnknownSocket( DtInetTcpSocket* sock );
126 
129  virtual void processUnknownSockets();
130 
133  virtual void testKnownSockets();
134 
137  void drainSockets();
138 
139  protected:
140 
141  static bool addSocketCb( DtInetSocket* sock, void* usr );
142  static bool removeSocketCb( DtInetSocket* sock, void* usr );
143  const DtU16 theBrokerId;
144 
145  virtual DtU8 getUnusedBrokerID();
146 
147  private:
148 
150  DtQueueManager( const DtQueueManager& other );
151 
153  DtQueueManager& operator = ( const DtQueueManager& other );
154 
155  protected:
156 
165  DtInetSocketMgr *myTcpSocketManager;
166  DtClock myClock;
168 
169  typedef std::map<int,DtInetTcpSocket*> BrokerSocketMap;
171 
172  typedef std::map<DtInetTcpSocket*,int> UnknownSocketMap;
174 
175  };
176 
177 }

Document ID: Generated on Mon Apr 15 17:15:50 EDT 2013 from SVN revision 126154
Copyright © 2005-2012 VT MÄK. All Rights Reserved (www.mak.com)