Kbengine type aliases

Source: Internet
Author: User

Script base type
[Name][Size]UINT81UINT162UINT324UINT648INT81INT162INT324INT648FLOAT4DOUBLE8VECTOR212VECTOR316VECTOR420STRINGNUNICODENPYTHONNPY_DICTNPY_TUPLENPY_LISTNMAILBOXNBLOBN
Define a type Alias

Why use type aliases?

    • Developers can understand the meaning of a type more easily

    • You can define complex custom types

    • The engine can automatically identify data types for network transmission and storage

File directory Address:demo/scripts/entity_defs/alias.xml

# # # Simple aliases

<BOOL> UINT8</BOOL><ENTITY_ID>INT32</ENTITY_ID><ENTITY_FORBID_COUNTER> ARRAY <of> INT8</of></ENTITY_FORBID_COUNTER><ENTITYID_LIST> ARRAY <of> ENTITY_ID</of></ENTITYID_LIST>
Defining a fixed dictionary type (fixed_dict)

The data structure can be a structure similar to a Python dictionary, which can be used by the engine to transfer such a structure of information over the network to the destination and revert to the structure, or to the database and restore from the database.

The basic format is as follows:

<类型名称> FIXED_DICT       // (可选实现)       // 使用此模块(xxx.inst)允许用户重定义该数据结构在内存中存在的形式,       // 当引擎进行数据存储或进行网络传输时必须还原成引擎原本的数据结构,引擎才可以识别和进行相关操作。       <implementedBy> xxx.inst </implementedBy>      // 这个数据结构的成员       <Properties>// 字典的key<keyName> // 字典的值<Type> 类型名称 </Type></keyName>       </Properties></类型名称>

About the Implementedby mechanism: see: Custom Types

Example 1:
<AVATAR_INFOS>FIXED_DICT<Properties><dbid><Type>DBID</Type></dbid><name><Type>UNICODE</Type></name><roleType><Type>UINT8</Type></roleType><level><Type>UINT16</Type></level></Properties></AVATAR_INFOS>

The default form in memory:

    AVATAR_INFOS = {"dbid" : 1, "name" : "kbengine", "roleType" : 1, "level" : 0}
Example 2:
<AVATAR_INFOS_LIST>FIXED_DICT<implementedBy>AVATAR_INFOS.inst</implementedBy><Properties><values><Type>ARRAY <of> AVATAR_INFOS </of></Type></values></Properties></AVATAR_INFOS_LIST>

The default form in memory (if Implementedby is not implemented):

    AVATAR_INFOS_LIST = {"values" : [{"dbid" : 1, "name" : "kbengine", "roleType" : 1, "level" : 0}, {"dbid" : 2, "name" : "kbengine1", "roleType" : 2, "level" : 1}]}

If Implementedby is implemented, the user can store it in memory as follows:

    AVATAR_INFOS_LIST = {"kbengine" : {"dbid" : 1, "name" : "kbengine", "roleType" : 1, "level" : 0}, "kbengine1" : {"dbid" : 2, "name" : "kbengine1", "roleType" : 2, "level" : 1}}
Example 3:
<BAG>FIXED_DICT<Properties><values><Type>ARRAY <of> ARRAY <of>INT64 </of> </of></Type></values></Properties></BAG>

The default form in memory (if Implementedby is not implemented):

    BAG = {"values" : [[1,2,3], [4,5,6], [7,8,9]]}

Kbengine type aliases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.