• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: Example
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class Referrable(object):
10    __slots__ = ['_tab']
11
12    @classmethod
13    def GetRootAs(cls, buf, offset=0):
14        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
15        x = Referrable()
16        x.Init(buf, n + offset)
17        return x
18
19    @classmethod
20    def GetRootAsReferrable(cls, buf, offset=0):
21        """This method is deprecated. Please switch to GetRootAs."""
22        return cls.GetRootAs(buf, offset)
23    @classmethod
24    def ReferrableBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
25        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
26
27    # Referrable
28    def Init(self, buf, pos):
29        self._tab = flatbuffers.table.Table(buf, pos)
30
31    # Referrable
32    def Id(self):
33        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
34        if o != 0:
35            return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
36        return 0
37
38def Start(builder): builder.StartObject(1)
39def ReferrableStart(builder):
40    """This method is deprecated. Please switch to Start."""
41    return Start(builder)
42def AddId(builder, id): builder.PrependUint64Slot(0, id, 0)
43def ReferrableAddId(builder, id):
44    """This method is deprecated. Please switch to AddId."""
45    return AddId(builder, id)
46def End(builder): return builder.EndObject()
47def ReferrableEnd(builder):
48    """This method is deprecated. Please switch to End."""
49    return End(builder)
50
51class ReferrableT(object):
52
53    # ReferrableT
54    def __init__(self):
55        self.id = 0  # type: int
56
57    @classmethod
58    def InitFromBuf(cls, buf, pos):
59        referrable = Referrable()
60        referrable.Init(buf, pos)
61        return cls.InitFromObj(referrable)
62
63    @classmethod
64    def InitFromObj(cls, referrable):
65        x = ReferrableT()
66        x._UnPack(referrable)
67        return x
68
69    # ReferrableT
70    def _UnPack(self, referrable):
71        if referrable is None:
72            return
73        self.id = referrable.Id()
74
75    # ReferrableT
76    def Pack(self, builder):
77        Start(builder)
78        AddId(builder, self.id)
79        referrable = End(builder)
80        return referrable
81