![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2006 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: federationStateXmlBlock.h,v $ $Revision: 1.10 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef DtFederationStateXmlBlock_H_ 00009 #define DtFederationStateXmlBlock_H_ 00010 00011 #include <rtiMsConfig.h> 00012 #include "spyXmlBlock.h" 00013 #include "spyXmlBlockElements.h" 00014 #include "federateStateXmlBlock.h" 00015 #include "syncPointXmlBlock.h" 00016 #include <mtl/env.h> 00017 #include <vlutil/vlString.h> 00018 #include <vlutil/vlSmartPointers.h> 00019 00020 00021 // Declare the XML tags used by this block 00022 DtDECLARE_SPY_XML_TAG( DtFederationStateXmlTag ); 00023 DtDECLARE_SPY_XML_TAG( DtFederationHandleXmlTag ); 00024 DtDECLARE_SPY_XML_TAG( DtFedFileNameXmlTag ); 00025 DtDECLARE_SPY_XML_TAG( DtFederateCountXmlTag ); 00026 00027 class DtFederationStateXmlBlock; 00028 typedef DtBoost::shared_ptr<DtFederationStateXmlBlock> DtFederationStateXmlBlockSP; 00029 typedef DtBoost::weak_ptr<DtFederationStateXmlBlock> DtFederationStateXmlBlockWP; 00030 00031 00032 // The DtFederationStateXmlBlock holds the current state info for a single federation 00033 class DT_DLL_WWW DtFederationStateXmlBlock : public DtSpyXmlBlock 00034 { 00035 public: 00036 typedef std::set< DtFederateStateXmlBlockSP > FederateStateXmlBlockSet; 00037 typedef std::set< DtSyncPointXmlBlockSP > SyncPointXmlBlockSet; 00038 00039 static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent ); 00040 00041 public: 00042 DtFederationStateXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root ); 00043 DtFederationStateXmlBlock( const DtString& name, unsigned int handle, 00044 const DtString& fedFile, unsigned int numFederates, DtEnvValueSP root ); 00045 virtual ~DtFederationStateXmlBlock(); 00046 00047 // Add and Remove federates from the list 00048 virtual DtFederateStateXmlBlockSP addFederate( unsigned long connId, const DtString& name, 00049 unsigned int handle, const DtString& host, const DtString& webServerHost, int webServerPort ); 00050 virtual DtFederateStateXmlBlockSP removeFederate( unsigned long handle); 00051 virtual void removeFederate( DtFederateStateXmlBlockSP federateSP ); 00052 00053 // List the federates 00054 virtual FederateStateXmlBlockSet federates(); 00055 00056 // Add and Remove sync points from the list 00057 virtual DtSyncPointXmlBlockSP addSyncPoint( const DtString& name ); 00058 virtual DtSyncPointXmlBlockSP removeSyncPoint( const DtString& name ); 00059 virtual void removeSyncPoint( DtSyncPointXmlBlockSP syncSP ); 00060 00061 // List the sync points 00062 virtual SyncPointXmlBlockSet syncPoints(); 00063 00064 00065 inline unsigned int handle() const; 00066 inline DtString fedfile() const; 00067 inline unsigned int federateCount() const; 00068 00069 protected: 00070 00071 DtSpyXmlBlockElement< unsigned int > myHandle; 00072 DtSpyXmlBlockElement< DtString, false > myFedFile; 00073 DtSpyXmlBlockElement< unsigned int, false > myCount; 00074 }; 00075 00076 00077 unsigned int DtFederationStateXmlBlock::handle() const { return myHandle; } 00078 DtString DtFederationStateXmlBlock::fedfile() const { return myFedFile; } 00079 unsigned int DtFederationStateXmlBlock::federateCount() const { return myCount; } 00080 00081 #endif // DtFederationStateXmlBlock_H_ 00082 00083