MAK RTIspy API Documentation for HLA 1.3
federationInfo.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2008 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: federationInfo.h,v $ $Revision: 1.8 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 #ifndef federationInfo_H_
00010 #define federationInfo_H_
00011 
00015 
00016 #include <rtiVersion.h>
00017 #include <vlutil/vlString.h>
00018 #include <vlutil/vlInetAddr.h>
00019 #include <rtiMsConfig.h>
00020 #include "federateInfo.h"
00021 #include <map>
00022 #include <set>
00023 #include <list>
00024 
00025 // Related typedefs
00026 
00028 typedef std::map< int, DtAssistantFederateInfo > DtFederateInfoByHandleMap;
00029 
00032 typedef std::pair< std::set< int >, std::set< int > > DtPendingAchievedPair;
00033 
00035 typedef std::map< MAKRti::DtString, DtPendingAchievedPair > DtSyncPtToAchievedFederatesMap;
00036 
00038 typedef std::map< int, MAKRti::DtString > DtFederationNameByHandleMap;
00039 
00042 class DT_DLL_ASSISTANT DtAssistantFederationInfo
00043 {
00044 public:
00045 
00046    DtAssistantFederationInfo(
00047       const MAKRti::DtString& name = MAKRti::DtString::nullString(),
00048       int handle = -1,
00049       const std::list<MAKRti::DtString>& files = std::list<MAKRti::DtString>(),
00050       bool testEn = true );
00051 
00052    void setFederationName(const MAKRti::DtString& val) { myFederationName = val; }
00053    const MAKRti::DtString& federationName() const { return myFederationName; }
00054 
00055    void setFederationHandle(int val) { myFederationHandle = val; }
00056    int federationHandle() const { return myFederationHandle; }
00057 
00058    void addFomModule(const MAKRti::DtString& module) { myFomModuleNames.push_back(module); }
00059    void setFomModules(const std::list<MAKRti::DtString>& modules) { myFomModuleNames = modules; }
00060    const std::list<MAKRti::DtString>* fomModules() const { return &myFomModuleNames; }
00061 
00062    void enableTesting(bool enabled) { myTestEnabled = enabled; }
00063    bool testingEnabled() const { return myTestEnabled; }
00064 
00067    bool updateFederates(const DtFederateInfoByHandleMap& federates);
00068 
00070    bool updateFederate(const DtAssistantFederateInfo& federate);
00071 
00074    void replaceFederateList(const DtFederateInfoByHandleMap& federates);
00075 
00077    bool removeFederate(int handle);
00078 
00080    void clearFederates();
00081 
00083    const DtAssistantFederateInfo* federateInfo(unsigned handle) const;
00084    DtAssistantFederateInfo* federateInfo(unsigned handle);
00085 
00087    const DtFederateInfoByHandleMap* federates() const { return &myFederates; }
00088    DtFederateInfoByHandleMap* federates() { return &myFederates; }
00089 
00091    unsigned numFederates() const { return myFederates.size(); }
00092 
00094    unsigned numLocalFederates() const { return myLocalFederatesByHandle.size(); }
00095 
00097    int localFederateCompId(int federateHandle) const;
00098 
00101    int localFederateHandle(int compId) const;
00102 
00104    void updateSyncPoint(const MAKRti::DtString& name, 
00105       const DtPendingAchievedPair& pendAchv);
00106 
00108    void removeSyncPoint(const MAKRti::DtString& name) { mySyncPts.erase(name); }
00109 
00112    DtPendingAchievedPair *syncPoint(const MAKRti::DtString& name) { return &mySyncPts.find(name)->second; }
00113 
00115    const DtSyncPtToAchievedFederatesMap* syncPoints() const { return &mySyncPts; }
00116 
00118    void setHeartbeated(bool hb) { myHeartbeated = hb; }
00119    bool heartbeated() const { return myHeartbeated; }
00120 
00121 protected:
00122    MAKRti::DtString myFederationName;
00123    int      myFederationHandle;
00124    std::list<MAKRti::DtString> myFomModuleNames;
00125    bool     myTestEnabled;
00126 
00127    DtFederateInfoByHandleMap myFederates;
00128    DtSyncPtToAchievedFederatesMap mySyncPts;
00129    bool myHeartbeated;
00130 
00132    std::map< int, int > myLocalFederatesByHandle;
00133 
00135    std::map< int, int > myLocalFederatesByCompId;
00136 };
00137 
00138 typedef std::map< MAKRti::DtString, DtAssistantFederationInfo > DtFederationStateByNameMap;
00139 
00140 
00141 #endif

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)