![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 1998 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: ownerMsg.h,v $ $Revision: 1.17 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #ifndef DtOwnershipMsg_H_ 00013 #define DtOwnershipMsg_H_ 00014 00015 #include "rtiMsConfig.h" 00016 #include "rtiMsg.h" 00017 #include "netOwnerMsg.h" 00018 #include "attrHandSet.h" 00019 00020 class DtConnectionMgr; 00021 class DtOwnershipMsg; 00022 typedef void (*DtOwnershipCb)(const DtOwnershipMsg& msg, void* usr); 00023 00024 enum DtOwnerMsgKind 00025 { 00026 DtAcquire, 00027 DtAcquireIfAvail, 00028 DtCancelAcquire, 00029 DtCancelNegotiatedDivest, 00030 DtNegotiatedDivest, 00031 DtQueryOwner, 00032 DtUncondDivest, 00033 DtNotOwned, 00034 DtOwnedByRti, 00035 DtNotifyAcquire, 00036 DtOwnershipUnavail, 00037 DtConfirmCancelAcquire, 00038 DtInformOwner, 00039 DtGiveToLRC, 00040 DtResetOwner, 00041 DtMomTransfer, 00042 DtQueryAttrTransportType 00043 }; 00044 00045 class DT_DLL_LRC DtOwnershipMsg : public DtRtiMsg 00046 { 00047 public: 00048 00050 DtOwnershipMsg(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00051 00053 DtOwnershipMsg( 00054 DtOwnerMsgKind kind, 00055 DtObjectInstanceHandle objHand, 00056 const DtAttributeHandleSet& attrs, 00057 DtFederateHandle targetFed = 0, 00058 #ifdef DtIFSPEC1516 00059 rti1516::VariableLengthData const& theTag=theDefaultTag, 00060 #elif defined(DtIFSPEC1516E) 00061 rti1516e::VariableLengthData const& theTag=theDefaultTag, 00062 #else 00063 char const * theTag=NULL, 00064 #endif 00065 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00066 00068 DtOwnershipMsg( 00069 DtOwnerMsgKind kind, 00070 DtObjectInstanceHandle objHand, 00071 const DtAttributeHandle attr, 00072 DtFederateHandle targetFed = 0, 00073 #ifdef DtIFSPEC1516 00074 rti1516::VariableLengthData const& theTag=theDefaultTag, 00075 #elif defined(DtIFSPEC1516E) 00076 rti1516e::VariableLengthData const& theTag=theDefaultTag, 00077 #else 00078 char const * theTag=NULL, 00079 #endif 00080 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00081 00083 DtOwnershipMsg(const DtNetOwnershipMsg* netRepMsg, 00084 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00085 00087 virtual ~DtOwnershipMsg(); 00088 00090 virtual DtRtiMsg* clone(bool copy = true) const; 00091 00093 virtual void set( 00094 DtOwnerMsgKind kind, 00095 DtObjectInstanceHandle objHand, 00096 const DtAttributeHandleSet& attrs, 00097 DtFederateHandle targetFed = 0, 00098 #ifdef DtIFSPEC1516 00099 rti1516::VariableLengthData const& theTag=theDefaultTag); 00100 #elif defined(DtIFSPEC1516E) 00101 rti1516e::VariableLengthData const& theTag=theDefaultTag); 00102 #else 00103 char const * theTag=theDefaultTag); 00104 #endif 00105 00106 virtual void set ( 00107 DtOwnerMsgKind kind, 00108 DtObjectInstanceHandle objHand, 00109 const DtAttributeHandle attr, 00110 DtFederateHandle targetFed = 0, 00111 #ifdef DtIFSPEC1516 00112 rti1516::VariableLengthData const& theTag=theDefaultTag); 00113 #elif defined(DtIFSPEC1516E) 00114 rti1516e::VariableLengthData const& theTag=theDefaultTag); 00115 #else 00116 char const * theTag=theDefaultTag); 00117 #endif 00118 00120 virtual void setOwnerMsgKind(DtOwnerMsgKind kind); 00121 virtual DtOwnerMsgKind ownerMsgKind() const; 00122 00124 virtual void setObjHandle(DtObjectInstanceHandle id); 00125 virtual DtObjectInstanceHandle objHandle() const; 00126 00128 virtual void setClassHandle(DtObjectClassHandle handle); 00129 virtual DtObjectClassHandle classHandle() const; 00130 00132 #ifdef DtIFSPEC1516 00133 virtual void setTag(rti1516::VariableLengthData const& tag); 00134 virtual rti1516::VariableLengthData const& tag() const; 00135 #elif defined(DtIFSPEC1516E) 00136 virtual void setTag(rti1516e::VariableLengthData const& tag); 00137 virtual rti1516e::VariableLengthData const& tag() const; 00138 #else 00139 virtual void setTag(char const * tag); 00140 virtual char const * tag() const; 00141 #endif 00142 00144 virtual void setRecipientFederate(DtFederateHandle hand); 00145 virtual DtFederateHandle recipientFederate() const; 00146 00148 virtual void setAttrHandles(const DtAttributeHandleSet& attrs); 00149 virtual const DtAttributeHandleSet& attrHandles() const; 00150 00152 virtual void printData(DtLogicalTimeFactory* logicalTimeFactory) const; 00153 00154 public: 00155 00157 static DtRtiMsg* create(const DtNetMsgHeader* initial, 00158 DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00159 00161 static DtRtiMsg* create(DtBufferPtr buffer = DtUSE_INTERNAL_BUFFER); 00162 00164 static void addCallback(DtConnectionMgr *conn, 00165 DtOwnershipCb cb, void *usr); 00166 static void removeCallback(DtConnectionMgr *conn, 00167 DtOwnershipCb cb, void *usr); 00168 00169 protected: 00170 00172 virtual char* tagPtr(); 00173 00175 virtual int tagFieldSize() const; 00176 00178 virtual DtNetOwnershipMsg* netOwnershipMsg(); 00179 virtual const DtNetOwnershipMsg* netOwnershipMsg() const; 00180 00182 virtual DtRtiMsgKind internalDtRtiMsgKind(); 00183 00185 virtual int minSize() const; 00186 00188 virtual DtOwnershipMsg* self() const; 00189 00190 protected: 00191 00192 int myDirty; 00193 DtAttributeHandleSet* myAttrs; 00194 #ifdef DtIFSPEC1516 00195 rti1516::VariableLengthData* myTag; 00196 #elif defined(DtIFSPEC1516E) 00197 rti1516e::VariableLengthData* myTag; 00198 #else 00199 char* myTag; 00200 #endif 00201 }; 00202 00203 00204 inline DtOwnershipMsg* DtOwnershipMsg::self() const 00205 { 00206 return const_cast<DtOwnershipMsg*>( this ); 00207 } 00208 00209 #endif 00210