VR-Exchange 2.6 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  void processBrokerConnect(const DtBrokerStartedMessage& msg);
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 
135  static void getLicFilesInDir( const std::string& dir, std::list<std::string>& files );
136 
137  static void searchForLicFile();
138 
141  void drainSockets();
142 
143  static bool addSocketCb( DtInetSocket* sock, void* usr );
144  static bool removeSocketCb( DtInetSocket* sock, void* usr );
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 
158  const DtU16 myBrokerId;
159 
163 
166 
170 
171  DtInetSocketMgr* myTcpSocketManager;
172 
173  DtClock myClock;
175 
176  typedef std::set<DtU32> BrokerShutdownNotificationSet;
178 
179  typedef std::map<int,DtInetTcpSocket*> BrokerSocketMap;
181 
182  typedef std::map<DtInetTcpSocket*,int> UnknownSocketMap;
184 
185  typedef std::map<int, int> BrokerIdTypeMap;
187 
188  };
189 
190 }

Document ID: Generated on Wed Jan 30 18:15:18 EST 2019 from SVN revision 195534
Copyright © 2005-2019 VT MÄK. All Rights Reserved (www.mak.com)