![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 2006 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: federateStateXmlBlock.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef DtFederateStateXmlBlock_H_ 00009 #define DtFederateStateXmlBlock_H_ 00010 00011 #include <rtiMsConfig.h> 00012 #include "spyXmlBlock.h" 00013 #include <mtl/env.h> 00014 #include <vlutil/vlString.h> 00015 #include <vlutil/vlSmartPointers.h> 00016 00017 // Declare the XML tags used by this block 00018 DtDECLARE_SPY_XML_TAG( DtFederateStateXmlTag ); 00019 DtDECLARE_SPY_XML_TAG( DtFederateConnIdXmlTag ); 00020 DtDECLARE_SPY_XML_TAG( DtFederateHandleXmlTag ); 00021 DtDECLARE_SPY_XML_TAG( DtFederateHostXmlTag ); 00022 DtDECLARE_SPY_XML_TAG( DtFederateWebServerHostXmlTag ); 00023 DtDECLARE_SPY_XML_TAG( DtFederateWebServerPortXmlTag ); 00024 DtDECLARE_SPY_XML_TAG( DtTimeStateXmlTag ); 00025 DtDECLARE_SPY_XML_TAG( DtTimeRegulatingXmlTag ); 00026 DtDECLARE_SPY_XML_TAG( DtTimeConstrainedXmlTag ); 00027 DtDECLARE_SPY_XML_TAG( DtLbtsXmlTag ); 00028 DtDECLARE_SPY_XML_TAG( DtLookaheadXmlTag ); 00029 DtDECLARE_SPY_XML_TAG( DtCurrentTimeXmlTag ); 00030 00031 class DtFederateStateXmlBlock; 00032 class DtTimeStateXmlBlock; 00033 typedef DtBoost::shared_ptr<DtFederateStateXmlBlock> DtFederateStateXmlBlockSP; 00034 typedef DtBoost::weak_ptr<DtFederateStateXmlBlock> DtFederateStateXmlBlockWP; 00035 typedef DtBoost::shared_ptr<DtTimeStateXmlBlock> DtTimeStateXmlBlockSP; 00036 typedef DtBoost::weak_ptr<DtTimeStateXmlBlock> DtTimeStateXmlBlockWP; 00037 00038 00039 // Sub-block of DtFederateStateXmlBlock representing the federate's logical time 00040 // state. Times are represented as strings since their implementation is user-defined 00041 class DT_DLL_WWW DtTimeStateXmlBlock : public DtSpyXmlBlock 00042 { 00043 public: 00044 static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent ); 00045 00046 public: 00047 DtTimeStateXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root ); 00048 DtTimeStateXmlBlock( bool regulating, bool constrained, const DtString& lbts, 00049 const DtString& lookahead, const DtString& curTime, DtEnvValueSP root ); 00050 virtual ~DtTimeStateXmlBlock(); 00051 00052 virtual void setTimeState( bool regulating, bool constrained, const DtString& lbts, 00053 const DtString& lookahead, const DtString& curTime ); 00054 00055 inline bool isRegulating() const; 00056 inline bool isConstrained() const; 00057 inline DtString lbts() const; 00058 inline DtString lookahead() const; 00059 inline DtString currentTime() const; 00060 00061 protected: 00062 00063 DtSpyXmlBlockElement< bool > myIsRegulating; 00064 DtSpyXmlBlockElement< bool > myIsConstrained; 00065 DtSpyXmlBlockElement< DtString > myLbts; 00066 DtSpyXmlBlockElement< DtString > myLookahead; 00067 DtSpyXmlBlockElement< DtString > myCurrentTime; 00068 }; 00069 00070 // The DtFederateStateXmlBlock represents the current state of a joined federate 00071 // as seen by the RTI Exec. 00072 class DT_DLL_WWW DtFederateStateXmlBlock : public DtSpyXmlBlock 00073 { 00074 public: 00075 static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent ); 00076 00077 public: 00078 DtFederateStateXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root ); 00079 DtFederateStateXmlBlock( unsigned long connId, const DtString& type, 00080 unsigned long handle, const DtString& host, const DtString& webServerHost, 00081 int webServerPort, DtEnvValueSP root ); 00082 virtual ~DtFederateStateXmlBlock(); 00083 00084 // A federate may contain only one TimeState block 00085 virtual DtTimeStateXmlBlockSP setTimeState( bool regulating, bool constrained, 00086 const DtString& lbts, const DtString& lookahead, const DtString& curTime ); 00087 virtual DtTimeStateXmlBlockSP timeState(); 00088 00089 inline unsigned long connId() const; 00090 inline DtString host() const; 00091 inline DtString webServerHost() const; 00092 inline int webServerPort() const; 00093 00094 // Set and get federate handle 00095 // (may not be available initially) 00096 inline void setHandle( unsigned long handle ); 00097 inline unsigned long handle() const; 00098 00099 protected: 00100 00101 00102 DtSpyXmlBlockElement< unsigned long, true > myConnId; 00103 DtSpyXmlBlockElement< unsigned long, true > myHandle; 00104 DtSpyXmlBlockElement< DtString, false > myHost; 00105 DtSpyXmlBlockElement< DtString, false > myWebServerHost; 00106 DtSpyXmlBlockElement< int, false > myWebServerPort; 00107 }; 00108 00109 00110 00111 bool DtTimeStateXmlBlock::isRegulating() const { return myIsRegulating; } 00112 bool DtTimeStateXmlBlock::isConstrained() const { return myIsConstrained; } 00113 DtString DtTimeStateXmlBlock::lbts() const { return myLbts; } 00114 DtString DtTimeStateXmlBlock::lookahead() const { return myLookahead; } 00115 DtString DtTimeStateXmlBlock::currentTime() const { return myCurrentTime; } 00116 unsigned long DtFederateStateXmlBlock::connId() const { return myConnId; } 00117 void DtFederateStateXmlBlock::setHandle( unsigned long handle ) { myHandle = handle; } 00118 unsigned long DtFederateStateXmlBlock::handle() const { return myHandle; } 00119 DtString DtFederateStateXmlBlock::host() const { return myHost; } 00120 DtString DtFederateStateXmlBlock::webServerHost() const { return myWebServerHost; } 00121 int DtFederateStateXmlBlock::webServerPort() const { return myWebServerPort; } 00122 00123 #endif // DtFederateStateXmlBlock_H_ 00124