VR-Exchange 2.4 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
queueManager.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2014 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 namespace MAKVrExchange
23 {
24 
25  class DtPortalObject;
26  class DtPortalMessage;
27  class DtSubscribableMessageQueue;
28 
31  //
36  //
41  {
42  public:
43 
44  typedef void (*MessageCbFcn)( const DtPortalMessage& message, void* usr );
45 
46  public:
47 
53  DtQueueManager( DtU32 numberOfBucketsInQueue, DtU32 payloadSizePerBucket,
54  int port, DtU16 brokerId, const DtString& objectQueueName,
55  const DtString& interactionQueueName,
56  const DtString& controlQueueName );
57 
63  virtual ~DtQueueManager();
64 
65  public:
66 
67  virtual void send( DtPortalControlMessage& message, bool global = false );
68 
71  virtual void tick();
72 
76  virtual void requestBrokerShutdown();
77 
82  virtual void requestBrokerRestart( bool shouldMapMessagesOneToOne );
83 
90  virtual int connectedBrokerCount();
91 
95  virtual void pruneBrokerSocketMap();
96 
100 
101  virtual DtSubscribableMessageQueue* getControlMessageQueue() { return myControlMessageQueue;}
102  virtual DtSubscribableMessageQueue* getInteractionMessageQueue() { return myInteractionMessageQueue;}
103  virtual DtSubscribableMessageQueue* getObjectMessageQueue() { return myObjectMessageQueue;}
104 
106 
107  public:
108 
110  static DtQueueManager* create( DtU32 numberOfBucketsInQueue,
111  DtU32 payloadSizePerBucket, int port, DtU16 theBrokerId,
112  const DtString& objectQueueName, const DtString& interactionQueueName,
113  const DtString& controlQueueName );
114 
115  protected:
116 
118  virtual void addSocket( DtInetTcpSocket* sock );
119 
121  virtual void removeSocket( DtInetTcpSocket* sock );
122 
124  virtual void removeUnknownSocket( DtInetTcpSocket* sock );
125 
128  virtual void processUnknownSockets();
129 
132  virtual void testKnownSockets();
133 
134  static void searchForLicFile();
135 
138  void drainSockets();
139 
140  protected:
141 
142  static bool addSocketCb( DtInetSocket* sock, void* usr );
143  static bool removeSocketCb( DtInetSocket* sock, void* usr );
144  const DtU16 myBrokerId;
145 
146  virtual DtU8 getUnusedBrokerID();
147 
148  private:
149 
151  DtQueueManager( const DtQueueManager& other );
152 
154  DtQueueManager& operator = ( const DtQueueManager& other );
155 
156  protected:
157 
166  DtInetSocketMgr *myTcpSocketManager;
167  DtClock myClock;
169 
170  typedef std::map<int,DtInetTcpSocket*> BrokerSocketMap;
172 
173  typedef std::map<DtInetTcpSocket*,int> UnknownSocketMap;
175 
176  };
177 
178 }

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)