类映射文件
类映射文件规则
类映射文件按照下列规则创建。这些规则遵循 BNF 约定(完整的 BNF 约定见“BNF 表示法”第 39 页)。具体而言:
- 粗体记号应按所示形式原样输入。
- 用尖括号括起的记号(
<Type>)应根据相应的 BNF 规则替换为该记号所表示的值。例外是字符串<Tag>,它应按所示形式原样输入。 - 竖线( | )用于表示可供选择的取值。
<MapFile> ::= ( mapping version 2 [<Mapping>]+ )
<Mapping> ::= <TypeDefs> | <ObjectMaps> | <InterMaps>
<TypeDefs> ::= ( types [<TypeDef>]+ )
<TypeDef> ::= ( <Name> [<FieldDefs>]+ )
<FieldDefs> ::= ( attribute <FOM_Name> <OPNET_Name> <Type>)
<Type> ::= <FOM_Type> | <Name>
<FOM_Type> ::= <IntegerType> | <FloatType> |
boolean | string
<IntegerType> ::= short | unsigned_short |
long | unsigned_long |
long_long | unsigned_long_long |
char | octet
<FloatType> ::= float | double
<ObjectMaps> ::= ( objects [<ObjMap>]+ )
<ObjMap> ::= ( class <ObjClass> [<ObjAttr>]+ [<ObjMap>]* )
<ObjClass> ::= <HLAClassName> <OpnetObject> <OpnetMobility> <ClassSet> <Create>
<OpnetObject> ::= node | subnet | all
<OpnetMobility> ::= fixed | mobile | satellite | any
<ClassSet> ::= ( class_set <OpnetObjectMatch> )
<OpnetObjectMatch> ::= ( <AttrName> <Oper> <Value> <OPNET_Type> ) |
(not <OpnetObjectMatch> ) |
( and <OpnetObjectMatch> <OpnetObjectMatch> ) |
( or <OpnetObjectMatch> <OpnetObjectMatch> )
<Oper> ::= == | != | < | <= | > | >= | prefix | contains | suffix
<OPNET_Type> ::= integer | boolean | double | string
<Create> ::= ( creation_mode <CreateMode> )
<CreateMode> ::= create [ <AttrName> <Type> ] |
discover <RTIMatch> |
dynamic <RTIMatch>
<RTIMatch> ::= attr_match <AttrName> |
name_match <AttrName> <Type>
<ObjAttr> ::= ( attribute <HLAName> <AttrName> <Type> <PS> )
<AttrName> ::= <Name> | <Name> [ <Number> ] . <AttrName>
<PS> ::= P | S
<InterMaps> ::= ( interactions [<InterMap>]+ )
<InterMap> ::= ( class <InterClass> [<InterParam>]+ [<InterMap>]* )
<InterClass> ::= <HLAInteractionName> <OPNETPacketName>
<InterParam> ::= ( parameter <HLAParamName> <OPNETFieldName> <HLAParamType> )
<HLAParamName> ::= <Name> | <tag>
<HLAParamType> ::= <IntegerType> | <FloatType> | boolean | structure
类映射文件示例
对象创建类映射文件示例
该文件使用 create 创建模式,应用类映射文件中所示的规则。
( mapping version 2
( types
( Info_Type
( attribute number_units “Number Units” long )
( attribute cost Cost double )
( attribute brand Brand string )
)
)
( objects
( class hla_object node fixed
( class_set ( model == HLA_Object string ) )
( creation_mode create name string )
( attribute update_request “Update Request” long S )
( attribute update_time “Update Time” double P )
( attribute information Information Info_Type P )
)
)
)
对象发现类映射文件示例
该文件使用 dynamic 创建模式,应用类映射文件中所示的规则。
( mapping version 2
( types
( Info_Type
( attribute number_units “Number Units” long )
( attribute cost Cost double )
( attribute brand Brand string )
)
)
( objects
( class hla_object node fixed
( class_set ( model == HLA_Object string ) )
( creation_mode dynamic name_match name string )
( attribute update_request “Update Request” long S )
( attribute update_time “Update Time” double P )
( attribute information Information Info_Type P )
)
)
)
交互类映射文件示例
该文件应用类映射文件中所示的规则。
( mapping version 2
( interactions
( class send_info Send_Info
( parameter number_ids “number ids” long )
( parameter ids ids structure )
)
( class info_reply Info_Reply
( parameter opnet_id “opnet id” long )
( parameter num_elements “num elements” long )
( parameter information information structure )
)
( class stop_listening Stop_Listening
( parameter opnet_id “opnet id” long )
)
)
)