Freeciv-3.3
|
Public Member Functions | |
"FieldType" | array (self, SizeInfo size) |
str | get_code_declaration (self, Location location) |
str | get_code_param (self, Location location) |
str | get_code_handle_arg (self, Location location, str packet) |
str | get_code_init (self, Location location, str packet) |
str | get_code_copy (self, Location location, str dest, str src) |
str | get_code_fill (self, Location location, str packet) |
str | get_code_free (self, Location location, str packet) |
str | get_code_hash (self, Location location, str packet) |
str | get_code_cmp (self, Location location, str new, str old) |
str | get_code_put (self, Location location, str packet, "str | None" diff_packet=None) |
str | get_code_get (self, Location location, str packet, bool deep_diff=False) |
bool | is_type_compatible (self, "FieldType" other) |
![]() | |
str | __str__ (self) |
str | __repr__ (self) |
Static Public Attributes | |
bool | foldable = False |
bool | complex = False |
![]() | |
str | FieldTypeConstructor = typing.Callable[[str, str], RawFieldType] |
Protected Member Functions | |
_compat_keys (self, Location location, str packet) | |
Abstract base class (ABC) for classes representing type information usable for fields of a packet
Definition at line 780 of file generate_packets.py.
Internal helper function. Yield keys to compare for type compatibility. See is_type_compatible()
Definition at line 883 of file generate_packets.py.
"FieldType" generate_packets.FieldType.array | ( | self, | |
SizeInfo | size | ||
) |
Construct a FieldType for an array with element type self and the given size
Reimplemented from generate_packets.RawFieldType.
Reimplemented in generate_packets.StructType.
Definition at line 792 of file generate_packets.py.
Generate a code snippet comparing a field of this type between the given packets and setting `differ` accordingly. The `old` packet is one we know to have been initialized by our own code.
Reimplemented in generate_packets.BasicType, generate_packets.FloatType, generate_packets.BitvectorType, generate_packets.StructType, generate_packets.CmParameterType, generate_packets.StringType, generate_packets.MemoryType, generate_packets.SequenceType, and generate_packets.StrvecType.
Definition at line 865 of file generate_packets.py.
Generate a code snippet deep-copying a field of this type from one packet struct to another that has already been initialized. Subclasses must override this if self.complex is True
Reimplemented in generate_packets.WorklistType, generate_packets.SizedType, generate_packets.StringType, generate_packets.MemoryType, generate_packets.ArrayType, generate_packets.SpecvecType, and generate_packets.StrvecType.
Definition at line 830 of file generate_packets.py.
Generate a code snippet declaring a field with this type in a packet struct.
Reimplemented in generate_packets.BasicType, generate_packets.SizedType, generate_packets.ArrayType, and generate_packets.StrvecType.
Definition at line 800 of file generate_packets.py.
Generate a code snippet shallow-copying a value of this type from dsend arguments into a packet struct.
Reimplemented in generate_packets.WorklistType, generate_packets.SizedType, generate_packets.StringType, generate_packets.MemoryType, generate_packets.ArrayType, and generate_packets.StrvecType.
Definition at line 841 of file generate_packets.py.
Generate a code snippet deinitializing a field of this type in the packet struct before it gets destroyed. Subclasses must override this if self.complex is True
Reimplemented in generate_packets.ArrayType, generate_packets.SpecvecType, and generate_packets.StrvecType.
Definition at line 848 of file generate_packets.py.
str generate_packets.FieldType.get_code_get | ( | self, | |
Location | location, | ||
str | packet, | ||
bool | deep_diff = False |
||
) |
Generate a code snippet reading a field of this type from the dataio stream.
Reimplemented in generate_packets.BasicType, generate_packets.IntType, generate_packets.FloatType, generate_packets.BitvectorType, generate_packets.StringType, generate_packets.MemoryType, and generate_packets.SequenceType.
Definition at line 878 of file generate_packets.py.
Generate a code fragment passing an argument with this type to a handle function. See also self.get_code_param()
Reimplemented in generate_packets.StructType.
Definition at line 813 of file generate_packets.py.
Generate a code snippet factoring a field of this type into a hash computation's `result`.
Reimplemented in generate_packets.ArrayType, generate_packets.StrvecType, generate_packets.BasicType, and generate_packets.IntType.
Definition at line 859 of file generate_packets.py.
Generate a code snippet initializing a field of this type in the packet struct, after the struct has already been zeroed. Subclasses must override this if self.complex is True
Reimplemented in generate_packets.ArrayType, generate_packets.SpecvecType, and generate_packets.StrvecType.
Definition at line 820 of file generate_packets.py.
Generate a code fragment declaring a parameter with this type for a handle function. See also self.get_code_handle_arg()
Reimplemented in generate_packets.BasicType, generate_packets.StructType, generate_packets.SizedType, generate_packets.ArrayType, and generate_packets.StrvecType.
Definition at line 806 of file generate_packets.py.
str generate_packets.FieldType.get_code_put | ( | self, | |
Location | location, | ||
str | packet, | ||
"str | None" | diff_packet = None |
||
) |
Generate a code snippet writing a field of this type to the dataio stream.
Reimplemented in generate_packets.BasicType, generate_packets.FloatType, generate_packets.BitvectorType, generate_packets.StructType, generate_packets.MemoryType, and generate_packets.SequenceType.
Definition at line 872 of file generate_packets.py.
bool generate_packets.FieldType.is_type_compatible | ( | self, | |
"FieldType" | other | ||
) |
Determine whether two field types can be used interchangeably as part of the packet struct, i.e. differ in dataio transmission only
Definition at line 895 of file generate_packets.py.
Reimplemented in generate_packets.ArrayType.
Definition at line 787 of file generate_packets.py.
Definition at line 784 of file generate_packets.py.