📄 federation.hh
字号:
// -*- mode:C++ ; tab-width:4 ; c-basic-offset:4 ; indent-tabs-mode:nil -*-// ----------------------------------------------------------------------------// CERTI - HLA RunTime Infrastructure// Copyright (C) 2002, 2003 ONERA//// This file is part of CERTI//// CERTI is free software ; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation ; either version 2 of the License, or// (at your option) any later version.//// CERTI is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY ; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program ; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA//// $Id: Federation.hh,v 3.10 2003/03/21 15:06:46 breholee Exp $// ----------------------------------------------------------------------------#ifndef _CERTI_RTIG_FEDERATION_HH#define _CERTI_RTIG_FEDERATION_HH#include <config.h>#include "Federate.hh"#include "RootObject.hh"#include "LBTS.hh"#include "SecurityServer.hh"#include "RTItypes.hh"#include "FedParser.hh" // CRead : FED file reader.#include "XmlParser.hh"#ifdef FEDERATION_USES_MULTICAST#include "SocketMC.hh"#endif#include "PrettyDebug.hh"#include <map>#include <fstream>#include <iostream>#include <string.h> // strlenusing std::map ;using std::pair ;using std::ifstream ;using std::ios ;using std::cout ;using std::endl ;using namespace certi ;namespace certi {namespace rtig {class Federation : private list<Federate *>{ // ATTRIBUTES --------------------------------------------------------------private: FederationHandle handle ; char *name ; FederateHandle nextFederateHandle ; //! Labels and Tags not on synchronization. std::map<const char *, const char *> synchronizationLabels ; ObjectHandle nextObjectId ; // This object is initialized when the Federation is created, with // the reference of the RTIG managed Socket Server. The reference of // this object is passed down the Classes Tree with the help of RootObj. SecurityServer *server ; RootObject *root ; LBTS regulators ;#ifdef FEDERATION_USES_MULTICAST SocketMC *MCLink ;#endif // METHODS -----------------------------------------------------------------public:#ifdef FEDERATION_USES_MULTICAST Federation(const char *, FederationHandle, SocketServer*, AuditFile*, SocketMC*)#else Federation(const char *, FederationHandle, SocketServer*, AuditFile*)#endif throw (CouldNotOpenRID, ErrorReadingRID, MemoryExhausted, SecurityError, RTIinternalError); ~Federation(void); void requestId(ObjectHandlecount IDCount, ObjectHandle &FirstID, ObjectHandle &LastID) throw (TooManyIDsRequested); int getNbFederates(void) const ; int getNbRegulators(void) const ; bool isSynchronizing(void) const ; FederationHandle getHandle(void) const ; const char *getName(void) const ; // ------------------------- // -- Federate Management -- // ------------------------- FederateHandle add(const char *theName, SocketTCP *theTCPLink) throw (FederateAlreadyExecutionMember, MemoryExhausted, RTIinternalError); bool empty(void) const throw (FederatesCurrentlyJoined); bool check(FederateHandle theHandle) const throw (FederateNotExecutionMember); void kill(FederateHandle theFederate) throw (); void remove(FederateHandle theHandle) throw (FederateOwnsAttributes, FederateNotExecutionMember); // --------------------- // -- Time Management -- // --------------------- void addRegulator(FederateHandle theHandle, FederationTime theTime) throw (FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError); // includes Time Regulation already enabled. void updateRegulator(FederateHandle theHandle, FederationTime theTime) throw (FederateNotExecutionMember, RTIinternalError); void removeRegulator(FederateHandle theHandle) throw (FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError); // includes Time Regulation already disabled. void addConstrained(FederateHandle theHandle) throw (FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError); // includes Time constrained already enabled. void removeConstrained(FederateHandle theHandle) throw (FederateNotExecutionMember, SaveInProgress, RestoreInProgress, RTIinternalError); // includes Time constrained already disabled. // Synchronization Management. void registerSynchronization(FederateHandle the_federate, const char *the_label, const char *the_tag) throw (FederateNotExecutionMember, FederationAlreadyPaused, SaveInProgress, RestoreInProgress, RTIinternalError); void unregisterSynchronization(FederateHandle theFederate, const char *theLabel) throw (FederateNotExecutionMember, FederationNotPaused, SaveInProgress, RestoreInProgress, RTIinternalError); void broadcastSynchronization(FederateHandle federate, const char *label, const char *tag) throw (RTIinternalError); // ----------------------- // -- Object Management -- // ----------------------- void deleteObject(FederateHandle theFederateHandle, ObjectHandle theObjectHandle, const char *theUserTag) throw (FederateNotExecutionMember, DeletePrivilegeNotHeld, ObjectNotKnown, SaveInProgress, RestoreInProgress, RTIinternalError); void publishObject(FederateHandle theFederateHandle, ObjectClassHandle theObjectHandle, AttributeHandle *theAttributeList, UShort theListSize, bool PubOrUnpub) throw (ObjectClassNotDefined, AttributeNotDefined, FederateNotExecutionMember, SaveInProgress, SecurityError, RestoreInProgress, RTIinternalError); ObjectHandle registerObject(FederateHandle theFederateHandle, ObjectClassHandle theClass, ObjectName theName) throw (FederateNotExecutionMember, FederateNotPublishing,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -