VR-Exchange 2.5 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
49  static DtQueueManager* create( DtU32 numberOfBucketsInQueue,
50  DtU32 payloadSizePerBucket, int port, DtU16 theBrokerId,
51  const DtString& objectQueueName, const DtString& interactionQueueName,
52  const DtString& controlQueueName );
53 
59  DtQueueManager( DtU32 numberOfBucketsInQueue, DtU32 payloadSizePerBucket,
60  int port, DtU16 brokerId, const DtString& objectQueueName,
61  const DtString& interactionQueueName,
62  const DtString& controlQueueName );
63 
69  virtual ~DtQueueManager();
70 
71  virtual void send( DtPortalControlMessage& message, bool global = false );
72 
75  virtual void tick();
76 
80  virtual void requestBrokerShutdown();
81 
86  virtual void requestBrokerRestart( bool shouldMapMessagesOneToOne );
87 
90  virtual void brokerShutdownNotification( DtU32 brokerId );
91 
98  virtual int connectedBrokerCount();
99 
103  virtual void pruneBrokerSocketMap();
104 
108 
109  virtual DtSubscribableMessageQueue* getControlMessageQueue() { return myControlMessageQueue;}
110  virtual DtSubscribableMessageQueue* getInteractionMessageQueue() { return myInteractionMessageQueue;}
111  virtual DtSubscribableMessageQueue* getObjectMessageQueue() { return myObjectMessageQueue;}
112 
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 getLicFilesInDir( const std::string& dir, std::list<std::string>& files );
135 
136  static void searchForLicFile();
137 
140  void drainSockets();
141 
142  static bool addSocketCb( DtInetSocket* sock, void* usr );
143  static bool removeSocketCb( DtInetSocket* sock, void* usr );
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 
157  const DtU16 myBrokerId;
158 
162 
165 
169 
170  DtInetSocketMgr* myTcpSocketManager;
171 
172  DtClock myClock;
174 
175  typedef std::set<DtU32> BrokerShutdownNotificationSet;
177 
178  typedef std::map<int,DtInetTcpSocket*> BrokerSocketMap;
180 
181  typedef std::map<DtInetTcpSocket*,int> UnknownSocketMap;
183 
184  };
185 
186 }

Document ID: Generated on Wed Dec 21 15:05:11 EST 2016 from SVN revision 171891
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)