• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# automatically generated by the FlatBuffers compiler, do not modify
2
3# namespace: NamespaceC
4
5import flatbuffers
6from flatbuffers.compat import import_numpy
7np = import_numpy()
8
9class TableInC(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 = TableInC()
16        x.Init(buf, n + offset)
17        return x
18
19    @classmethod
20    def GetRootAsTableInC(cls, buf, offset=0):
21        """This method is deprecated. Please switch to GetRootAs."""
22        return cls.GetRootAs(buf, offset)
23    # TableInC
24    def Init(self, buf, pos):
25        self._tab = flatbuffers.table.Table(buf, pos)
26
27    # TableInC
28    def ReferToA1(self):
29        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
30        if o != 0:
31            x = self._tab.Indirect(o + self._tab.Pos)
32            obj = TableInFirstNS()
33            obj.Init(self._tab.Bytes, x)
34            return obj
35        return None
36
37    # TableInC
38    def ReferToA2(self):
39        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
40        if o != 0:
41            x = self._tab.Indirect(o + self._tab.Pos)
42            obj = SecondTableInA()
43            obj.Init(self._tab.Bytes, x)
44            return obj
45        return None
46
47def Start(builder): builder.StartObject(2)
48def TableInCStart(builder):
49    """This method is deprecated. Please switch to Start."""
50    return Start(builder)
51def AddReferToA1(builder, referToA1): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToA1), 0)
52def TableInCAddReferToA1(builder, referToA1):
53    """This method is deprecated. Please switch to AddReferToA1."""
54    return AddReferToA1(builder, referToA1)
55def AddReferToA2(builder, referToA2): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(referToA2), 0)
56def TableInCAddReferToA2(builder, referToA2):
57    """This method is deprecated. Please switch to AddReferToA2."""
58    return AddReferToA2(builder, referToA2)
59def End(builder): return builder.EndObject()
60def TableInCEnd(builder):
61    """This method is deprecated. Please switch to End."""
62    return End(builder)
63try:
64    from typing import Optional
65except:
66    pass
67
68class TableInCT(object):
69
70    # TableInCT
71    def __init__(self):
72        self.referToA1 = None  # type: Optional[TableInFirstNST]
73        self.referToA2 = None  # type: Optional[SecondTableInAT]
74
75    @classmethod
76    def InitFromBuf(cls, buf, pos):
77        tableInC = TableInC()
78        tableInC.Init(buf, pos)
79        return cls.InitFromObj(tableInC)
80
81    @classmethod
82    def InitFromObj(cls, tableInC):
83        x = TableInCT()
84        x._UnPack(tableInC)
85        return x
86
87    # TableInCT
88    def _UnPack(self, tableInC):
89        if tableInC is None:
90            return
91        if tableInC.ReferToA1() is not None:
92            self.referToA1 = TableInFirstNST.InitFromObj(tableInC.ReferToA1())
93        if tableInC.ReferToA2() is not None:
94            self.referToA2 = SecondTableInAT.InitFromObj(tableInC.ReferToA2())
95
96    # TableInCT
97    def Pack(self, builder):
98        if self.referToA1 is not None:
99            referToA1 = self.referToA1.Pack(builder)
100        if self.referToA2 is not None:
101            referToA2 = self.referToA2.Pack(builder)
102        Start(builder)
103        if self.referToA1 is not None:
104            AddReferToA1(builder, referToA1)
105        if self.referToA2 is not None:
106            AddReferToA2(builder, referToA2)
107        tableInC = End(builder)
108        return tableInC
109