![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2006 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: rtiExecConnectionState.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 *********************************************************************/ 00010 00011 #ifndef DtRtiExecConnectionState22_H_ 00012 #define DtRtiExecConnectionState22_H_ 00013 00014 #include <vlutil/vlList.h> 00015 #include <vlutil/vlString.h> 00016 #include <list> 00017 #include "rtiMsConfig.h" 00018 #include <assert.h> 00019 #include <vlutil/vlPrint.h> 00020 #include <vlutil/vlTime.h> 00021 00022 class DtTcpMsgSocket; 00023 00024 //Singleton Class. 00025 //Container class for connection information/status about the rtiExec. 00026 class DT_DLL_FORWARDER DtRtiExecConnectionState 00027 { 00028 private: 00029 00031 DtRtiExecConnectionState(const DtRtiExecConnectionState& orig); 00032 DtRtiExecConnectionState& operator=(const DtRtiExecConnectionState& orig); 00033 00034 public: 00035 00050 00051 enum rtiExecConnectionStateDefns 00052 { 00053 DtNotConnected, 00054 DtConnectedAndRunning, 00055 DtWaitingForReconnect, 00056 DtReconnectFailed 00057 }; 00058 00059 //Creation and destruction 00060 DtRtiExecConnectionState(bool reconnectEnabled, MAKRti::DtTime rtiExecReconnectTimeout); 00061 ~DtRtiExecConnectionState(); 00062 00064 unsigned int rtiExecConnID() const; 00065 00068 const DtTcpMsgSocket* rtiExecSock() const; 00069 00071 bool rtiExecAvailable() const; 00072 00074 bool rtiExecIsLocalConnection() const; 00075 00078 bool noConnectionAvailable() const; 00079 00081 bool isWaitingForReconnect() const; 00082 00083 //rather than storing a DtRidParameters object in its entirety, we simply store the one 00085 bool reconnectEnabled() const; 00086 00090 bool hasTimeElapsed() const; 00091 00095 void resetRtiExecConnID(); 00096 00098 MAKRti::DtString hostName() const; 00099 00100 //State transition functions, filter will notify us of events and we'll respond appropriately. 00101 00102 bool rtiExecTimedOutReconnect(); 00103 00104 bool rtiExecDisconnected(); 00105 00106 bool rtiExecDisconnectMsgReceived(); 00107 00108 bool rtiExecConnected(unsigned int newConnectionID, 00109 const DtTcpMsgSocket* execSock, 00110 const MAKRti::DtString& hostName ); 00111 00112 bool rtiExecReconnected(unsigned int newConnectionID, 00113 const DtTcpMsgSocket* execSock, 00114 const MAKRti::DtString& hostName ); 00115 00118 bool testRtiExecConnectionStatus(); 00119 00120 protected: 00121 00126 //void setRtiExecConnID(unsigned int newConnectionID); 00127 00128 00129 00130 protected: 00131 bool myRtiExecAvailable; 00132 bool myRtiExecIsLocallyConnected; 00133 unsigned int myRtiExecConnID; 00134 const DtTcpMsgSocket* myExecSock; 00135 rtiExecConnectionStateDefns myRtiExecState; 00136 bool myReconnectEnabled; 00137 MAKRti::DtTime myRtiExecReconnectTimeout; 00138 MAKRti::DtClock myTimer; 00139 MAKRti::DtClock myPingTimer; 00140 MAKRti::DtString myExecHostname; 00141 00142 }; 00143 00144 00145 00146 #endif //! DtRtiExecConnectionState22_H_