資源簡介
OPNET中應用HLA架構的接口程序代碼,C++編寫

代碼片段和文件信息
/*?External?federate?used?to?test?features?of?HLA-PM?*/
//#include??“stdafx.h“
#include?“controller_tutorial.hpp“
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#if?!defined?(_MSC_VER)
#??include?
#??include??/*?for?sleep?*/
#else
#??include??/*?for?Sleep?*/
#endif
#include?
using?namespace?std;
#include?“s_hla_stream.hpp“
/*?RTI?ambassador?shared?among?the?functions?of?the?program?*/
static?RTI::RTIambassador?rti_amb;
/*?Federate?ambassador?*/
static?Master_FA?fedAmb;
static?int?time_regulation_enabled?=?0;
static?int?time_constrained_enabled?=?0;
static?const?char?*?fedExecName;
static?RTI::Boolean?timeToQuit?=?RTI::RTI_FALSE;
static?RTIfedTime?currentTime?(0.0);
static?RTIfedTime?next_time?()
{?RTIfedTime?lookahead;
??rti_amb.queryLookahead?(lookahead);
??return?currentTime?+?lookahead.getTime?();?}
static?RTI::Boolean?timeAdvanceOutstanding?=?RTI::RTI_FALSE;
static?RTI::FederateHandle?federateId;
//?Interarctions
enum?OrderAttributes?{?Bearing?Speed?NbOrderAttributes?};
enum?ReplyAttributes?{?Id?ChangeLat?ChangeLong?NbReplyAttributes?};
static?const?char?*?const?orderAttrTypeStr?[]?=
{?“bearing“?“speed“?};
static?const?char?*?const?replyAttrTypeStr?[]?=
{?“id“?“change_lat“?“change_long“?};
static?RTI::InteractionClassHandle?order_handle;
static?RTI::ParameterHandle?order_parameters?[NbOrderAttributes];
static?RTI::InteractionClassHandle?reply_handle;
static?RTI::ParameterHandle?reply_parameters?[NbReplyAttributes];
/*******?Pending?Requests?******/
class?PendingRequest
{
public:
PendingRequest?(void)?:?next(NULL)?{}
virtual?~PendingRequest?(void)?{}
//?apply?appropriate?behavior
virtual?void?apply?(void)?=?0;
static?int?empty?()?{?return?head?==?(PendingRequest?*)NULL;?}
static?void?enqueue?(PendingRequest?*?pr);
static?PendingRequest?*?dequeue?();
private:
class?PendingRequest?*?next;
static?PendingRequest?*?head;
static?PendingRequest?*?tail;
friend?class?Master_FA;
};
PendingRequest?*?PendingRequest::head?=?(PendingRequest?*)NULL;
PendingRequest?*?PendingRequest::tail?=?(PendingRequest?*)NULL;
void
PendingRequest::enqueue?(PendingRequest?*?pr)
{
if?(head?==?(PendingRequest?*)NULL)
{
head?=?pr;
tail?=?pr;
}
else
{
tail->next?=?pr;
tail?=?pr;
}
}
PendingRequest?*
PendingRequest::dequeue?()
{
if?(head?==?(PendingRequest?*)NULL)
return?head;
PendingRequest?*?result?=?head;
head?=?head->next;
if?(tail?==?result)
tail?=?head;
return?result;
}
class?ProvideAttributeValueUpdatePR?:?public?PendingRequest
{
public:
ProvideAttributeValueUpdatePR?(RTI::objectHandle?oid
const?RTI::AttributeHandleSet?&?attr);
virtual?~ProvideAttributeValueUpdatePR?(void)
{?if?(size)?delete?[]?handleSet;?}
virtual?void?apply?(void);
private:
RTI::objectHandle?objid;
unsigned?long?size;
RTI::AttributeHandle?*
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????16425??2012-04-24?22:49??OPNET中HLA接口程序\controller_tutorial.cpp
?????文件???????4114??2012-04-24?22:58??OPNET中HLA接口程序\controller_tutorial.dsp
?????文件????????563??2012-04-24?22:58??OPNET中HLA接口程序\controller_tutorial.dsw
?????文件??????10471??2002-01-30?09:01??OPNET中HLA接口程序\controller_tutorial.hpp
?????文件??????58368??2012-04-27?16:00??OPNET中HLA接口程序\controller_tutorial.ncb
?????文件??????54784??2012-04-27?16:00??OPNET中HLA接口程序\controller_tutorial.opt
?????文件???????8826??2012-04-27?16:00??OPNET中HLA接口程序\controller_tutorial.plg
?????文件????1148745??2012-04-27?16:00??OPNET中HLA接口程序\Debug\controller_tutorial.sbr
?????文件??????58368??2012-04-27?16:00??OPNET中HLA接口程序\Debug\vc60.idb
?????文件??????77824??2012-04-27?16:00??OPNET中HLA接口程序\Debug\vc60.pdb
?????文件????????516??2007-10-10?04:44??OPNET中HLA接口程序\HLA_Tutorial-2Planes.ac
?????文件?????????46??2002-01-30?09:02??OPNET中HLA接口程序\HLA_Tutorial-2Planes.cml
?????文件???????9563??2008-06-05?08:01??OPNET中HLA接口程序\HLA_Tutorial-2Planes.nt.m
?????文件????????836??2008-01-17?22:53??OPNET中HLA接口程序\HLA_Tutorial.ef
?????文件???????9780??2002-01-30?09:03??OPNET中HLA接口程序\HLA_Tutorial.fed
?????文件????????306??2002-01-30?09:03??OPNET中HLA接口程序\HLA_Tutorial.map
?????文件????????711??2007-10-10?04:44??OPNET中HLA接口程序\HLA_Tutorial.prj
?????文件???????1098??2007-07-25?06:25??OPNET中HLA接口程序\Makefile
?????文件????????733??2004-12-08?06:45??OPNET中HLA接口程序\make_controller.bat
?????文件????????446??2003-06-12?02:40??OPNET中HLA接口程序\make_sim.bat
?????文件???????1072??2007-10-10?04:44??OPNET中HLA接口程序\Plane.nd.m
?????文件???????4381??2007-10-26?07:16??OPNET中HLA接口程序\Plane.pr.m
?????文件???????1381??2007-10-10?04:44??OPNET中HLA接口程序\Plane_Ack.pk.m
?????文件???????1126??2007-10-10?04:44??OPNET中HLA接口程序\Plane_Order.pk.m
?????文件??????41956??2002-01-30?09:04??OPNET中HLA接口程序\RTI.rid
?????文件??????15511??2006-06-28?21:45??OPNET中HLA接口程序\s_hla_stream.cpp
?????文件???????9394??2006-04-18?01:53??OPNET中HLA接口程序\s_hla_stream.hpp
?????目錄??????????0??2013-08-11?19:51??OPNET中HLA接口程序\Debug
?????目錄??????????0??2013-08-11?19:51??OPNET中HLA接口程序
-----------?---------??----------?-----??----
............此處省略2個文件信息
- 上一篇:15度 有限差分 疊前偏移程序
- 下一篇:C++課程設計選課系統
評論
共有 條評論