MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / FieldModelBalance

Class FieldModelBalance

projects/Python/proto/protoex.py:1330–1512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1328
1329
1330class FieldModelBalance(fbe.FieldModel):
1331 __slots__ = "_parent", "_locked",
1332
1333 def __init__(self, buffer, offset):
1334 super().__init__(buffer, offset)
1335 self._parent = proto.FieldModelBalance(buffer, 4 + 4)
1336 self._locked = fbe.FieldModelDouble(buffer, self._parent.fbe_offset + self._parent.fbe_body - 4 - 4)
1337
1338 @property
1339 def parent(self):
1340 return self._parent
1341
1342 @property
1343 def locked(self):
1344 return self._locked
1345
1346 # Get the field size
1347 @property
1348 def fbe_size(self):
1349 return 4
1350
1351 # Get the field body size
1352 @property
1353 def fbe_body(self):
1354 fbe_result = 4 + 4 \
1355 + self.parent.fbe_body - 4 - 4 \
1356 + self.locked.fbe_size \
1357
1358 return fbe_result
1359
1360 # Get the field extra size
1361 @property
1362 def fbe_extra(self):
1363 if (self._buffer.offset + self.fbe_offset + self.fbe_size) > self._buffer.size:
1364 return 0
1365
1366 fbe_struct_offset = self.read_uint32(self.fbe_offset)
1367 if (fbe_struct_offset == 0) or ((self._buffer.offset + fbe_struct_offset + 4) > self._buffer.size):
1368 return 0
1369
1370 self._buffer.shift(fbe_struct_offset)
1371
1372 fbe_result = self.fbe_body \
1373 + self.parent.fbe_extra \
1374 + self.locked.fbe_extra \
1375
1376 self._buffer.unshift(fbe_struct_offset)
1377
1378 return fbe_result
1379
1380 # Get the field type
1381 @property
1382 def fbe_type(self):
1383 return self.TYPE
1384
1385 TYPE = proto.FieldModelBalance.TYPE
1386
1387 # Check if the struct value is valid

Callers 3

__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected