| 13941 | |
| 13942 | @functools.total_ordering |
| 13943 | class StructHash(object): |
| 13944 | __slots__ = "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", |
| 13945 | |
| 13946 | def __init__(self, f1=None, f2=None, f3=None, f4=None, f5=None, f6=None, f7=None, f8=None, f9=None, f10=None): |
| 13947 | if f1 is None: |
| 13948 | f1 = dict() |
| 13949 | if f2 is None: |
| 13950 | f2 = dict() |
| 13951 | if f3 is None: |
| 13952 | f3 = dict() |
| 13953 | if f4 is None: |
| 13954 | f4 = dict() |
| 13955 | if f5 is None: |
| 13956 | f5 = dict() |
| 13957 | if f6 is None: |
| 13958 | f6 = dict() |
| 13959 | if f7 is None: |
| 13960 | f7 = dict() |
| 13961 | if f8 is None: |
| 13962 | f8 = dict() |
| 13963 | if f9 is None: |
| 13964 | f9 = dict() |
| 13965 | if f10 is None: |
| 13966 | f10 = dict() |
| 13967 | self.f1 = f1 |
| 13968 | self.f2 = f2 |
| 13969 | self.f3 = f3 |
| 13970 | self.f4 = f4 |
| 13971 | self.f5 = f5 |
| 13972 | self.f6 = f6 |
| 13973 | self.f7 = f7 |
| 13974 | self.f8 = f8 |
| 13975 | self.f9 = f9 |
| 13976 | self.f10 = f10 |
| 13977 | |
| 13978 | # Struct shallow copy |
| 13979 | def copy(self, other): |
| 13980 | self.f1 = other.f1 |
| 13981 | self.f2 = other.f2 |
| 13982 | self.f3 = other.f3 |
| 13983 | self.f4 = other.f4 |
| 13984 | self.f5 = other.f5 |
| 13985 | self.f6 = other.f6 |
| 13986 | self.f7 = other.f7 |
| 13987 | self.f8 = other.f8 |
| 13988 | self.f9 = other.f9 |
| 13989 | self.f10 = other.f10 |
| 13990 | return self |
| 13991 | |
| 13992 | # Struct deep clone |
| 13993 | def clone(self): |
| 13994 | # Serialize the struct to the FBE stream |
| 13995 | writer = StructHashModel(fbe.WriteBuffer()) |
| 13996 | writer.serialize(self) |
| 13997 | |
| 13998 | # Deserialize the struct from the FBE stream |
| 13999 | reader = StructHashModel(fbe.ReadBuffer()) |
| 14000 | reader.attach_buffer(writer.buffer) |
no outgoing calls