![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 1998 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: connection.h,v $ $Revision: 1.25 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #ifndef DtRtiConnection_H_ 00013 #define DtRtiConnection_H_ 00014 00015 #include <vlutil/vlInetAddr.h> 00016 #include "rtiMsgFact.h" 00017 00018 class DtRtiMsg; 00019 class DtMsgSocket; 00020 00021 enum DtNetReadStatus 00022 { 00023 DtNET_READ_SUCCESS = 0, 00024 DtNET_READ_NO_PACKETS, 00025 DtNET_READ_BAD_PACKET, 00026 DtNET_READ_SERVER_MSG, 00027 DtNET_READ_SIZE_MISMATCH, 00028 DtNET_READ_VERSION_MISMATCH, 00029 DtNET_READ_VERSION_UNKNOWN, 00030 DtNET_READ_FILTERED_PACKET, 00031 DtNET_QUEUED_PACKET, 00032 DtNET_INVALID_VERSION, 00033 DtNET_BUFFER_TOO_SMALL, 00034 DtNET_UNKNOWN_ERROR 00035 }; 00036 00038 class DT_DLL_LRC DtRtiConnection 00039 { 00040 public: 00041 00043 DtRtiConnection(DtMsgSocket *skt); 00044 00046 virtual ~DtRtiConnection(); 00047 00051 virtual void setMsgFactory(DtRtiMsgFactory* fact); 00052 virtual DtRtiMsgFactory *rtiMsgFactory(); 00053 00054 00057 virtual DtRtiMsg* netRead(DtNetReadStatus *retCode = NULL); 00058 00060 virtual int send(const DtRtiMsg& msg, 00061 const MAKRti::DtInetAddr& addr = MAKRti::DtInetAddr()); 00062 00065 virtual bool flush(); 00066 00068 virtual int isOk(); 00069 00072 virtual void setCheckVersion(bool enableCheckVersion); 00073 virtual bool checkVersion() const; 00074 00076 virtual void disableCheckSize(); 00077 00079 virtual void enableCheckSize(); 00080 00082 virtual void setFedExName(const MAKRti::DtString& newFedExName); 00083 virtual const MAKRti::DtString& fedExName() const; 00084 00086 virtual void setFedExHandle(int handle); 00087 virtual int fedExHandle() const; 00088 00090 virtual void setFederateHandle(DtFederationHandle handle); 00091 virtual DtFederationHandle federateHandle() const; 00092 00094 virtual void setConnId(unsigned long connId); 00095 virtual unsigned long connId() const; 00096 00098 virtual DtMsgSocket* socket(); 00099 00100 protected: 00101 00102 void init(DtMsgSocket *s); 00103 00104 private: 00106 DtRtiConnection(const DtRtiConnection& orig); 00107 00109 DtRtiConnection& operator=(DtRtiConnection const& orig); 00110 00111 protected: 00112 00113 MAKRti::DtString myFedExName; 00114 int myFedExHandle; 00115 DtFederationHandle myFedHandle; 00116 DtMsgSocket* mySocket; 00117 DtRtiMsgFactory* myMsgFact; 00118 unsigned long myReceivedMsgCount; 00119 bool myCheckSize; 00120 bool myCheckVersion; 00121 unsigned int myWaitEventIndex; 00122 unsigned long myConnId; 00123 }; 00124 00125 inline DtRtiMsgFactory *DtRtiConnection::rtiMsgFactory() 00126 { 00127 return myMsgFact; 00128 } 00129 00130 inline DtMsgSocket* DtRtiConnection::socket() 00131 { 00132 return mySocket; 00133 } 00134 00135 inline void DtRtiConnection::setFedExName(const MAKRti::DtString& newFedExName) 00136 { 00137 myFedExName = newFedExName; 00138 } 00139 00140 inline const MAKRti::DtString& DtRtiConnection::fedExName() const 00141 { 00142 return myFedExName; 00143 } 00144 00145 inline void DtRtiConnection::setFedExHandle(int handle) 00146 { 00147 myFedExHandle = handle; 00148 } 00149 00150 inline int DtRtiConnection::fedExHandle() const 00151 { 00152 return myFedExHandle; 00153 } 00154 00155 inline void DtRtiConnection::setFederateHandle(DtFederationHandle handle) 00156 { 00157 myFedHandle = handle; 00158 } 00159 00160 inline DtFederationHandle DtRtiConnection::federateHandle() const 00161 { 00162 return myFedHandle; 00163 } 00164 00165 inline void DtRtiConnection::setConnId(unsigned long connId) 00166 { 00167 myConnId = connId; 00168 } 00169 00170 inline unsigned long DtRtiConnection::connId() const 00171 { 00172 return myConnId; 00173 } 00174 00175 #endif 00176 00177