MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
forwarderObserverMgr.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2008 MaK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: forwarderObserverMgr.h,v $ $Revision: 1.13 $ $State: Exp $
7 *******************************************************************************/
8 
11 
12 #ifndef DtRtiForwarderObserverMgr_H_
13 #define DtRtiForwarderObserverMgr_H_
14 
15 #include "rtiMsConfig.h"
16 #include "rtiMsg.h"
17 #include "rtiMsgCbMgr.h"
18 #include "forwarderNode.h"
19 #include "forwarderPort.h"
20 #include <vlutil/vlSmartPointers.h>
21 #include <vlutil/vlTime.h>
22 #include <vlutil/vlInetAddr.h>
23 #include <map>
24 #include <list>
25 
28 class DtRtiMsgForwarder;
29 class DtFedForwarder;
31 class DtTickWithForwarderCallbackInfo;
32 
33 
35 typedef void (*DtForwarderPortCbFn)(const MAKRti::DtString&, const MAKRti::DtString&, unsigned int, MAKRti::DtInetAddr);
36 
37 
39 {
40 public:
42  DtRtiForwarderObserver* observer,
43  const MAKRti::DtString& connName,
44  const MAKRti::DtString& hostName,
45  unsigned int connID,
46  MAKRti::DtInetAddr connAddr ) :
47  myFcn(fcn),
48  myObserver(observer),
49  myConnName(connName),
50  myConnHostName(hostName),
51  myConnID(connID),
52  myConnAddr(connAddr){}
54 
55  bool operator<(const DtForwarderPortCbInfo& other) const
56  {
57  return ( (myObserver == other.myObserver && myFcn < other.myFcn) ||
58  myObserver < other.myObserver );
59  }
62  const MAKRti::DtString& myConnName;
63  const MAKRti::DtString& myConnHostName;
64  unsigned int myConnID;
65  MAKRti::DtInetAddr myConnAddr;
66 };
67 
68 class DtMsgCbInfo {
69 public:
71  DtRtiForwarderObserver* observer, bool isMomCallback ) :
72  myMsgKind( msgKind ), myFcn( fcn ), myObserver( observer ),
73  myIsMomCallback( isMomCallback ) {}
75 
76  bool operator<(const DtMsgCbInfo& other) const
77  {
78  return ( myMsgKind < other.myMsgKind ||
79  ( myMsgKind == other.myMsgKind && myFcn < other.myFcn ) ||
80  ( myMsgKind == other.myMsgKind && myFcn == other.myFcn && myObserver < other.myObserver ) );
81  }
82 
86  bool myIsMomCallback;
87 };
88 
92 {
93 
94 public:
95 
98 
100  virtual ~DtRtiForwarderObserverMgr();
101 
103  virtual void setForwarderNode( DtBoost::shared_ptr<DtForwarderNode> forwarder);
104 
106  virtual void addObserver( DtBoost::shared_ptr<DtRtiForwarderObserver> observer );
107 
109  virtual void removeObserver( DtBoost::shared_ptr<DtRtiForwarderObserver> observer );
110 
112  virtual void removeAllObservers();
113 
115  virtual void addRtiMsgCallback( DtRtiMsgKind msgKind,
117  bool isMomCallback );
118 
120  virtual void removeRtiMsgCallback( DtRtiMsgKind msgKind,
122  bool isMomCallback );
123 
125 
126  static int clientToForwarderConnectionEstablished(
127  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
128  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr, void* usr);
129  virtual int clientToForwarderConnectionEstablished(
130  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
131  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr);
133 
135 
136  static int clientToForwarderConnectionLost(
137  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
138  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr, void* usr);
139  virtual int clientToForwarderConnectionLost(
140  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
141  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr);
143 
145 
146  static void clientToForwarderFederateJoined(
147  const MAKRti::DtString& connName, const MAKRti::DtString& connType,
148  const MAKRti::DtString& federationName,
149  unsigned int connID, unsigned int fedHandle,
150  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
151  unsigned int procesId, const MAKRti::DtString& processName,
152  const MAKRti::DtString& commandArgs, DtHlaVersionId hlaVersion,
153  void* usr );
154  virtual void clientToForwarderFederateJoined(
155  const MAKRti::DtString& connName, const MAKRti::DtString& connType,
156  const MAKRti::DtString& federationName,
157  unsigned int connID, unsigned int fedHandle,
158  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
159  unsigned int procesId, const MAKRti::DtString& processName,
160  const MAKRti::DtString& commandArgs, DtHlaVersionId hlaVersion);
162 
164 
165  static int clientToForwarderSocketQueueUpdate(
166  unsigned int connId, int connQueueStatus, void* usr );
167  virtual int clientToForwarderSocketQueueUpdate(
168  unsigned int connId, int connQueueStatus );
170 
172 
173  static void clientToForwarderFederateLost(
174  const MAKRti::DtString& connName, const MAKRti::DtString& connType,
175  unsigned int connID, unsigned int fedHandle,
176  const DtInetAddrAndPort& connAddr, void* usr );
177  virtual void clientToForwarderFederateLost(
178  const MAKRti::DtString& connName, const MAKRti::DtString& connType,
179  unsigned int connID, unsigned int fedHandle,
180  const DtInetAddrAndPort& connAddr );
182 
184 
185  static int forwarderToForwarderExecConnected(
186  const MAKRti::DtString& connName, unsigned int connID,
187  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& connHost,
188  bool fullyCompliant, void* usr );
189  virtual int forwarderToForwarderExecConnected(
190  const MAKRti::DtString& connName, unsigned int connID,
191  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& connHost,
192  bool fullyCompliant );
194 
196 
197  static int forwarderToForwarderExecLost(
198  const MAKRti::DtString& connName, unsigned int connID,
199  const DtInetAddrAndPort& connAddr, void* usr );
200  virtual int forwarderToForwarderExecLost(
201  const MAKRti::DtString& connName, unsigned int connID,
202  const DtInetAddrAndPort& connAddr );
204 
206 
207  static int clientToForwarderExecConnected(
208  const MAKRti::DtString& connName, unsigned int connID,
209  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
210  bool fullyCompliant, void* usr );
211  virtual int clientToForwarderExecConnected(
212  const MAKRti::DtString& connName, unsigned int connID,
213  const DtInetAddrAndPort& connAddr, const MAKRti::DtString& hostName,
214  bool fullyCompliant );
216 
218 
219  static int clientToForwarderExecLost(
220  const MAKRti::DtString& connName, unsigned int connID,
221  const DtInetAddrAndPort& connAddr, void* usr );
222  virtual int clientToForwarderExecLost(
223  const MAKRti::DtString& connName, unsigned int connID,
224  const DtInetAddrAndPort& connAddr );
226 
228 
229  static int forwarderToForwarderConnectionEstablished(
230  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
231  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr, void* usr);
232  virtual int forwarderToForwarderConnectionEstablished(
233  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
234  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr);
236 
238 
239  static int forwarderToForwarderConnectionLost(
240  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
241  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr, void* usr);
242  virtual int forwarderToForwarderConnectionLost(
243  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
244  unsigned int connID, const std::pair<DtInetAddrAndPort, DtInetAddrAndPort>& connAddr);
246 
248 
249  static int forwarderToForwarderConnectionChanged(
250  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
251  unsigned int oldConnID, unsigned int newConnID,
252  const DtInetAddrAndPort& connAddr, void* usr );
253  virtual int forwarderToForwarderConnectionChanged(
254  const MAKRti::DtString& connName, const MAKRti::DtString& hostName,
255  unsigned int oldConnID, unsigned int newConnID, const DtInetAddrAndPort& connAddr );
257 
260 
261  static void waitingForFowrarderConnections(
262  const DtForwarderPort::DtConnAndNameMap& allNeededFws,
263  const DtForwarderPort::DtConnAndNameMap& stillNeededFws, void* usr );
264  virtual void waitingForFowrarderConnections(
265  const DtForwarderPort::DtConnAndNameMap& allNeededFws,
266  const DtForwarderPort::DtConnAndNameMap& stillNeededFws );
268 
271 
272  static void notWaitingForFowrarderConnections( void* usr );
273  virtual void notWaitingForFowrarderConnections();
275 
278  virtual void addTickCallback( DtTickCbFn fcn, DtRtiForwarderObserver* observer,
279  MAKRti::DtTime interval );
280 
282  virtual void removeTickCallback( DtTickCbFn fcn, DtRtiForwarderObserver* observer );
283 
284 
286  virtual unsigned long connectionId() const;
287  virtual const DtInetAddrAndPort& connectionAddr() const;
288  virtual MAKRti::DtString connectionName() const;
289  virtual MAKRti::DtString connectionHostName() const;
290 
291 protected:
292 
295 
297  DtRtiForwarderObserverMgr& operator=( const DtRtiForwarderObserverMgr& orig );
298 
299 protected:
300 
301  typedef std::set<DtMsgCbInfo> DtMsgCbSet;
302  typedef std::set<DtTickCallbackInfo> DtTickCbSet;
303  typedef std::set<DtForwarderPortCbInfo> DtForwarderPortCbSet;
304  typedef std::list< DtBoost::shared_ptr<DtRtiForwarderObserver> > DtForwarderObsList;
305 
307  DtBoost::shared_ptr<DtForwarderNode> myForwarder;
308 
311 
314 
317 
318 
319 };
320 
321 
322 #endif
323 
324 

Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)