2020-12-15 00:13:37 +08:00
|
|
|
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
|
|
|
|
# namespace: flat
|
|
|
|
|
|
|
|
import flatbuffers
|
|
|
|
from flatbuffers.compat import import_numpy
|
|
|
|
np = import_numpy()
|
|
|
|
|
|
|
|
class SpotList(object):
|
|
|
|
__slots__ = ['_tab']
|
|
|
|
|
|
|
|
@classmethod
|
2023-11-02 02:30:28 +08:00
|
|
|
def GetRootAs(cls, buf, offset=0):
|
2020-12-15 00:13:37 +08:00
|
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
|
|
x = SpotList()
|
|
|
|
x.Init(buf, n + offset)
|
|
|
|
return x
|
|
|
|
|
2023-11-02 02:30:28 +08:00
|
|
|
@classmethod
|
|
|
|
def GetRootAsSpotList(cls, buf, offset=0):
|
|
|
|
"""This method is deprecated. Please switch to GetRootAs."""
|
|
|
|
return cls.GetRootAs(buf, offset)
|
2020-12-15 00:13:37 +08:00
|
|
|
# SpotList
|
|
|
|
def Init(self, buf, pos):
|
|
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
|
|
|
|
# SpotList
|
|
|
|
def Spot(self, j):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
|
|
if o != 0:
|
|
|
|
x = self._tab.Vector(o)
|
|
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
|
|
x = self._tab.Indirect(x)
|
|
|
|
from hikyuu.flat.Spot import Spot
|
|
|
|
obj = Spot()
|
|
|
|
obj.Init(self._tab.Bytes, x)
|
|
|
|
return obj
|
|
|
|
return None
|
|
|
|
|
|
|
|
# SpotList
|
|
|
|
def SpotLength(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
|
|
if o != 0:
|
|
|
|
return self._tab.VectorLen(o)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
# SpotList
|
|
|
|
def SpotIsNone(self):
|
|
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
|
|
return o == 0
|
|
|
|
|
2023-11-03 00:03:30 +08:00
|
|
|
def SpotListStart(builder):
|
|
|
|
builder.StartObject(1)
|
|
|
|
|
2023-11-02 02:30:28 +08:00
|
|
|
def Start(builder):
|
2023-11-03 00:03:30 +08:00
|
|
|
SpotListStart(builder)
|
|
|
|
|
|
|
|
def SpotListAddSpot(builder, spot):
|
|
|
|
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(spot), 0)
|
|
|
|
|
2023-11-02 02:30:28 +08:00
|
|
|
def AddSpot(builder, spot):
|
2023-11-03 00:03:30 +08:00
|
|
|
SpotListAddSpot(builder, spot)
|
|
|
|
|
|
|
|
def SpotListStartSpotVector(builder, numElems):
|
|
|
|
return builder.StartVector(4, numElems, 4)
|
|
|
|
|
|
|
|
def StartSpotVector(builder, numElems: int) -> int:
|
2023-11-02 02:30:28 +08:00
|
|
|
return SpotListStartSpotVector(builder, numElems)
|
2023-11-03 00:03:30 +08:00
|
|
|
|
|
|
|
def SpotListEnd(builder):
|
|
|
|
return builder.EndObject()
|
|
|
|
|
2023-11-02 02:30:28 +08:00
|
|
|
def End(builder):
|
|
|
|
return SpotListEnd(builder)
|
2023-11-03 00:03:30 +08:00
|
|
|
|
2023-11-02 02:30:28 +08:00
|
|
|
import hikyuu.flat.Spot
|
|
|
|
try:
|
|
|
|
from typing import List
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
|
|
|
class SpotListT(object):
|
|
|
|
|
|
|
|
# SpotListT
|
|
|
|
def __init__(self):
|
|
|
|
self.spot = None # type: List[hikyuu.flat.Spot.SpotT]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def InitFromBuf(cls, buf, pos):
|
|
|
|
spotList = SpotList()
|
|
|
|
spotList.Init(buf, pos)
|
|
|
|
return cls.InitFromObj(spotList)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def InitFromPackedBuf(cls, buf, pos=0):
|
|
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
|
|
|
return cls.InitFromBuf(buf, pos+n)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def InitFromObj(cls, spotList):
|
|
|
|
x = SpotListT()
|
|
|
|
x._UnPack(spotList)
|
|
|
|
return x
|
|
|
|
|
|
|
|
# SpotListT
|
|
|
|
def _UnPack(self, spotList):
|
|
|
|
if spotList is None:
|
|
|
|
return
|
|
|
|
if not spotList.SpotIsNone():
|
|
|
|
self.spot = []
|
|
|
|
for i in range(spotList.SpotLength()):
|
|
|
|
if spotList.Spot(i) is None:
|
|
|
|
self.spot.append(None)
|
|
|
|
else:
|
|
|
|
spot_ = hikyuu.flat.Spot.SpotT.InitFromObj(spotList.Spot(i))
|
|
|
|
self.spot.append(spot_)
|
|
|
|
|
|
|
|
# SpotListT
|
|
|
|
def Pack(self, builder):
|
|
|
|
if self.spot is not None:
|
|
|
|
spotlist = []
|
|
|
|
for i in range(len(self.spot)):
|
|
|
|
spotlist.append(self.spot[i].Pack(builder))
|
|
|
|
SpotListStartSpotVector(builder, len(self.spot))
|
|
|
|
for i in reversed(range(len(self.spot))):
|
|
|
|
builder.PrependUOffsetTRelative(spotlist[i])
|
|
|
|
spot = builder.EndVector()
|
|
|
|
SpotListStart(builder)
|
|
|
|
if self.spot is not None:
|
|
|
|
SpotListAddSpot(builder, spot)
|
|
|
|
spotList = SpotListEnd(builder)
|
|
|
|
return spotList
|