| 2404 | |
| 2405 | @functools.total_ordering |
| 2406 | class OrderMessage(object): |
| 2407 | __slots__ = "body", |
| 2408 | |
| 2409 | def __init__(self, body=None): |
| 2410 | if body is None: |
| 2411 | body = Order() |
| 2412 | self.body = body |
| 2413 | |
| 2414 | # Struct shallow copy |
| 2415 | def copy(self, other): |
| 2416 | self.body = other.body |
| 2417 | return self |
| 2418 | |
| 2419 | # Struct deep clone |
| 2420 | def clone(self): |
| 2421 | # Serialize the struct to the FBE stream |
| 2422 | writer = OrderMessageModel(fbe.WriteBuffer()) |
| 2423 | writer.serialize(self) |
| 2424 | |
| 2425 | # Deserialize the struct from the FBE stream |
| 2426 | reader = OrderMessageModel(fbe.ReadBuffer()) |
| 2427 | reader.attach_buffer(writer.buffer) |
| 2428 | return reader.deserialize()[0] |
| 2429 | |
| 2430 | def __eq__(self, other): |
| 2431 | if not isinstance(self, other.__class__): |
| 2432 | return NotImplemented |
| 2433 | return True |
| 2434 | |
| 2435 | def __lt__(self, other): |
| 2436 | if not isinstance(self, other.__class__): |
| 2437 | return NotImplemented |
| 2438 | return False |
| 2439 | |
| 2440 | @property |
| 2441 | def __key__(self): |
| 2442 | return () |
| 2443 | |
| 2444 | def __hash__(self): |
| 2445 | return hash(self.__key__) |
| 2446 | |
| 2447 | def __format__(self, format_spec): |
| 2448 | return self.__str__() |
| 2449 | |
| 2450 | def __str__(self): |
| 2451 | sb = list() |
| 2452 | sb.append("OrderMessage(") |
| 2453 | sb.append("body=") |
| 2454 | sb.append(str(self.body)) |
| 2455 | sb.append(")") |
| 2456 | return "".join(sb) |
| 2457 | |
| 2458 | # Get struct JSON value |
| 2459 | def to_json(self): |
| 2460 | return json.dumps(self.__to_json__(), cls=fbe.JSONEncoder, separators=(',', ':')) |
| 2461 | |
| 2462 | def __to_json__(self): |
| 2463 | result = dict() |
no outgoing calls
no test coverage detected