⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 federate.h

📁 一个用HLA编写的聊天程序
💻 H
字号:
/**********************************************************************************

						欢迎使用FFB-MOT对象模板V1.1
						设计者:尹娟,龚建兴
						Email:fj_gjx@yahoo.com
						Phone:0731-4574996
						日期 :2003.8.25

**********************************************************************************/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef	FEDERATE_H_
#define FEDERATE_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "FWArray.h" //操作框架生成的对象类实例的模板类

//{{FW_PUBOBJ_ARRY_TYPYEDEF_BEGIN <<----- Don't delete it!>>
typedef CFWArray<CPub_Person> CPub_PersonArray;
//}}FW_PUBOBJ_ARRY_TYPYEDEF_END <<----- Don't delete it!>>

//{{FW_SUBOBJ_ARRY_TYPYEDEF_BEGIN <<----- Don't delete it!>>
typedef CFWArray<CSub_Person> CSub_PersonArray;
//}}FW_SUBOBJ_ARRY_TYPYEDEF_END <<----- Don't delete it!>>

class CFederate
{
public:
    CFederate();
	virtual ~CFederate();

//Attribute
private:
	//时间管理变量
	RTIfedTime       ms_Lookahead;		//联邦成员时间前瞻量
	RTIfedTime       ms_TimeStamp;		//联邦成员时戳
	RTI::Boolean     m_RegulationEnabled;	//联邦成员为"时间控制成员"标志
	RTI::Boolean     m_ConstrainedEnabled;	//联邦成员为"时间受限成员"标志

	//有关联邦成员信息的变量
	RTI::FederateHandle	m_FedHandle;		//联邦成员句柄
	
	CString	            m_FedFileName;		//联邦执行文件名

public:
	RTIfedTime	  m_TimeStep;		//仿真步长
	RTIfedTime	  m_CurrentTime;	//仿真当前时间
	RTIfedTime	  m_PrevTime;		//仿真上一时刻
	RTIfedTime	  m_NextTime;		//仿真下一时刻
	double	      m_InitTime;		//仿真初始时间
	double        m_SimTime;		//仿真时间

	CString				m_FederationName;	//联邦名
	CString				m_FederateName;		//联邦成员名

	//{{FW_ROUTINGSPACE_DECLARE_BEGIN <<----- Don't delete it!>>
	//}}FW_ROUTINGSPACE_DECLARE_END <<----- Don't delete it!>>

	//{{FW_OBJ_ARRY_DECLARE_BEGIN <<----- Don't delete it!>>
	CPub_PersonArray	m_Pub_Persons;
	CSub_PersonArray	m_Sub_Persons;
	//}}FW_OBJ_ARRY_DECLARE_END <<----- Don't delete it!>>

	//同步点数组
	CArray<CSyncPiont,CSyncPiont&> m_SynPoints;

//Method
public:
	//{{FW_PUBLIC_METHOD_DECLARE_BEGIN <<----- Don't delete it!>>
	void SetLookahead(RTIfedTime &theTime);
	RTIfedTime GetLookahead();
	void SetTimeStamp(RTIfedTime theTime);
	RTIfedTime GetTimeStamp();
	void SetRegulationFlag(RTI::Boolean theFlag);
	RTI::Boolean GetRegulationFlag();
	void SetConstrainedFlag(RTI::Boolean theFlag);
	RTI::Boolean GetConstrainedFlag();
	RTI::FederateHandle GetFederateHandle();
	CString& GetFederationName();
	CString& GetFederateName();
	CString& GetFedFileName();
	//}}FW_PUBLIC_METHOD_DECLARE_END <<----- Don't delete it!>>

	//{{FW_FEDERATE_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	void CreateFederation();
	void JoinFederation();
	void ResignFederationExecution();
	void DestroyFederationExecution();
	RTI::FederateHandleSet* BuildFederateSet(RTI::FederateHandle theHandlesList[], int nFedHandle);
	void RegisterSyncPiont(char *theLabel, char *theTag, RTI::FederateHandleSet *theFedHandles);
	void SyncPointAchived(const char *theLabel);
	void FederateSaveComplete();
	void FederateSaveBegun();
	void FederateSaveNotComplete();
	void RequestFederationSave(const char *theLable, const RTIfedTime  &theTime);
	void RequestFederationSave(const char *theLable);
	void FederateRestoreComplete();
	void FederateRestoreNotComplete();
	void RequestFederationRestore(const char *theLabel);
	//{{FW_FEDERATE_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>

	//{{FW_DECLARATIONE_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	void InitRTI();
	void PublishAndSubscribe();
	void UnpublishObjectClass(RTI::ObjectClassHandle theClass);
	void UnsubscribeObjectClass(RTI::ObjectClassHandle theClass);
	void UnpublishInteractionClass(RTI::InteractionClassHandle theClass);
	void UnsubscribeInteractionClass(RTI::InteractionClassHandle theClass);
	//{{FW_DECLARATION_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>

	//{{FW_OBJECT_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	void Register();
	void DeleteObjInst();
	void DeletePubObjectInstance(RTI::ObjectHandle theObject);
	void LocalDeleteObjectInstance(RTI::ObjectHandle theObject);
	void RequestClassAttributeValueUpdate(RTI::ObjectClassHandle theClass,
		 const RTI::AttributeHandleSet &theAttrHandles);
	void RequestObjAttributeValueUpdate(RTI::ObjectHandle theObject, 
		 const RTI::AttributeHandleSet &theAttrHandles);
	void DisableClassRelevanceAdvisorySwitch();
	void EnableAttributeRelevanceAdvisorySwitch();
	void ProcessReceiveInter(RTI::InteractionClassHandle theClass,
		 const RTI::ParameterHandleValuePairSet &theParameters, const char	*tag = 0);
	void ProcessReceiveInter(RTI::InteractionClassHandle theClass,
		 const RTI::ParameterHandleValuePairSet &theParameters, const RTI::FedTime &theFederateTime, const char	*tag = 0);
	//{{FW_OBJECT_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>

	//{{FW_DATA_DISTRIBUTION_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	//{{FW_DATA_DISTRIBUTION_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>

	//{{FW_TIME_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	void DeclareTimeAdvanceConstrained();
	void DeclareTimeAdvanceRegulation();
	void AdvanceTimeRequest(const RTIfedTime &theTime);
	void AdvanceTimeRequestAvailable(const RTIfedTime &theTime); 
	void InitializeTimeManagement();
	void EnableAsynchronousDelivery();
	void DisableTimeConstrained();
	void DisableTimeRegulation();
	void AdvanceEventRequest(const RTIfedTime &theTime);
	void AdvanceEventRequestAvailable(const RTIfedTime &theTime);
	void FlushQueueRequest(const RTIfedTime &theTime);
	void DisableAsynchronousDelivery();
	void QueryLBTS(RTIfedTime& theTime);
	void QueryFederateTime(RTIfedTime &theTime);
	void ModifyLookahead();
	void QueryLookahead(RTIfedTime &theTime);
	//{{FW_TIME_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>

	//{{FW_OWNERSHIP_MANAGEMENT_SERVICE_DECLARE_BEGIN}} <<----- Don't delete it!>>
	//{{FW_OWNERSHIP_MANAGEMENT_SERVICE_DECLARE_END}} <<----- Don't delete it!>>
};
#endif //FEDERATE_H_
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -