Add scalar type aliases for int8, uint8, ..., f32, f64 (#4400)
* Add type aliases * Add generated code * Rebase master
This commit is contained in:
parent
3282a84e30
commit
f2b3705c2c
|
@ -40,28 +40,29 @@ namespace flatbuffers {
|
|||
// Additionally, Parser::ParseType assumes bool..string is a contiguous range
|
||||
// of type tokens.
|
||||
#define FLATBUFFERS_GEN_TYPES_SCALAR(TD) \
|
||||
TD(NONE, "", uint8_t, byte, byte, byte, uint8) \
|
||||
TD(UTYPE, "", uint8_t, byte, byte, byte, uint8) /* begin scalar/int */ \
|
||||
TD(BOOL, "bool", uint8_t, boolean,byte, bool, bool) \
|
||||
TD(CHAR, "byte", int8_t, byte, int8, sbyte, int8) \
|
||||
TD(UCHAR, "ubyte", uint8_t, byte, byte, byte, uint8) \
|
||||
TD(SHORT, "short", int16_t, short, int16, short, int16) \
|
||||
TD(USHORT, "ushort", uint16_t, short, uint16, ushort, uint16) \
|
||||
TD(INT, "int", int32_t, int, int32, int, int32) \
|
||||
TD(UINT, "uint", uint32_t, int, uint32, uint, uint32) \
|
||||
TD(LONG, "long", int64_t, long, int64, long, int64) \
|
||||
TD(ULONG, "ulong", uint64_t, long, uint64, ulong, uint64) /* end int */ \
|
||||
TD(FLOAT, "float", float, float, float32, float, float32) /* begin float */ \
|
||||
TD(DOUBLE, "double", double, double, float64, double, float64) /* end float/scalar */
|
||||
TD(NONE, "", "", uint8_t, byte, byte, byte, uint8) \
|
||||
TD(UTYPE, "", "", uint8_t, byte, byte, byte, uint8) /* begin scalar/int */ \
|
||||
TD(BOOL, "bool", "", uint8_t, boolean,byte, bool, bool) \
|
||||
TD(CHAR, "byte", "int8", int8_t, byte, int8, sbyte, int8) \
|
||||
TD(UCHAR, "ubyte", "uint8", uint8_t, byte, byte, byte, uint8) \
|
||||
TD(SHORT, "short", "int16", int16_t, short, int16, short, int16) \
|
||||
TD(USHORT, "ushort", "uint16", uint16_t, short, uint16, ushort, uint16) \
|
||||
TD(INT, "int", "int32", int32_t, int, int32, int, int32) \
|
||||
TD(UINT, "uint", "uint32", uint32_t, int, uint32, uint, uint32) \
|
||||
TD(LONG, "long", "int64", int64_t, long, int64, long, int64) \
|
||||
TD(ULONG, "ulong", "uint64", uint64_t, long, uint64, ulong, uint64) /* end int */ \
|
||||
TD(FLOAT, "float", "float32", float, float, float32, float, float32) /* begin float */ \
|
||||
TD(DOUBLE, "double", "float64", double, double, float64, double, float64) /* end float/scalar */
|
||||
#define FLATBUFFERS_GEN_TYPES_POINTER(TD) \
|
||||
TD(STRING, "string", Offset<void>, int, int, StringOffset, int) \
|
||||
TD(VECTOR, "", Offset<void>, int, int, VectorOffset, int) \
|
||||
TD(STRUCT, "", Offset<void>, int, int, int, int) \
|
||||
TD(UNION, "", Offset<void>, int, int, int, int)
|
||||
TD(STRING, "string", "", Offset<void>, int, int, StringOffset, int) \
|
||||
TD(VECTOR, "", "", Offset<void>, int, int, VectorOffset, int) \
|
||||
TD(STRUCT, "", "", Offset<void>, int, int, int, int) \
|
||||
TD(UNION, "", "", Offset<void>, int, int, int, int)
|
||||
|
||||
// The fields are:
|
||||
// - enum
|
||||
// - FlatBuffers schema type.
|
||||
// - FlatBuffers schema alias type.
|
||||
// - C++ type.
|
||||
// - Java type.
|
||||
// - Go type.
|
||||
|
@ -72,7 +73,7 @@ namespace flatbuffers {
|
|||
|
||||
/*
|
||||
switch (type) {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
// do something specific to CTYPE here
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
|
@ -89,13 +90,13 @@ switch (type) {
|
|||
__extension__ // Stop GCC complaining about trailing comma with -Wpendantic.
|
||||
#endif
|
||||
enum BaseType {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
BASE_TYPE_ ## ENUM,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
};
|
||||
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
static_assert(sizeof(CTYPE) <= sizeof(largest_scalar_t), \
|
||||
"define largest_scalar_t as " #CTYPE);
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
|
|
|
@ -302,7 +302,7 @@ class CppGenerator : public BaseGenerator {
|
|||
// Return a C++ type from the table in idl.h
|
||||
std::string GenTypeBasic(const Type &type, bool user_facing_type) const {
|
||||
static const char *ctypename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#CTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -241,14 +241,16 @@ static bool IsEnum(const Type& type) {
|
|||
|
||||
std::string GenTypeBasic(const Type &type, bool enableLangOverrides) {
|
||||
static const char *java_typename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#JTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
};
|
||||
|
||||
static const char *csharp_typename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#NTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -694,7 +694,8 @@ static std::string GenMethod(const FieldDef &field) {
|
|||
|
||||
static std::string GenTypeBasic(const Type &type) {
|
||||
static const char *ctypename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#GTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -879,7 +879,8 @@ namespace php {
|
|||
|
||||
static std::string GenTypeBasic(const Type &type) {
|
||||
static const char *ctypename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#NTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -580,7 +580,8 @@ static std::string GenMethod(const FieldDef &field) {
|
|||
|
||||
static std::string GenTypeBasic(const Type &type) {
|
||||
static const char *ctypename[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#PTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -135,8 +135,8 @@ template<> bool Print<const void *>(const void *val,
|
|||
type = type.VectorType();
|
||||
// Call PrintVector above specifically for each element type:
|
||||
switch (type.base_type) {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
if (!PrintVector<CTYPE>( \
|
||||
*reinterpret_cast<const Vector<CTYPE> *>(val), \
|
||||
|
@ -226,8 +226,8 @@ static bool GenStruct(const StructDef &struct_def, const Table *table,
|
|||
text += " ";
|
||||
if (is_present) {
|
||||
switch (fd.value.type.base_type) {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
if (!GenField<CTYPE>(fd, table, struct_def.fixed, \
|
||||
opts, indent + Indent(opts), _text)) { \
|
||||
|
@ -237,8 +237,8 @@ static bool GenStruct(const StructDef &struct_def, const Table *table,
|
|||
FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
// Generate drop-thru case statements for all pointer types:
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM:
|
||||
FLATBUFFERS_GEN_TYPES_POINTER(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
|
|
@ -32,7 +32,8 @@
|
|||
namespace flatbuffers {
|
||||
|
||||
const char *const kTypeNames[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
IDLTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
@ -40,7 +41,8 @@ const char *const kTypeNames[] = {
|
|||
};
|
||||
|
||||
const char kTypeSizes[] = {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
sizeof(CTYPE),
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
@ -193,7 +195,8 @@ enum {
|
|||
#define FLATBUFFERS_TOKEN(NAME, VALUE, STRING) kToken ## NAME = VALUE,
|
||||
FLATBUFFERS_GEN_TOKENS(FLATBUFFERS_TOKEN)
|
||||
#undef FLATBUFFERS_TOKEN
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
kToken ## ENUM,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
@ -204,7 +207,8 @@ static std::string TokenToString(int t) {
|
|||
#define FLATBUFFERS_TOKEN(NAME, VALUE, STRING) STRING,
|
||||
FLATBUFFERS_GEN_TOKENS(FLATBUFFERS_TOKEN)
|
||||
#undef FLATBUFFERS_TOKEN
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
IDLTYPE,
|
||||
FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD)
|
||||
#undef FLATBUFFERS_TD
|
||||
|
@ -379,9 +383,9 @@ CheckedError Parser::Next() {
|
|||
cursor_++;
|
||||
attribute_.append(start, cursor_);
|
||||
// First, see if it is a type keyword from the table of types:
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
if (attribute_ == IDLTYPE) { \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
if (attribute_ == IDLTYPE || attribute_ == ALIASTYPE) { \
|
||||
token_ = kToken ## ENUM; \
|
||||
return NoError(); \
|
||||
}
|
||||
|
@ -1013,8 +1017,8 @@ CheckedError Parser::ParseTable(const StructDef &struct_def, std::string *value,
|
|||
if (!struct_def.sortbysize ||
|
||||
size == SizeOf(field_value.type.base_type)) {
|
||||
switch (field_value.type.base_type) {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
builder_.Pad(field->padding); \
|
||||
if (struct_def.fixed) { \
|
||||
|
@ -1030,8 +1034,8 @@ CheckedError Parser::ParseTable(const StructDef &struct_def, std::string *value,
|
|||
break;
|
||||
FLATBUFFERS_GEN_TYPES_SCALAR(FLATBUFFERS_TD);
|
||||
#undef FLATBUFFERS_TD
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, \
|
||||
PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
builder_.Pad(field->padding); \
|
||||
if (IsStruct(field->value.type)) { \
|
||||
|
@ -1107,7 +1111,8 @@ CheckedError Parser::ParseVector(const Type &type, uoffset_t *ovalue) {
|
|||
// start at the back, since we're building the data backwards.
|
||||
auto &val = field_stack_.back().first;
|
||||
switch (val.type.base_type) {
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
#define FLATBUFFERS_TD(ENUM, IDLTYPE, ALIASTYPE, \
|
||||
CTYPE, JTYPE, GTYPE, NTYPE, PTYPE) \
|
||||
case BASE_TYPE_ ## ENUM: \
|
||||
if (IsStruct(val.type)) SerializeStruct(*val.type.struct_def, val); \
|
||||
else { \
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
// <auto-generated>
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
// </auto-generated>
|
||||
|
||||
namespace MyGame.Example
|
||||
{
|
||||
|
||||
using global::System;
|
||||
using global::FlatBuffers;
|
||||
|
||||
public struct TypeAliases : IFlatbufferObject
|
||||
{
|
||||
private Table __p;
|
||||
public ByteBuffer ByteBuffer { get { return __p.bb; } }
|
||||
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb) { return GetRootAsTypeAliases(_bb, new TypeAliases()); }
|
||||
public static TypeAliases GetRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
|
||||
public TypeAliases __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public sbyte I8 { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetSbyte(o + __p.bb_pos) : (sbyte)0; } }
|
||||
public bool MutateI8(sbyte i8) { int o = __p.__offset(4); if (o != 0) { __p.bb.PutSbyte(o + __p.bb_pos, i8); return true; } else { return false; } }
|
||||
public byte U8 { get { int o = __p.__offset(6); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
|
||||
public bool MutateU8(byte u8) { int o = __p.__offset(6); if (o != 0) { __p.bb.Put(o + __p.bb_pos, u8); return true; } else { return false; } }
|
||||
public short I16 { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetShort(o + __p.bb_pos) : (short)0; } }
|
||||
public bool MutateI16(short i16) { int o = __p.__offset(8); if (o != 0) { __p.bb.PutShort(o + __p.bb_pos, i16); return true; } else { return false; } }
|
||||
public ushort U16 { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUshort(o + __p.bb_pos) : (ushort)0; } }
|
||||
public bool MutateU16(ushort u16) { int o = __p.__offset(10); if (o != 0) { __p.bb.PutUshort(o + __p.bb_pos, u16); return true; } else { return false; } }
|
||||
public int I32 { get { int o = __p.__offset(12); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
|
||||
public bool MutateI32(int i32) { int o = __p.__offset(12); if (o != 0) { __p.bb.PutInt(o + __p.bb_pos, i32); return true; } else { return false; } }
|
||||
public uint U32 { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetUint(o + __p.bb_pos) : (uint)0; } }
|
||||
public bool MutateU32(uint u32) { int o = __p.__offset(14); if (o != 0) { __p.bb.PutUint(o + __p.bb_pos, u32); return true; } else { return false; } }
|
||||
public long I64 { get { int o = __p.__offset(16); return o != 0 ? __p.bb.GetLong(o + __p.bb_pos) : (long)0; } }
|
||||
public bool MutateI64(long i64) { int o = __p.__offset(16); if (o != 0) { __p.bb.PutLong(o + __p.bb_pos, i64); return true; } else { return false; } }
|
||||
public ulong U64 { get { int o = __p.__offset(18); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } }
|
||||
public bool MutateU64(ulong u64) { int o = __p.__offset(18); if (o != 0) { __p.bb.PutUlong(o + __p.bb_pos, u64); return true; } else { return false; } }
|
||||
public float F32 { get { int o = __p.__offset(20); return o != 0 ? __p.bb.GetFloat(o + __p.bb_pos) : (float)0.0f; } }
|
||||
public bool MutateF32(float f32) { int o = __p.__offset(20); if (o != 0) { __p.bb.PutFloat(o + __p.bb_pos, f32); return true; } else { return false; } }
|
||||
public double F64 { get { int o = __p.__offset(22); return o != 0 ? __p.bb.GetDouble(o + __p.bb_pos) : (double)0.0; } }
|
||||
public bool MutateF64(double f64) { int o = __p.__offset(22); if (o != 0) { __p.bb.PutDouble(o + __p.bb_pos, f64); return true; } else { return false; } }
|
||||
public sbyte V8(int j) { int o = __p.__offset(24); return o != 0 ? __p.bb.GetSbyte(__p.__vector(o) + j * 1) : (sbyte)0; }
|
||||
public int V8Length { get { int o = __p.__offset(24); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
public ArraySegment<byte>? GetV8Bytes() { return __p.__vector_as_arraysegment(24); }
|
||||
public bool MutateV8(int j, sbyte v8) { int o = __p.__offset(24); if (o != 0) { __p.bb.PutSbyte(__p.__vector(o) + j * 1, v8); return true; } else { return false; } }
|
||||
public double Vf64(int j) { int o = __p.__offset(26); return o != 0 ? __p.bb.GetDouble(__p.__vector(o) + j * 8) : (double)0; }
|
||||
public int Vf64Length { get { int o = __p.__offset(26); return o != 0 ? __p.__vector_len(o) : 0; } }
|
||||
public ArraySegment<byte>? GetVf64Bytes() { return __p.__vector_as_arraysegment(26); }
|
||||
public bool MutateVf64(int j, double vf64) { int o = __p.__offset(26); if (o != 0) { __p.bb.PutDouble(__p.__vector(o) + j * 8, vf64); return true; } else { return false; } }
|
||||
|
||||
public static Offset<TypeAliases> CreateTypeAliases(FlatBufferBuilder builder,
|
||||
sbyte i8 = 0,
|
||||
byte u8 = 0,
|
||||
short i16 = 0,
|
||||
ushort u16 = 0,
|
||||
int i32 = 0,
|
||||
uint u32 = 0,
|
||||
long i64 = 0,
|
||||
ulong u64 = 0,
|
||||
float f32 = 0.0f,
|
||||
double f64 = 0.0,
|
||||
VectorOffset v8Offset = default(VectorOffset),
|
||||
VectorOffset vf64Offset = default(VectorOffset)) {
|
||||
builder.StartObject(12);
|
||||
TypeAliases.AddF64(builder, f64);
|
||||
TypeAliases.AddU64(builder, u64);
|
||||
TypeAliases.AddI64(builder, i64);
|
||||
TypeAliases.AddVf64(builder, vf64Offset);
|
||||
TypeAliases.AddV8(builder, v8Offset);
|
||||
TypeAliases.AddF32(builder, f32);
|
||||
TypeAliases.AddU32(builder, u32);
|
||||
TypeAliases.AddI32(builder, i32);
|
||||
TypeAliases.AddU16(builder, u16);
|
||||
TypeAliases.AddI16(builder, i16);
|
||||
TypeAliases.AddU8(builder, u8);
|
||||
TypeAliases.AddI8(builder, i8);
|
||||
return TypeAliases.EndTypeAliases(builder);
|
||||
}
|
||||
|
||||
public static void StartTypeAliases(FlatBufferBuilder builder) { builder.StartObject(12); }
|
||||
public static void AddI8(FlatBufferBuilder builder, sbyte i8) { builder.AddSbyte(0, i8, 0); }
|
||||
public static void AddU8(FlatBufferBuilder builder, byte u8) { builder.AddByte(1, u8, 0); }
|
||||
public static void AddI16(FlatBufferBuilder builder, short i16) { builder.AddShort(2, i16, 0); }
|
||||
public static void AddU16(FlatBufferBuilder builder, ushort u16) { builder.AddUshort(3, u16, 0); }
|
||||
public static void AddI32(FlatBufferBuilder builder, int i32) { builder.AddInt(4, i32, 0); }
|
||||
public static void AddU32(FlatBufferBuilder builder, uint u32) { builder.AddUint(5, u32, 0); }
|
||||
public static void AddI64(FlatBufferBuilder builder, long i64) { builder.AddLong(6, i64, 0); }
|
||||
public static void AddU64(FlatBufferBuilder builder, ulong u64) { builder.AddUlong(7, u64, 0); }
|
||||
public static void AddF32(FlatBufferBuilder builder, float f32) { builder.AddFloat(8, f32, 0.0f); }
|
||||
public static void AddF64(FlatBufferBuilder builder, double f64) { builder.AddDouble(9, f64, 0.0); }
|
||||
public static void AddV8(FlatBufferBuilder builder, VectorOffset v8Offset) { builder.AddOffset(10, v8Offset.Value, 0); }
|
||||
public static VectorOffset CreateV8Vector(FlatBufferBuilder builder, sbyte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddSbyte(data[i]); return builder.EndVector(); }
|
||||
public static void StartV8Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
|
||||
public static void AddVf64(FlatBufferBuilder builder, VectorOffset vf64Offset) { builder.AddOffset(11, vf64Offset.Value, 0); }
|
||||
public static VectorOffset CreateVf64Vector(FlatBufferBuilder builder, double[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddDouble(data[i]); return builder.EndVector(); }
|
||||
public static void StartVf64Vector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
|
||||
public static Offset<TypeAliases> EndTypeAliases(FlatBufferBuilder builder) {
|
||||
int o = builder.EndObject();
|
||||
return new Offset<TypeAliases>(o);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package Example
|
||||
|
||||
import (
|
||||
flatbuffers "github.com/google/flatbuffers/go"
|
||||
)
|
||||
|
||||
type TypeAliases struct {
|
||||
_tab flatbuffers.Table
|
||||
}
|
||||
|
||||
func GetRootAsTypeAliases(buf []byte, offset flatbuffers.UOffsetT) *TypeAliases {
|
||||
n := flatbuffers.GetUOffsetT(buf[offset:])
|
||||
x := &TypeAliases{}
|
||||
x.Init(buf, n+offset)
|
||||
return x
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Bytes = buf
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) Table() flatbuffers.Table {
|
||||
return rcv._tab
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) I8() int8 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt8(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateI8(n int8) bool {
|
||||
return rcv._tab.MutateInt8Slot(4, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) U8() byte {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetByte(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateU8(n byte) bool {
|
||||
return rcv._tab.MutateByteSlot(6, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) I16() int16 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt16(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateI16(n int16) bool {
|
||||
return rcv._tab.MutateInt16Slot(8, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) U16() uint16 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetUint16(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateU16(n uint16) bool {
|
||||
return rcv._tab.MutateUint16Slot(10, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) I32() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateI32(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(12, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) U32() uint32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetUint32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateU32(n uint32) bool {
|
||||
return rcv._tab.MutateUint32Slot(14, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) I64() int64 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt64(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateI64(n int64) bool {
|
||||
return rcv._tab.MutateInt64Slot(16, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) U64() uint64 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetUint64(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateU64(n uint64) bool {
|
||||
return rcv._tab.MutateUint64Slot(18, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) F32() float32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetFloat32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateF32(n float32) bool {
|
||||
return rcv._tab.MutateFloat32Slot(20, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) F64() float64 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(22))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetFloat64(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) MutateF64(n float64) bool {
|
||||
return rcv._tab.MutateFloat64Slot(22, n)
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) V8(j int) int8 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(24))
|
||||
if o != 0 {
|
||||
a := rcv._tab.Vector(o)
|
||||
return rcv._tab.GetInt8(a + flatbuffers.UOffsetT(j*1))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) V8Length() int {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(24))
|
||||
if o != 0 {
|
||||
return rcv._tab.VectorLen(o)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) Vf64(j int) float64 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(26))
|
||||
if o != 0 {
|
||||
a := rcv._tab.Vector(o)
|
||||
return rcv._tab.GetFloat64(a + flatbuffers.UOffsetT(j*8))
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *TypeAliases) Vf64Length() int {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(26))
|
||||
if o != 0 {
|
||||
return rcv._tab.VectorLen(o)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func TypeAliasesStart(builder *flatbuffers.Builder) {
|
||||
builder.StartObject(12)
|
||||
}
|
||||
func TypeAliasesAddI8(builder *flatbuffers.Builder, i8 int8) {
|
||||
builder.PrependInt8Slot(0, i8, 0)
|
||||
}
|
||||
func TypeAliasesAddU8(builder *flatbuffers.Builder, u8 byte) {
|
||||
builder.PrependByteSlot(1, u8, 0)
|
||||
}
|
||||
func TypeAliasesAddI16(builder *flatbuffers.Builder, i16 int16) {
|
||||
builder.PrependInt16Slot(2, i16, 0)
|
||||
}
|
||||
func TypeAliasesAddU16(builder *flatbuffers.Builder, u16 uint16) {
|
||||
builder.PrependUint16Slot(3, u16, 0)
|
||||
}
|
||||
func TypeAliasesAddI32(builder *flatbuffers.Builder, i32 int32) {
|
||||
builder.PrependInt32Slot(4, i32, 0)
|
||||
}
|
||||
func TypeAliasesAddU32(builder *flatbuffers.Builder, u32 uint32) {
|
||||
builder.PrependUint32Slot(5, u32, 0)
|
||||
}
|
||||
func TypeAliasesAddI64(builder *flatbuffers.Builder, i64 int64) {
|
||||
builder.PrependInt64Slot(6, i64, 0)
|
||||
}
|
||||
func TypeAliasesAddU64(builder *flatbuffers.Builder, u64 uint64) {
|
||||
builder.PrependUint64Slot(7, u64, 0)
|
||||
}
|
||||
func TypeAliasesAddF32(builder *flatbuffers.Builder, f32 float32) {
|
||||
builder.PrependFloat32Slot(8, f32, 0.0)
|
||||
}
|
||||
func TypeAliasesAddF64(builder *flatbuffers.Builder, f64 float64) {
|
||||
builder.PrependFloat64Slot(9, f64, 0.0)
|
||||
}
|
||||
func TypeAliasesAddV8(builder *flatbuffers.Builder, v8 flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(10, flatbuffers.UOffsetT(v8), 0)
|
||||
}
|
||||
func TypeAliasesStartV8Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
|
||||
return builder.StartVector(1, numElems, 1)
|
||||
}
|
||||
func TypeAliasesAddVf64(builder *flatbuffers.Builder, vf64 flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(11, flatbuffers.UOffsetT(vf64), 0)
|
||||
}
|
||||
func TypeAliasesStartVf64Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
|
||||
return builder.StartVector(8, numElems, 8)
|
||||
}
|
||||
func TypeAliasesEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
|
||||
return builder.EndObject()
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
package MyGame.Example;
|
||||
|
||||
import java.nio.*;
|
||||
import java.lang.*;
|
||||
import java.util.*;
|
||||
import com.google.flatbuffers.*;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class TypeAliases extends Table {
|
||||
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb) { return getRootAsTypeAliases(_bb, new TypeAliases()); }
|
||||
public static TypeAliases getRootAsTypeAliases(ByteBuffer _bb, TypeAliases obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }
|
||||
public void __init(int _i, ByteBuffer _bb) { bb_pos = _i; bb = _bb; }
|
||||
public TypeAliases __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
|
||||
|
||||
public byte i8() { int o = __offset(4); return o != 0 ? bb.get(o + bb_pos) : 0; }
|
||||
public boolean mutateI8(byte i8) { int o = __offset(4); if (o != 0) { bb.put(o + bb_pos, i8); return true; } else { return false; } }
|
||||
public int u8() { int o = __offset(6); return o != 0 ? bb.get(o + bb_pos) & 0xFF : 0; }
|
||||
public boolean mutateU8(int u8) { int o = __offset(6); if (o != 0) { bb.put(o + bb_pos, (byte)u8); return true; } else { return false; } }
|
||||
public short i16() { int o = __offset(8); return o != 0 ? bb.getShort(o + bb_pos) : 0; }
|
||||
public boolean mutateI16(short i16) { int o = __offset(8); if (o != 0) { bb.putShort(o + bb_pos, i16); return true; } else { return false; } }
|
||||
public int u16() { int o = __offset(10); return o != 0 ? bb.getShort(o + bb_pos) & 0xFFFF : 0; }
|
||||
public boolean mutateU16(int u16) { int o = __offset(10); if (o != 0) { bb.putShort(o + bb_pos, (short)u16); return true; } else { return false; } }
|
||||
public int i32() { int o = __offset(12); return o != 0 ? bb.getInt(o + bb_pos) : 0; }
|
||||
public boolean mutateI32(int i32) { int o = __offset(12); if (o != 0) { bb.putInt(o + bb_pos, i32); return true; } else { return false; } }
|
||||
public long u32() { int o = __offset(14); return o != 0 ? (long)bb.getInt(o + bb_pos) & 0xFFFFFFFFL : 0L; }
|
||||
public boolean mutateU32(long u32) { int o = __offset(14); if (o != 0) { bb.putInt(o + bb_pos, (int)u32); return true; } else { return false; } }
|
||||
public long i64() { int o = __offset(16); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateI64(long i64) { int o = __offset(16); if (o != 0) { bb.putLong(o + bb_pos, i64); return true; } else { return false; } }
|
||||
public long u64() { int o = __offset(18); return o != 0 ? bb.getLong(o + bb_pos) : 0L; }
|
||||
public boolean mutateU64(long u64) { int o = __offset(18); if (o != 0) { bb.putLong(o + bb_pos, u64); return true; } else { return false; } }
|
||||
public float f32() { int o = __offset(20); return o != 0 ? bb.getFloat(o + bb_pos) : 0.0f; }
|
||||
public boolean mutateF32(float f32) { int o = __offset(20); if (o != 0) { bb.putFloat(o + bb_pos, f32); return true; } else { return false; } }
|
||||
public double f64() { int o = __offset(22); return o != 0 ? bb.getDouble(o + bb_pos) : 0.0; }
|
||||
public boolean mutateF64(double f64) { int o = __offset(22); if (o != 0) { bb.putDouble(o + bb_pos, f64); return true; } else { return false; } }
|
||||
public byte v8(int j) { int o = __offset(24); return o != 0 ? bb.get(__vector(o) + j * 1) : 0; }
|
||||
public int v8Length() { int o = __offset(24); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteBuffer v8AsByteBuffer() { return __vector_as_bytebuffer(24, 1); }
|
||||
public boolean mutateV8(int j, byte v8) { int o = __offset(24); if (o != 0) { bb.put(__vector(o) + j * 1, v8); return true; } else { return false; } }
|
||||
public double vf64(int j) { int o = __offset(26); return o != 0 ? bb.getDouble(__vector(o) + j * 8) : 0; }
|
||||
public int vf64Length() { int o = __offset(26); return o != 0 ? __vector_len(o) : 0; }
|
||||
public ByteBuffer vf64AsByteBuffer() { return __vector_as_bytebuffer(26, 8); }
|
||||
public boolean mutateVf64(int j, double vf64) { int o = __offset(26); if (o != 0) { bb.putDouble(__vector(o) + j * 8, vf64); return true; } else { return false; } }
|
||||
|
||||
public static int createTypeAliases(FlatBufferBuilder builder,
|
||||
byte i8,
|
||||
int u8,
|
||||
short i16,
|
||||
int u16,
|
||||
int i32,
|
||||
long u32,
|
||||
long i64,
|
||||
long u64,
|
||||
float f32,
|
||||
double f64,
|
||||
int v8Offset,
|
||||
int vf64Offset) {
|
||||
builder.startObject(12);
|
||||
TypeAliases.addF64(builder, f64);
|
||||
TypeAliases.addU64(builder, u64);
|
||||
TypeAliases.addI64(builder, i64);
|
||||
TypeAliases.addVf64(builder, vf64Offset);
|
||||
TypeAliases.addV8(builder, v8Offset);
|
||||
TypeAliases.addF32(builder, f32);
|
||||
TypeAliases.addU32(builder, u32);
|
||||
TypeAliases.addI32(builder, i32);
|
||||
TypeAliases.addU16(builder, u16);
|
||||
TypeAliases.addI16(builder, i16);
|
||||
TypeAliases.addU8(builder, u8);
|
||||
TypeAliases.addI8(builder, i8);
|
||||
return TypeAliases.endTypeAliases(builder);
|
||||
}
|
||||
|
||||
public static void startTypeAliases(FlatBufferBuilder builder) { builder.startObject(12); }
|
||||
public static void addI8(FlatBufferBuilder builder, byte i8) { builder.addByte(0, i8, 0); }
|
||||
public static void addU8(FlatBufferBuilder builder, int u8) { builder.addByte(1, (byte)u8, (byte)0); }
|
||||
public static void addI16(FlatBufferBuilder builder, short i16) { builder.addShort(2, i16, 0); }
|
||||
public static void addU16(FlatBufferBuilder builder, int u16) { builder.addShort(3, (short)u16, (short)0); }
|
||||
public static void addI32(FlatBufferBuilder builder, int i32) { builder.addInt(4, i32, 0); }
|
||||
public static void addU32(FlatBufferBuilder builder, long u32) { builder.addInt(5, (int)u32, (int)0L); }
|
||||
public static void addI64(FlatBufferBuilder builder, long i64) { builder.addLong(6, i64, 0L); }
|
||||
public static void addU64(FlatBufferBuilder builder, long u64) { builder.addLong(7, u64, 0L); }
|
||||
public static void addF32(FlatBufferBuilder builder, float f32) { builder.addFloat(8, f32, 0.0f); }
|
||||
public static void addF64(FlatBufferBuilder builder, double f64) { builder.addDouble(9, f64, 0.0); }
|
||||
public static void addV8(FlatBufferBuilder builder, int v8Offset) { builder.addOffset(10, v8Offset, 0); }
|
||||
public static int createV8Vector(FlatBufferBuilder builder, byte[] data) { builder.startVector(1, data.length, 1); for (int i = data.length - 1; i >= 0; i--) builder.addByte(data[i]); return builder.endVector(); }
|
||||
public static void startV8Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(1, numElems, 1); }
|
||||
public static void addVf64(FlatBufferBuilder builder, int vf64Offset) { builder.addOffset(11, vf64Offset, 0); }
|
||||
public static int createVf64Vector(FlatBufferBuilder builder, double[] data) { builder.startVector(8, data.length, 8); for (int i = data.length - 1; i >= 0; i--) builder.addDouble(data[i]); return builder.endVector(); }
|
||||
public static void startVf64Vector(FlatBufferBuilder builder, int numElems) { builder.startVector(8, numElems, 8); }
|
||||
public static int endTypeAliases(FlatBufferBuilder builder) {
|
||||
int o = builder.endObject();
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,387 @@
|
|||
<?php
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
namespace MyGame\Example;
|
||||
|
||||
use \Google\FlatBuffers\Struct;
|
||||
use \Google\FlatBuffers\Table;
|
||||
use \Google\FlatBuffers\ByteBuffer;
|
||||
use \Google\FlatBuffers\FlatBufferBuilder;
|
||||
|
||||
class TypeAliases extends Table
|
||||
{
|
||||
/**
|
||||
* @param ByteBuffer $bb
|
||||
* @return TypeAliases
|
||||
*/
|
||||
public static function getRootAsTypeAliases(ByteBuffer $bb)
|
||||
{
|
||||
$obj = new TypeAliases();
|
||||
return ($obj->init($bb->getInt($bb->getPosition()) + $bb->getPosition(), $bb));
|
||||
}
|
||||
|
||||
public static function TypeAliasesIdentifier()
|
||||
{
|
||||
return "MONS";
|
||||
}
|
||||
|
||||
public static function TypeAliasesBufferHasIdentifier(ByteBuffer $buf)
|
||||
{
|
||||
return self::__has_identifier($buf, self::TypeAliasesIdentifier());
|
||||
}
|
||||
|
||||
public static function TypeAliasesExtension()
|
||||
{
|
||||
return "mon";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $_i offset
|
||||
* @param ByteBuffer $_bb
|
||||
* @return TypeAliases
|
||||
**/
|
||||
public function init($_i, ByteBuffer $_bb)
|
||||
{
|
||||
$this->bb_pos = $_i;
|
||||
$this->bb = $_bb;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return sbyte
|
||||
*/
|
||||
public function getI8()
|
||||
{
|
||||
$o = $this->__offset(4);
|
||||
return $o != 0 ? $this->bb->getSbyte($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return byte
|
||||
*/
|
||||
public function getU8()
|
||||
{
|
||||
$o = $this->__offset(6);
|
||||
return $o != 0 ? $this->bb->getByte($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return short
|
||||
*/
|
||||
public function getI16()
|
||||
{
|
||||
$o = $this->__offset(8);
|
||||
return $o != 0 ? $this->bb->getShort($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ushort
|
||||
*/
|
||||
public function getU16()
|
||||
{
|
||||
$o = $this->__offset(10);
|
||||
return $o != 0 ? $this->bb->getUshort($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getI32()
|
||||
{
|
||||
$o = $this->__offset(12);
|
||||
return $o != 0 ? $this->bb->getInt($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return uint
|
||||
*/
|
||||
public function getU32()
|
||||
{
|
||||
$o = $this->__offset(14);
|
||||
return $o != 0 ? $this->bb->getUint($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return long
|
||||
*/
|
||||
public function getI64()
|
||||
{
|
||||
$o = $this->__offset(16);
|
||||
return $o != 0 ? $this->bb->getLong($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ulong
|
||||
*/
|
||||
public function getU64()
|
||||
{
|
||||
$o = $this->__offset(18);
|
||||
return $o != 0 ? $this->bb->getUlong($o + $this->bb_pos) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getF32()
|
||||
{
|
||||
$o = $this->__offset(20);
|
||||
return $o != 0 ? $this->bb->getFloat($o + $this->bb_pos) : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return double
|
||||
*/
|
||||
public function getF64()
|
||||
{
|
||||
$o = $this->__offset(22);
|
||||
return $o != 0 ? $this->bb->getDouble($o + $this->bb_pos) : 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int offset
|
||||
* @return sbyte
|
||||
*/
|
||||
public function getV8($j)
|
||||
{
|
||||
$o = $this->__offset(24);
|
||||
return $o != 0 ? $this->bb->getSbyte($this->__vector($o) + $j * 1) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getV8Length()
|
||||
{
|
||||
$o = $this->__offset(24);
|
||||
return $o != 0 ? $this->__vector_len($o) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int offset
|
||||
* @return double
|
||||
*/
|
||||
public function getVf64($j)
|
||||
{
|
||||
$o = $this->__offset(26);
|
||||
return $o != 0 ? $this->bb->getDouble($this->__vector($o) + $j * 8) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getVf64Length()
|
||||
{
|
||||
$o = $this->__offset(26);
|
||||
return $o != 0 ? $this->__vector_len($o) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return void
|
||||
*/
|
||||
public static function startTypeAliases(FlatBufferBuilder $builder)
|
||||
{
|
||||
$builder->StartObject(12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return TypeAliases
|
||||
*/
|
||||
public static function createTypeAliases(FlatBufferBuilder $builder, $i8, $u8, $i16, $u16, $i32, $u32, $i64, $u64, $f32, $f64, $v8, $vf64)
|
||||
{
|
||||
$builder->startObject(12);
|
||||
self::addI8($builder, $i8);
|
||||
self::addU8($builder, $u8);
|
||||
self::addI16($builder, $i16);
|
||||
self::addU16($builder, $u16);
|
||||
self::addI32($builder, $i32);
|
||||
self::addU32($builder, $u32);
|
||||
self::addI64($builder, $i64);
|
||||
self::addU64($builder, $u64);
|
||||
self::addF32($builder, $f32);
|
||||
self::addF64($builder, $f64);
|
||||
self::addV8($builder, $v8);
|
||||
self::addVf64($builder, $vf64);
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param sbyte
|
||||
* @return void
|
||||
*/
|
||||
public static function addI8(FlatBufferBuilder $builder, $i8)
|
||||
{
|
||||
$builder->addSbyteX(0, $i8, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param byte
|
||||
* @return void
|
||||
*/
|
||||
public static function addU8(FlatBufferBuilder $builder, $u8)
|
||||
{
|
||||
$builder->addByteX(1, $u8, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param short
|
||||
* @return void
|
||||
*/
|
||||
public static function addI16(FlatBufferBuilder $builder, $i16)
|
||||
{
|
||||
$builder->addShortX(2, $i16, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param ushort
|
||||
* @return void
|
||||
*/
|
||||
public static function addU16(FlatBufferBuilder $builder, $u16)
|
||||
{
|
||||
$builder->addUshortX(3, $u16, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int
|
||||
* @return void
|
||||
*/
|
||||
public static function addI32(FlatBufferBuilder $builder, $i32)
|
||||
{
|
||||
$builder->addIntX(4, $i32, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param uint
|
||||
* @return void
|
||||
*/
|
||||
public static function addU32(FlatBufferBuilder $builder, $u32)
|
||||
{
|
||||
$builder->addUintX(5, $u32, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param long
|
||||
* @return void
|
||||
*/
|
||||
public static function addI64(FlatBufferBuilder $builder, $i64)
|
||||
{
|
||||
$builder->addLongX(6, $i64, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param ulong
|
||||
* @return void
|
||||
*/
|
||||
public static function addU64(FlatBufferBuilder $builder, $u64)
|
||||
{
|
||||
$builder->addUlongX(7, $u64, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param float
|
||||
* @return void
|
||||
*/
|
||||
public static function addF32(FlatBufferBuilder $builder, $f32)
|
||||
{
|
||||
$builder->addFloatX(8, $f32, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param double
|
||||
* @return void
|
||||
*/
|
||||
public static function addF64(FlatBufferBuilder $builder, $f64)
|
||||
{
|
||||
$builder->addDoubleX(9, $f64, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param VectorOffset
|
||||
* @return void
|
||||
*/
|
||||
public static function addV8(FlatBufferBuilder $builder, $v8)
|
||||
{
|
||||
$builder->addOffsetX(10, $v8, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param array offset array
|
||||
* @return int vector offset
|
||||
*/
|
||||
public static function createV8Vector(FlatBufferBuilder $builder, array $data)
|
||||
{
|
||||
$builder->startVector(1, count($data), 1);
|
||||
for ($i = count($data) - 1; $i >= 0; $i--) {
|
||||
$builder->addSbyte($data[$i]);
|
||||
}
|
||||
return $builder->endVector();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int $numElems
|
||||
* @return void
|
||||
*/
|
||||
public static function startV8Vector(FlatBufferBuilder $builder, $numElems)
|
||||
{
|
||||
$builder->startVector(1, $numElems, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param VectorOffset
|
||||
* @return void
|
||||
*/
|
||||
public static function addVf64(FlatBufferBuilder $builder, $vf64)
|
||||
{
|
||||
$builder->addOffsetX(11, $vf64, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param array offset array
|
||||
* @return int vector offset
|
||||
*/
|
||||
public static function createVf64Vector(FlatBufferBuilder $builder, array $data)
|
||||
{
|
||||
$builder->startVector(8, count($data), 8);
|
||||
for ($i = count($data) - 1; $i >= 0; $i--) {
|
||||
$builder->addDouble($data[$i]);
|
||||
}
|
||||
return $builder->endVector();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @param int $numElems
|
||||
* @return void
|
||||
*/
|
||||
public static function startVf64Vector(FlatBufferBuilder $builder, $numElems)
|
||||
{
|
||||
$builder->startVector(8, $numElems, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FlatBufferBuilder $builder
|
||||
* @return int table offset
|
||||
*/
|
||||
public static function endTypeAliases(FlatBufferBuilder $builder)
|
||||
{
|
||||
$o = $builder->endObject();
|
||||
return $o;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
# automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
# namespace: Example
|
||||
|
||||
import flatbuffers
|
||||
|
||||
class TypeAliases(object):
|
||||
__slots__ = ['_tab']
|
||||
|
||||
@classmethod
|
||||
def GetRootAsTypeAliases(cls, buf, offset):
|
||||
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
||||
x = TypeAliases()
|
||||
x.Init(buf, n + offset)
|
||||
return x
|
||||
|
||||
# TypeAliases
|
||||
def Init(self, buf, pos):
|
||||
self._tab = flatbuffers.table.Table(buf, pos)
|
||||
|
||||
# TypeAliases
|
||||
def I8(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def U8(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def I16(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def U16(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def I32(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def U32(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def I64(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def U64(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def F32(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# TypeAliases
|
||||
def F64(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
|
||||
if o != 0:
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos)
|
||||
return 0.0
|
||||
|
||||
# TypeAliases
|
||||
def V8(self, j):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
||||
if o != 0:
|
||||
a = self._tab.Vector(o)
|
||||
return self._tab.Get(flatbuffers.number_types.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def V8AsNumpy(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
||||
if o != 0:
|
||||
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def V8Length(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
|
||||
if o != 0:
|
||||
return self._tab.VectorLen(o)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def Vf64(self, j):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
||||
if o != 0:
|
||||
a = self._tab.Vector(o)
|
||||
return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8))
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def Vf64AsNumpy(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
||||
if o != 0:
|
||||
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o)
|
||||
return 0
|
||||
|
||||
# TypeAliases
|
||||
def Vf64Length(self):
|
||||
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
|
||||
if o != 0:
|
||||
return self._tab.VectorLen(o)
|
||||
return 0
|
||||
|
||||
def TypeAliasesStart(builder): builder.StartObject(12)
|
||||
def TypeAliasesAddI8(builder, i8): builder.PrependInt8Slot(0, i8, 0)
|
||||
def TypeAliasesAddU8(builder, u8): builder.PrependUint8Slot(1, u8, 0)
|
||||
def TypeAliasesAddI16(builder, i16): builder.PrependInt16Slot(2, i16, 0)
|
||||
def TypeAliasesAddU16(builder, u16): builder.PrependUint16Slot(3, u16, 0)
|
||||
def TypeAliasesAddI32(builder, i32): builder.PrependInt32Slot(4, i32, 0)
|
||||
def TypeAliasesAddU32(builder, u32): builder.PrependUint32Slot(5, u32, 0)
|
||||
def TypeAliasesAddI64(builder, i64): builder.PrependInt64Slot(6, i64, 0)
|
||||
def TypeAliasesAddU64(builder, u64): builder.PrependUint64Slot(7, u64, 0)
|
||||
def TypeAliasesAddF32(builder, f32): builder.PrependFloat32Slot(8, f32, 0.0)
|
||||
def TypeAliasesAddF64(builder, f64): builder.PrependFloat64Slot(9, f64, 0.0)
|
||||
def TypeAliasesAddV8(builder, v8): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0)
|
||||
def TypeAliasesStartV8Vector(builder, numElems): return builder.StartVector(1, numElems, 1)
|
||||
def TypeAliasesAddVf64(builder, vf64): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
|
||||
def TypeAliasesStartVf64Vector(builder, numElems): return builder.StartVector(8, numElems, 8)
|
||||
def TypeAliasesEnd(builder): return builder.EndObject()
|
Binary file not shown.
|
@ -79,6 +79,21 @@ table Monster {
|
|||
vector_of_doubles:[double] (id:33);
|
||||
}
|
||||
|
||||
table TypeAliases {
|
||||
i8:int8;
|
||||
u8:uint8;
|
||||
i16:int16;
|
||||
u16:uint16;
|
||||
i32:int32;
|
||||
u32:uint32;
|
||||
i64:int64;
|
||||
u64:uint64;
|
||||
f32:float32;
|
||||
f64:float64;
|
||||
v8:[int8];
|
||||
vf64:[float64];
|
||||
}
|
||||
|
||||
rpc_service MonsterStorage {
|
||||
Store(Monster):Stat (streaming: "none");
|
||||
Retrieve(Stat):Monster (streaming: "server", idempotent);
|
||||
|
|
|
@ -114,6 +114,23 @@
|
|||
"vector_of_doubles" : { "type" : "array", "items" : { "type" : "number" } }
|
||||
},
|
||||
"required" : [ "name"]
|
||||
},
|
||||
"MyGame_Example_TypeAliases" : {
|
||||
"type" : "object",
|
||||
"properties" : {
|
||||
"i8" : { "type" : "number" },
|
||||
"u8" : { "type" : "number" },
|
||||
"i16" : { "type" : "number" },
|
||||
"u16" : { "type" : "number" },
|
||||
"i32" : { "type" : "number" },
|
||||
"u32" : { "type" : "number" },
|
||||
"i64" : { "type" : "number" },
|
||||
"u64" : { "type" : "number" },
|
||||
"f32" : { "type" : "number" },
|
||||
"f64" : { "type" : "number" },
|
||||
"v8" : { "type" : "array", "items" : { "type" : "number" } },
|
||||
"vf64" : { "type" : "array", "items" : { "type" : "number" } }
|
||||
}
|
||||
}
|
||||
},
|
||||
"$ref" : "#/definitions/MyGame_Example_Monster"
|
||||
|
|
|
@ -32,6 +32,9 @@ struct StatT;
|
|||
struct Monster;
|
||||
struct MonsterT;
|
||||
|
||||
struct TypeAliases;
|
||||
struct TypeAliasesT;
|
||||
|
||||
enum Color {
|
||||
Color_Red = 1,
|
||||
Color_Green = 2,
|
||||
|
@ -518,7 +521,7 @@ flatbuffers::Offset<Stat> CreateStat(flatbuffers::FlatBufferBuilder &_fbb, const
|
|||
|
||||
struct MonsterT : public flatbuffers::NativeTable {
|
||||
typedef Monster TableType;
|
||||
std::unique_ptr<Vec3> pos;
|
||||
flatbuffers::unique_ptr<Vec3> pos;
|
||||
int16_t mana;
|
||||
int16_t hp;
|
||||
std::string name;
|
||||
|
@ -527,10 +530,10 @@ struct MonsterT : public flatbuffers::NativeTable {
|
|||
AnyUnion test;
|
||||
std::vector<Test> test4;
|
||||
std::vector<std::string> testarrayofstring;
|
||||
std::vector<std::unique_ptr<MonsterT>> testarrayoftables;
|
||||
std::unique_ptr<MonsterT> enemy;
|
||||
std::vector<flatbuffers::unique_ptr<MonsterT>> testarrayoftables;
|
||||
flatbuffers::unique_ptr<MonsterT> enemy;
|
||||
std::vector<uint8_t> testnestedflatbuffer;
|
||||
std::unique_ptr<StatT> testempty;
|
||||
flatbuffers::unique_ptr<StatT> testempty;
|
||||
bool testbool;
|
||||
int32_t testhashs32_fnv1;
|
||||
uint32_t testhashu32_fnv1;
|
||||
|
@ -1165,6 +1168,258 @@ inline flatbuffers::Offset<Monster> CreateMonsterDirect(
|
|||
|
||||
flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
struct TypeAliasesT : public flatbuffers::NativeTable {
|
||||
typedef TypeAliases TableType;
|
||||
int8_t i8;
|
||||
uint8_t u8;
|
||||
int16_t i16;
|
||||
uint16_t u16;
|
||||
int32_t i32;
|
||||
uint32_t u32;
|
||||
int64_t i64;
|
||||
uint64_t u64;
|
||||
float f32;
|
||||
double f64;
|
||||
std::vector<int8_t> v8;
|
||||
std::vector<double> vf64;
|
||||
TypeAliasesT()
|
||||
: i8(0),
|
||||
u8(0),
|
||||
i16(0),
|
||||
u16(0),
|
||||
i32(0),
|
||||
u32(0),
|
||||
i64(0),
|
||||
u64(0),
|
||||
f32(0.0f),
|
||||
f64(0.0) {
|
||||
}
|
||||
};
|
||||
|
||||
struct TypeAliases FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef TypeAliasesT NativeTableType;
|
||||
enum {
|
||||
VT_I8 = 4,
|
||||
VT_U8 = 6,
|
||||
VT_I16 = 8,
|
||||
VT_U16 = 10,
|
||||
VT_I32 = 12,
|
||||
VT_U32 = 14,
|
||||
VT_I64 = 16,
|
||||
VT_U64 = 18,
|
||||
VT_F32 = 20,
|
||||
VT_F64 = 22,
|
||||
VT_V8 = 24,
|
||||
VT_VF64 = 26
|
||||
};
|
||||
int8_t i8() const {
|
||||
return GetField<int8_t>(VT_I8, 0);
|
||||
}
|
||||
bool mutate_i8(int8_t _i8) {
|
||||
return SetField<int8_t>(VT_I8, _i8, 0);
|
||||
}
|
||||
uint8_t u8() const {
|
||||
return GetField<uint8_t>(VT_U8, 0);
|
||||
}
|
||||
bool mutate_u8(uint8_t _u8) {
|
||||
return SetField<uint8_t>(VT_U8, _u8, 0);
|
||||
}
|
||||
int16_t i16() const {
|
||||
return GetField<int16_t>(VT_I16, 0);
|
||||
}
|
||||
bool mutate_i16(int16_t _i16) {
|
||||
return SetField<int16_t>(VT_I16, _i16, 0);
|
||||
}
|
||||
uint16_t u16() const {
|
||||
return GetField<uint16_t>(VT_U16, 0);
|
||||
}
|
||||
bool mutate_u16(uint16_t _u16) {
|
||||
return SetField<uint16_t>(VT_U16, _u16, 0);
|
||||
}
|
||||
int32_t i32() const {
|
||||
return GetField<int32_t>(VT_I32, 0);
|
||||
}
|
||||
bool mutate_i32(int32_t _i32) {
|
||||
return SetField<int32_t>(VT_I32, _i32, 0);
|
||||
}
|
||||
uint32_t u32() const {
|
||||
return GetField<uint32_t>(VT_U32, 0);
|
||||
}
|
||||
bool mutate_u32(uint32_t _u32) {
|
||||
return SetField<uint32_t>(VT_U32, _u32, 0);
|
||||
}
|
||||
int64_t i64() const {
|
||||
return GetField<int64_t>(VT_I64, 0);
|
||||
}
|
||||
bool mutate_i64(int64_t _i64) {
|
||||
return SetField<int64_t>(VT_I64, _i64, 0);
|
||||
}
|
||||
uint64_t u64() const {
|
||||
return GetField<uint64_t>(VT_U64, 0);
|
||||
}
|
||||
bool mutate_u64(uint64_t _u64) {
|
||||
return SetField<uint64_t>(VT_U64, _u64, 0);
|
||||
}
|
||||
float f32() const {
|
||||
return GetField<float>(VT_F32, 0.0f);
|
||||
}
|
||||
bool mutate_f32(float _f32) {
|
||||
return SetField<float>(VT_F32, _f32, 0.0f);
|
||||
}
|
||||
double f64() const {
|
||||
return GetField<double>(VT_F64, 0.0);
|
||||
}
|
||||
bool mutate_f64(double _f64) {
|
||||
return SetField<double>(VT_F64, _f64, 0.0);
|
||||
}
|
||||
const flatbuffers::Vector<int8_t> *v8() const {
|
||||
return GetPointer<const flatbuffers::Vector<int8_t> *>(VT_V8);
|
||||
}
|
||||
flatbuffers::Vector<int8_t> *mutable_v8() {
|
||||
return GetPointer<flatbuffers::Vector<int8_t> *>(VT_V8);
|
||||
}
|
||||
const flatbuffers::Vector<double> *vf64() const {
|
||||
return GetPointer<const flatbuffers::Vector<double> *>(VT_VF64);
|
||||
}
|
||||
flatbuffers::Vector<double> *mutable_vf64() {
|
||||
return GetPointer<flatbuffers::Vector<double> *>(VT_VF64);
|
||||
}
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyField<int8_t>(verifier, VT_I8) &&
|
||||
VerifyField<uint8_t>(verifier, VT_U8) &&
|
||||
VerifyField<int16_t>(verifier, VT_I16) &&
|
||||
VerifyField<uint16_t>(verifier, VT_U16) &&
|
||||
VerifyField<int32_t>(verifier, VT_I32) &&
|
||||
VerifyField<uint32_t>(verifier, VT_U32) &&
|
||||
VerifyField<int64_t>(verifier, VT_I64) &&
|
||||
VerifyField<uint64_t>(verifier, VT_U64) &&
|
||||
VerifyField<float>(verifier, VT_F32) &&
|
||||
VerifyField<double>(verifier, VT_F64) &&
|
||||
VerifyOffset(verifier, VT_V8) &&
|
||||
verifier.Verify(v8()) &&
|
||||
VerifyOffset(verifier, VT_VF64) &&
|
||||
verifier.Verify(vf64()) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
TypeAliasesT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static flatbuffers::Offset<TypeAliases> Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct TypeAliasesBuilder {
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_i8(int8_t i8) {
|
||||
fbb_.AddElement<int8_t>(TypeAliases::VT_I8, i8, 0);
|
||||
}
|
||||
void add_u8(uint8_t u8) {
|
||||
fbb_.AddElement<uint8_t>(TypeAliases::VT_U8, u8, 0);
|
||||
}
|
||||
void add_i16(int16_t i16) {
|
||||
fbb_.AddElement<int16_t>(TypeAliases::VT_I16, i16, 0);
|
||||
}
|
||||
void add_u16(uint16_t u16) {
|
||||
fbb_.AddElement<uint16_t>(TypeAliases::VT_U16, u16, 0);
|
||||
}
|
||||
void add_i32(int32_t i32) {
|
||||
fbb_.AddElement<int32_t>(TypeAliases::VT_I32, i32, 0);
|
||||
}
|
||||
void add_u32(uint32_t u32) {
|
||||
fbb_.AddElement<uint32_t>(TypeAliases::VT_U32, u32, 0);
|
||||
}
|
||||
void add_i64(int64_t i64) {
|
||||
fbb_.AddElement<int64_t>(TypeAliases::VT_I64, i64, 0);
|
||||
}
|
||||
void add_u64(uint64_t u64) {
|
||||
fbb_.AddElement<uint64_t>(TypeAliases::VT_U64, u64, 0);
|
||||
}
|
||||
void add_f32(float f32) {
|
||||
fbb_.AddElement<float>(TypeAliases::VT_F32, f32, 0.0f);
|
||||
}
|
||||
void add_f64(double f64) {
|
||||
fbb_.AddElement<double>(TypeAliases::VT_F64, f64, 0.0);
|
||||
}
|
||||
void add_v8(flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8) {
|
||||
fbb_.AddOffset(TypeAliases::VT_V8, v8);
|
||||
}
|
||||
void add_vf64(flatbuffers::Offset<flatbuffers::Vector<double>> vf64) {
|
||||
fbb_.AddOffset(TypeAliases::VT_VF64, vf64);
|
||||
}
|
||||
TypeAliasesBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
TypeAliasesBuilder &operator=(const TypeAliasesBuilder &);
|
||||
flatbuffers::Offset<TypeAliases> Finish() {
|
||||
const auto end = fbb_.EndTable(start_, 12);
|
||||
auto o = flatbuffers::Offset<TypeAliases>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int8_t i8 = 0,
|
||||
uint8_t u8 = 0,
|
||||
int16_t i16 = 0,
|
||||
uint16_t u16 = 0,
|
||||
int32_t i32 = 0,
|
||||
uint32_t u32 = 0,
|
||||
int64_t i64 = 0,
|
||||
uint64_t u64 = 0,
|
||||
float f32 = 0.0f,
|
||||
double f64 = 0.0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<int8_t>> v8 = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<double>> vf64 = 0) {
|
||||
TypeAliasesBuilder builder_(_fbb);
|
||||
builder_.add_f64(f64);
|
||||
builder_.add_u64(u64);
|
||||
builder_.add_i64(i64);
|
||||
builder_.add_vf64(vf64);
|
||||
builder_.add_v8(v8);
|
||||
builder_.add_f32(f32);
|
||||
builder_.add_u32(u32);
|
||||
builder_.add_i32(i32);
|
||||
builder_.add_u16(u16);
|
||||
builder_.add_i16(i16);
|
||||
builder_.add_u8(u8);
|
||||
builder_.add_i8(i8);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<TypeAliases> CreateTypeAliasesDirect(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
int8_t i8 = 0,
|
||||
uint8_t u8 = 0,
|
||||
int16_t i16 = 0,
|
||||
uint16_t u16 = 0,
|
||||
int32_t i32 = 0,
|
||||
uint32_t u32 = 0,
|
||||
int64_t i64 = 0,
|
||||
uint64_t u64 = 0,
|
||||
float f32 = 0.0f,
|
||||
double f64 = 0.0,
|
||||
const std::vector<int8_t> *v8 = nullptr,
|
||||
const std::vector<double> *vf64 = nullptr) {
|
||||
return MyGame::Example::CreateTypeAliases(
|
||||
_fbb,
|
||||
i8,
|
||||
u8,
|
||||
i16,
|
||||
u16,
|
||||
i32,
|
||||
u32,
|
||||
i64,
|
||||
u64,
|
||||
f32,
|
||||
f64,
|
||||
v8 ? _fbb.CreateVector<int8_t>(*v8) : 0,
|
||||
vf64 ? _fbb.CreateVector<double>(*vf64) : 0);
|
||||
}
|
||||
|
||||
flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
} // namespace Example
|
||||
|
||||
namespace Example2 {
|
||||
|
@ -1263,7 +1518,7 @@ inline MonsterT *Monster::UnPack(const flatbuffers::resolver_function_t *_resolv
|
|||
inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = pos(); if (_e) _o->pos = std::unique_ptr<Vec3>(new Vec3(*_e)); };
|
||||
{ auto _e = pos(); if (_e) _o->pos = flatbuffers::unique_ptr<Vec3>(new Vec3(*_e)); };
|
||||
{ auto _e = mana(); _o->mana = _e; };
|
||||
{ auto _e = hp(); _o->hp = _e; };
|
||||
{ auto _e = name(); if (_e) _o->name = _e->str(); };
|
||||
|
@ -1273,10 +1528,10 @@ inline void Monster::UnPackTo(MonsterT *_o, const flatbuffers::resolver_function
|
|||
{ auto _e = test(); if (_e) _o->test.value = AnyUnion::UnPack(_e, test_type(), _resolver); };
|
||||
{ auto _e = test4(); if (_e) { _o->test4.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->test4[_i] = *_e->Get(_i); } } };
|
||||
{ auto _e = testarrayofstring(); if (_e) { _o->testarrayofstring.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofstring[_i] = _e->Get(_i)->str(); } } };
|
||||
{ auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayoftables[_i] = std::unique_ptr<MonsterT>(_e->Get(_i)->UnPack(_resolver)); } } };
|
||||
{ auto _e = enemy(); if (_e) _o->enemy = std::unique_ptr<MonsterT>(_e->UnPack(_resolver)); };
|
||||
{ auto _e = testarrayoftables(); if (_e) { _o->testarrayoftables.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testarrayoftables[_i] = flatbuffers::unique_ptr<MonsterT>(_e->Get(_i)->UnPack(_resolver)); } } };
|
||||
{ auto _e = enemy(); if (_e) _o->enemy = flatbuffers::unique_ptr<MonsterT>(_e->UnPack(_resolver)); };
|
||||
{ auto _e = testnestedflatbuffer(); if (_e) { _o->testnestedflatbuffer.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->testnestedflatbuffer[_i] = _e->Get(_i); } } };
|
||||
{ auto _e = testempty(); if (_e) _o->testempty = std::unique_ptr<StatT>(_e->UnPack(_resolver)); };
|
||||
{ auto _e = testempty(); if (_e) _o->testempty = flatbuffers::unique_ptr<StatT>(_e->UnPack(_resolver)); };
|
||||
{ auto _e = testbool(); _o->testbool = _e; };
|
||||
{ auto _e = testhashs32_fnv1(); _o->testhashs32_fnv1 = _e; };
|
||||
{ auto _e = testhashu32_fnv1(); _o->testhashu32_fnv1 = _e; };
|
||||
|
@ -1376,6 +1631,65 @@ inline flatbuffers::Offset<Monster> CreateMonster(flatbuffers::FlatBufferBuilder
|
|||
_vector_of_doubles);
|
||||
}
|
||||
|
||||
inline TypeAliasesT *TypeAliases::UnPack(const flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = new TypeAliasesT();
|
||||
UnPackTo(_o, _resolver);
|
||||
return _o;
|
||||
}
|
||||
|
||||
inline void TypeAliases::UnPackTo(TypeAliasesT *_o, const flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = i8(); _o->i8 = _e; };
|
||||
{ auto _e = u8(); _o->u8 = _e; };
|
||||
{ auto _e = i16(); _o->i16 = _e; };
|
||||
{ auto _e = u16(); _o->u16 = _e; };
|
||||
{ auto _e = i32(); _o->i32 = _e; };
|
||||
{ auto _e = u32(); _o->u32 = _e; };
|
||||
{ auto _e = i64(); _o->i64 = _e; };
|
||||
{ auto _e = u64(); _o->u64 = _e; };
|
||||
{ auto _e = f32(); _o->f32 = _e; };
|
||||
{ auto _e = f64(); _o->f64 = _e; };
|
||||
{ auto _e = v8(); if (_e) { _o->v8.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->v8[_i] = _e->Get(_i); } } };
|
||||
{ auto _e = vf64(); if (_e) { _o->vf64.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->vf64[_i] = _e->Get(_i); } } };
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<TypeAliases> TypeAliases::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT* _o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return CreateTypeAliases(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<TypeAliases> CreateTypeAliases(flatbuffers::FlatBufferBuilder &_fbb, const TypeAliasesT *_o, const flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TypeAliasesT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _i8 = _o->i8;
|
||||
auto _u8 = _o->u8;
|
||||
auto _i16 = _o->i16;
|
||||
auto _u16 = _o->u16;
|
||||
auto _i32 = _o->i32;
|
||||
auto _u32 = _o->u32;
|
||||
auto _i64 = _o->i64;
|
||||
auto _u64 = _o->u64;
|
||||
auto _f32 = _o->f32;
|
||||
auto _f64 = _o->f64;
|
||||
auto _v8 = _o->v8.size() ? _fbb.CreateVector(_o->v8) : 0;
|
||||
auto _vf64 = _o->vf64.size() ? _fbb.CreateVector(_o->vf64) : 0;
|
||||
return MyGame::Example::CreateTypeAliases(
|
||||
_fbb,
|
||||
_i8,
|
||||
_u8,
|
||||
_i16,
|
||||
_u16,
|
||||
_i32,
|
||||
_u32,
|
||||
_i64,
|
||||
_u64,
|
||||
_f32,
|
||||
_f64,
|
||||
_v8,
|
||||
_vf64);
|
||||
}
|
||||
|
||||
inline bool VerifyAny(flatbuffers::Verifier &verifier, const void *obj, Any type) {
|
||||
switch (type) {
|
||||
case Any_NONE: {
|
||||
|
@ -1518,10 +1832,10 @@ inline void FinishMonsterBuffer(
|
|||
fbb.Finish(root, MonsterIdentifier());
|
||||
}
|
||||
|
||||
inline std::unique_ptr<MonsterT> UnPackMonster(
|
||||
inline flatbuffers::unique_ptr<MonsterT> UnPackMonster(
|
||||
const void *buf,
|
||||
const flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return std::unique_ptr<MonsterT>(GetMonster(buf)->UnPack(res));
|
||||
return flatbuffers::unique_ptr<MonsterT>(GetMonster(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace Example
|
||||
|
|
|
@ -1858,5 +1858,474 @@ MyGame.Example.Monster.finishMonsterBuffer = function(builder, offset) {
|
|||
builder.finish(offset, 'MONS');
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
MyGame.Example.TypeAliases = function() {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
this.bb = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
this.bb_pos = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} i
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @returns {MyGame.Example.TypeAliases}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.__init = function(i, bb) {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @param {MyGame.Example.TypeAliases=} obj
|
||||
* @returns {MyGame.Example.TypeAliases}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.getRootAsTypeAliases = function(bb, obj) {
|
||||
return (obj || new MyGame.Example.TypeAliases).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.i8 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_i8 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.u8 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_u8 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.i16 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_i16 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 8);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt16(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.u16 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_u16 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint16(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.i32 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_i32 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 12);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.u32 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_u32 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 14);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {flatbuffers.Long}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.i64 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Long} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_i64 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 16);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {flatbuffers.Long}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.u64 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Long} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_u64 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 18);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.f32 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 20);
|
||||
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_f32 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 20);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeFloat32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.f64 = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 22);
|
||||
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.mutate_f64 = function(value) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 22);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeFloat64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.v8 = function(index) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.v8Length = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Int8Array}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.v8Array = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.vf64 = function(index) {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.vf64Length = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Float64Array}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.prototype.vf64Array = function() {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
MyGame.Example.TypeAliases.startTypeAliases = function(builder) {
|
||||
builder.startObject(12);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i8
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addI8 = function(builder, i8) {
|
||||
builder.addFieldInt8(0, i8, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u8
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addU8 = function(builder, u8) {
|
||||
builder.addFieldInt8(1, u8, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i16
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addI16 = function(builder, i16) {
|
||||
builder.addFieldInt16(2, i16, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u16
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addU16 = function(builder, u16) {
|
||||
builder.addFieldInt16(3, u16, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i32
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addI32 = function(builder, i32) {
|
||||
builder.addFieldInt32(4, i32, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u32
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addU32 = function(builder, u32) {
|
||||
builder.addFieldInt32(5, u32, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Long} i64
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addI64 = function(builder, i64) {
|
||||
builder.addFieldInt64(6, i64, builder.createLong(0, 0));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Long} u64
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addU64 = function(builder, u64) {
|
||||
builder.addFieldInt64(7, u64, builder.createLong(0, 0));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} f32
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addF32 = function(builder, f32) {
|
||||
builder.addFieldFloat32(8, f32, 0.0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} f64
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addF64 = function(builder, f64) {
|
||||
builder.addFieldFloat64(9, f64, 0.0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} v8Offset
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addV8 = function(builder, v8Offset) {
|
||||
builder.addFieldOffset(10, v8Offset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<number>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.createV8Vector = function(builder, data) {
|
||||
builder.startVector(1, data.length, 1);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt8(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
MyGame.Example.TypeAliases.startV8Vector = function(builder, numElems) {
|
||||
builder.startVector(1, numElems, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} vf64Offset
|
||||
*/
|
||||
MyGame.Example.TypeAliases.addVf64 = function(builder, vf64Offset) {
|
||||
builder.addFieldOffset(11, vf64Offset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<number>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.createVf64Vector = function(builder, data) {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addFloat64(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
MyGame.Example.TypeAliases.startVf64Vector = function(builder, numElems) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
MyGame.Example.TypeAliases.endTypeAliases = function(builder) {
|
||||
var offset = builder.endObject();
|
||||
return offset;
|
||||
};
|
||||
|
||||
// Exports for Node.js and RequireJS
|
||||
this.MyGame = MyGame;
|
||||
|
|
|
@ -1305,11 +1305,53 @@ test5Length():number {
|
|||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {flatbuffers.Long}
|
||||
*/
|
||||
vectorOfLongs(index: number):flatbuffers.Long|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 68);
|
||||
return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : this.bb.createLong(0, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
vectorOfLongsLength():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 68);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {number}
|
||||
*/
|
||||
vectorOfDoubles(index: number):number|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 70);
|
||||
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
vectorOfDoublesLength():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 70);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Float64Array}
|
||||
*/
|
||||
vectorOfDoublesArray():Float64Array|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 70);
|
||||
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
static startMonster(builder:flatbuffers.Builder) {
|
||||
builder.startObject(32);
|
||||
builder.startObject(34);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1731,6 +1773,64 @@ static startTest5Vector(builder:flatbuffers.Builder, numElems:number) {
|
|||
builder.startVector(4, numElems, 2);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} vectorOfLongsOffset
|
||||
*/
|
||||
static addVectorOfLongs(builder:flatbuffers.Builder, vectorOfLongsOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(32, vectorOfLongsOffset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<flatbuffers.Long>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static createVectorOfLongsVector(builder:flatbuffers.Builder, data:flatbuffers.Long[]):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt64(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
static startVectorOfLongsVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} vectorOfDoublesOffset
|
||||
*/
|
||||
static addVectorOfDoubles(builder:flatbuffers.Builder, vectorOfDoublesOffset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<number>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static createVectorOfDoublesVector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addFloat64(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
static startVectorOfDoublesVector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @returns {flatbuffers.Offset}
|
||||
|
@ -1751,3 +1851,473 @@ static finishMonsterBuffer(builder:flatbuffers.Builder, offset:flatbuffers.Offse
|
|||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
export namespace MyGame.Example{
|
||||
export class TypeAliases {
|
||||
/**
|
||||
* @type {flatbuffers.ByteBuffer}
|
||||
*/
|
||||
bb: flatbuffers.ByteBuffer;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
*/
|
||||
bb_pos:number = 0;
|
||||
/**
|
||||
* @param {number} i
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @returns {TypeAliases}
|
||||
*/
|
||||
__init(i:number, bb:flatbuffers.ByteBuffer):TypeAliases {
|
||||
this.bb_pos = i;
|
||||
this.bb = bb;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.ByteBuffer} bb
|
||||
* @param {TypeAliases=} obj
|
||||
* @returns {TypeAliases}
|
||||
*/
|
||||
static getRootAsTypeAliases(bb:flatbuffers.ByteBuffer, obj?:TypeAliases):TypeAliases {
|
||||
return (obj || new TypeAliases).__init(bb.readInt32(bb.position()) + bb.position(), bb);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
i8():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_i8(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
u8():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_u8(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint8(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
i16():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 8);
|
||||
return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_i16(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 8);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt16(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
u16():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_u16(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 10);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint16(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
i32():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 12);
|
||||
return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_i32(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 12);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
u32():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 14);
|
||||
return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_u32(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 14);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {flatbuffers.Long}
|
||||
*/
|
||||
i64():flatbuffers.Long {
|
||||
var offset = this.bb.__offset(this.bb_pos, 16);
|
||||
return offset ? this.bb.readInt64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Long} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_i64(value:flatbuffers.Long):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 16);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeInt64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {flatbuffers.Long}
|
||||
*/
|
||||
u64():flatbuffers.Long {
|
||||
var offset = this.bb.__offset(this.bb_pos, 18);
|
||||
return offset ? this.bb.readUint64(this.bb_pos + offset) : this.bb.createLong(0, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Long} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_u64(value:flatbuffers.Long):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 18);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeUint64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
f32():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 20);
|
||||
return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_f32(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 20);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeFloat32(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
f64():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 22);
|
||||
return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0.0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_f64(value:number):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 22);
|
||||
|
||||
if (offset === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.bb.writeFloat64(this.bb_pos + offset, value);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {number}
|
||||
*/
|
||||
v8(index: number):number|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
v8Length():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Int8Array}
|
||||
*/
|
||||
v8Array():Int8Array|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 24);
|
||||
return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} index
|
||||
* @returns {number}
|
||||
*/
|
||||
vf64(index: number):number|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*/
|
||||
vf64Length():number {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {Float64Array}
|
||||
*/
|
||||
vf64Array():Float64Array|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 26);
|
||||
return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
*/
|
||||
static startTypeAliases(builder:flatbuffers.Builder) {
|
||||
builder.startObject(12);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i8
|
||||
*/
|
||||
static addI8(builder:flatbuffers.Builder, i8:number) {
|
||||
builder.addFieldInt8(0, i8, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u8
|
||||
*/
|
||||
static addU8(builder:flatbuffers.Builder, u8:number) {
|
||||
builder.addFieldInt8(1, u8, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i16
|
||||
*/
|
||||
static addI16(builder:flatbuffers.Builder, i16:number) {
|
||||
builder.addFieldInt16(2, i16, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u16
|
||||
*/
|
||||
static addU16(builder:flatbuffers.Builder, u16:number) {
|
||||
builder.addFieldInt16(3, u16, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} i32
|
||||
*/
|
||||
static addI32(builder:flatbuffers.Builder, i32:number) {
|
||||
builder.addFieldInt32(4, i32, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} u32
|
||||
*/
|
||||
static addU32(builder:flatbuffers.Builder, u32:number) {
|
||||
builder.addFieldInt32(5, u32, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Long} i64
|
||||
*/
|
||||
static addI64(builder:flatbuffers.Builder, i64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(6, i64, builder.createLong(0, 0));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Long} u64
|
||||
*/
|
||||
static addU64(builder:flatbuffers.Builder, u64:flatbuffers.Long) {
|
||||
builder.addFieldInt64(7, u64, builder.createLong(0, 0));
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} f32
|
||||
*/
|
||||
static addF32(builder:flatbuffers.Builder, f32:number) {
|
||||
builder.addFieldFloat32(8, f32, 0.0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} f64
|
||||
*/
|
||||
static addF64(builder:flatbuffers.Builder, f64:number) {
|
||||
builder.addFieldFloat64(9, f64, 0.0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} v8Offset
|
||||
*/
|
||||
static addV8(builder:flatbuffers.Builder, v8Offset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(10, v8Offset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<number>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static createV8Vector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
|
||||
builder.startVector(1, data.length, 1);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addInt8(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
static startV8Vector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(1, numElems, 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {flatbuffers.Offset} vf64Offset
|
||||
*/
|
||||
static addVf64(builder:flatbuffers.Builder, vf64Offset:flatbuffers.Offset) {
|
||||
builder.addFieldOffset(11, vf64Offset, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {Array.<number>} data
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static createVf64Vector(builder:flatbuffers.Builder, data:number[] | Uint8Array):flatbuffers.Offset {
|
||||
builder.startVector(8, data.length, 8);
|
||||
for (var i = data.length - 1; i >= 0; i--) {
|
||||
builder.addFloat64(data[i]);
|
||||
}
|
||||
return builder.endVector();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @param {number} numElems
|
||||
*/
|
||||
static startVf64Vector(builder:flatbuffers.Builder, numElems:number) {
|
||||
builder.startVector(8, numElems, 8);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {flatbuffers.Builder} builder
|
||||
* @returns {flatbuffers.Offset}
|
||||
*/
|
||||
static endTypeAliases(builder:flatbuffers.Builder):flatbuffers.Offset {
|
||||
var offset = builder.endObject();
|
||||
return offset;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
import * as NS9459827973991502386 from "./namespace_test1_generated";
|
||||
import * as NS4989953370203581498 from "./namespace_test1_generated";
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
@ -39,24 +39,24 @@ static getRootAsTableInFirstNS(bb:flatbuffers.ByteBuffer, obj?:TableInFirstNS):T
|
|||
* @param {NamespaceA.NamespaceB.TableInNestedNS=} obj
|
||||
* @returns {NamespaceA.NamespaceB.TableInNestedNS|null}
|
||||
*/
|
||||
fooTable(obj?:NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS|null {
|
||||
fooTable(obj?:NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS):NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 4);
|
||||
return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
return offset ? (obj || new NS4989953370203581498.NamespaceA.NamespaceB.TableInNestedNS).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {NamespaceA.NamespaceB.EnumInNestedNS}
|
||||
*/
|
||||
fooEnum():NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS {
|
||||
fooEnum():NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb.readInt8(this.bb_pos + offset)) : NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A;
|
||||
return offset ? /** @type {NamespaceA.NamespaceB.EnumInNestedNS} */ (this.bb.readInt8(this.bb_pos + offset)) : NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS.A;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {NamespaceA.NamespaceB.EnumInNestedNS} value
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS):boolean {
|
||||
mutate_foo_enum(value:NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS):boolean {
|
||||
var offset = this.bb.__offset(this.bb_pos, 6);
|
||||
|
||||
if (offset === 0) {
|
||||
|
@ -71,9 +71,9 @@ mutate_foo_enum(value:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS
|
|||
* @param {NamespaceA.NamespaceB.StructInNestedNS=} obj
|
||||
* @returns {NamespaceA.NamespaceB.StructInNestedNS|null}
|
||||
*/
|
||||
fooStruct(obj?:NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS):NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS|null {
|
||||
fooStruct(obj?:NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS):NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS|null {
|
||||
var offset = this.bb.__offset(this.bb_pos, 8);
|
||||
return offset ? (obj || new NS9459827973991502386.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb) : null;
|
||||
return offset ? (obj || new NS4989953370203581498.NamespaceA.NamespaceB.StructInNestedNS).__init(this.bb_pos + offset, this.bb) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -95,8 +95,8 @@ static addFooTable(builder:flatbuffers.Builder, fooTableOffset:flatbuffers.Offse
|
|||
* @param {flatbuffers.Builder} builder
|
||||
* @param {NamespaceA.NamespaceB.EnumInNestedNS} fooEnum
|
||||
*/
|
||||
static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS) {
|
||||
builder.addFieldInt8(1, fooEnum, NS9459827973991502386.NamespaceA.NamespaceB.EnumInNestedNS.A);
|
||||
static addFooEnum(builder:flatbuffers.Builder, fooEnum:NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS) {
|
||||
builder.addFieldInt8(1, fooEnum, NS4989953370203581498.NamespaceA.NamespaceB.EnumInNestedNS.A);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1691,6 +1691,39 @@ void FlexBuffersTest() {
|
|||
TEST_EQ_STR(jsontest, jsonback.c_str());
|
||||
}
|
||||
|
||||
void TypeAliasesTest()
|
||||
{
|
||||
flatbuffers::FlatBufferBuilder builder;
|
||||
|
||||
builder.Finish(CreateTypeAliases(builder,
|
||||
INT8_MIN, UINT8_MAX, INT16_MIN, UINT16_MAX,
|
||||
INT32_MIN, UINT32_MAX, INT64_MIN, UINT64_MAX, 2.3f, 2.3));
|
||||
|
||||
auto p = builder.GetBufferPointer();
|
||||
auto ta = flatbuffers::GetRoot<TypeAliases>(p);
|
||||
|
||||
TEST_EQ(ta->i8(), INT8_MIN);
|
||||
TEST_EQ(ta->u8(), UINT8_MAX);
|
||||
TEST_EQ(ta->i16(), INT16_MIN);
|
||||
TEST_EQ(ta->u16(), UINT16_MAX);
|
||||
TEST_EQ(ta->i32(), INT32_MIN);
|
||||
TEST_EQ(ta->u32(), UINT32_MAX);
|
||||
TEST_EQ(ta->i64(), INT64_MIN);
|
||||
TEST_EQ(ta->u64(), UINT64_MAX);
|
||||
TEST_EQ(ta->f32(), 2.3f);
|
||||
TEST_EQ(ta->f64(), 2.3);
|
||||
TEST_EQ(sizeof(ta->i8()), 1);
|
||||
TEST_EQ(sizeof(ta->i16()), 2);
|
||||
TEST_EQ(sizeof(ta->i32()), 4);
|
||||
TEST_EQ(sizeof(ta->i64()), 8);
|
||||
TEST_EQ(sizeof(ta->u8()), 1);
|
||||
TEST_EQ(sizeof(ta->u16()), 2);
|
||||
TEST_EQ(sizeof(ta->u32()), 4);
|
||||
TEST_EQ(sizeof(ta->u64()), 8);
|
||||
TEST_EQ(sizeof(ta->f32()), 4);
|
||||
TEST_EQ(sizeof(ta->f64()), 8);
|
||||
}
|
||||
|
||||
int main(int /*argc*/, const char * /*argv*/[]) {
|
||||
// Run our various test suites:
|
||||
|
||||
|
@ -1740,6 +1773,7 @@ int main(int /*argc*/, const char * /*argv*/[]) {
|
|||
ParseUnionTest();
|
||||
ConformTest();
|
||||
ParseProtoBufAsciiTest();
|
||||
TypeAliasesTest();
|
||||
|
||||
FlexBuffersTest();
|
||||
|
||||
|
|
Loading…
Reference in New Issue