blob: 6caa1f2c51b5e994a3450ab6320bd6a38314e374 [file] [log] [blame]
Kevin Cheng38d214c2021-10-15 15:49:19 -07001# automatically generated by the FlatBuffers compiler, do not modify
2
Kevin Cheng38d214c2021-10-15 15:49:19 -07003# namespace: tosa
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class TableAttribute(object):
10 __slots__ = ['_tab']
11
12 @classmethod
Eric Kunze4381b3d2022-08-22 18:15:41 +000013 def GetRootAs(cls, buf, offset=0):
Kevin Cheng38d214c2021-10-15 15:49:19 -070014 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
15 x = TableAttribute()
16 x.Init(buf, n + offset)
17 return x
18
19 @classmethod
Eric Kunze4381b3d2022-08-22 18:15:41 +000020 def GetRootAsTableAttribute(cls, buf, offset=0):
21 """This method is deprecated. Please switch to GetRootAs."""
22 return cls.GetRootAs(buf, offset)
23 @classmethod
Kevin Cheng38d214c2021-10-15 15:49:19 -070024 def TableAttributeBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
25 return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x4F\x53\x41", size_prefixed=size_prefixed)
26
27 # TableAttribute
28 def Init(self, buf, pos):
29 self._tab = flatbuffers.table.Table(buf, pos)
30
31 # TableAttribute
32 def Table(self, j):
33 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
34 if o != 0:
35 a = self._tab.Vector(o)
TatWai Chong7be71652022-05-10 17:26:20 -070036 return self._tab.Get(flatbuffers.number_types.Int16Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 2))
Kevin Cheng38d214c2021-10-15 15:49:19 -070037 return 0
38
39 # TableAttribute
40 def TableAsNumpy(self):
41 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
42 if o != 0:
TatWai Chong7be71652022-05-10 17:26:20 -070043 return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int16Flags, o)
Kevin Cheng38d214c2021-10-15 15:49:19 -070044 return 0
45
46 # TableAttribute
47 def TableLength(self):
48 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
49 if o != 0:
50 return self._tab.VectorLen(o)
51 return 0
52
53 # TableAttribute
54 def TableIsNone(self):
55 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
56 return o == 0
57
Tai Ly89963aa2023-07-03 22:14:05 +000058def TableAttributeStart(builder):
59 builder.StartObject(1)
60
Eric Kunze4381b3d2022-08-22 18:15:41 +000061def Start(builder):
Tai Ly89963aa2023-07-03 22:14:05 +000062 TableAttributeStart(builder)
63
64def TableAttributeAddTable(builder, table):
65 builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(table), 0)
66
Eric Kunze4381b3d2022-08-22 18:15:41 +000067def AddTable(builder, table):
Tai Ly89963aa2023-07-03 22:14:05 +000068 TableAttributeAddTable(builder, table)
69
70def TableAttributeStartTableVector(builder, numElems):
71 return builder.StartVector(2, numElems, 2)
72
73def StartTableVector(builder, numElems: int) -> int:
Eric Kunze4381b3d2022-08-22 18:15:41 +000074 return TableAttributeStartTableVector(builder, numElems)
Tai Ly89963aa2023-07-03 22:14:05 +000075
76def TableAttributeEnd(builder):
77 return builder.EndObject()
78
Eric Kunze4381b3d2022-08-22 18:15:41 +000079def End(builder):
Tai Ly89963aa2023-07-03 22:14:05 +000080 return TableAttributeEnd(builder)