Freeciv-3.3: generate_packets.ArrayType Class Reference

Freeciv-3.3

Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes | Protected Member Functions
generate_packets.ArrayType Class Reference
Inheritance diagram for generate_packets.ArrayType:

## Public Member Functions

| __init__ (self, FieldType elem, SizeInfo size)
bool | complex (self)
str | get_code_declaration (self, Location location)
str | get_code_handle_param (self, Location location)
str | get_code_init (self, Location location)
str | get_code_copy (self, Location location, str dest, str src)
str | get_code_fill (self, Location location)
str | get_code_free (self, Location location)
str | get_code_hash (self, Location location)
str | get_code_cmp (self, Location location)
str | get_code_put (self, Location location, bool deep_diff=False)
str | get_code_get (self, Location location, bool deep_diff=False)
str | __str__ (self)
Public Member Functions inherited from generate_packets.FieldType
"FieldType" | array (self, SizeInfo size)
str | get_code_handle_arg (self, Location location)
bool | is_type_compatible (self, "FieldType" other)
Public Member Functions inherited from generate_packets.RawFieldType
str | __repr__ (self)

## Data Fields

| elem
| size

## Static Public Attributes

FieldType | elem
SizeInfo | size
Static Public Attributes inherited from generate_packets.FieldType
bool | foldable = False
Static Public Attributes inherited from generate_packets.RawFieldType
str | FieldTypeConstructor = typing.Callable[[str, str], RawFieldType]

## Protected Member Functions

str | _get_code_put_full (self, Location location)
str | _get_code_put_diff (self, Location location)
str | _get_code_get_full (self, Location location)
str | _get_code_get_diff (self, Location location)
Protected Member Functions inherited from generate_packets.FieldType
| _compat_keys (self, Location location)

## Detailed Description

    Type information for an array field. Consists of size information and
    another FieldType for the array's elements, which may also be an
    ArrayType (for multi-dimensionaly arrays).

Definition at line 1229 of file generate_packets.py.

## Constructor & Destructor Documentation

## ◆ __init__()

generate_packets.ArrayType.__init__ | ( |  | self,
|  | FieldType | elem,
|  | SizeInfo | size
| ) |  |

Definition at line 1240 of file generate_packets.py.

## Member Function Documentation

## ◆ __str__()

str generate_packets.ArrayType.__str__ | ( |  | self | ) |

Reimplemented from generate_packets.RawFieldType.

Definition at line 1559 of file generate_packets.py.

## ◆ _get_code_get_diff()

str generate_packets.ArrayType._get_code_get_diff | ( |  | self,
|  | Location | location
| ) |  |

protected

    Helper method. Generate array-diff get code.

Definition at line 1489 of file generate_packets.py.

## ◆ _get_code_get_full()

str generate_packets.ArrayType._get_code_get_full | ( |  | self,
|  | Location | location
| ) |  |

protected

    Helper method. Generate get code without array-diff.

Definition at line 1461 of file generate_packets.py.

## ◆ _get_code_put_diff()

str generate_packets.ArrayType._get_code_put_diff | ( |  | self,
|  | Location | location
| ) |  |

protected

    Helper method. Generate array-diff put code.

Definition at line 1381 of file generate_packets.py.

## ◆ _get_code_put_full()

str generate_packets.ArrayType._get_code_put_full | ( |  | self,
|  | Location | location
| ) |  |

protected

    Helper method. Generate put code without array-diff.

Definition at line 1351 of file generate_packets.py.

## ◆ complex()

bool generate_packets.ArrayType.complex | ( |  | self | ) |

Reimplemented from generate_packets.FieldType.

Definition at line 1245 of file generate_packets.py.

## ◆ get_code_cmp()

str generate_packets.ArrayType.get_code_cmp | ( |  | self,
|  | Location | location
| ) |  |

    Generate a code snippet comparing a field of this type between
    the `old` and `real_packet` and setting `differ` accordingly.

Reimplemented from generate_packets.FieldType.

Definition at line 1327 of file generate_packets.py.

## ◆ get_code_copy()

str generate_packets.ArrayType.get_code_copy | ( |  | self,
|  | Location | location,
|  | str | dest,
|  | str | src
| ) |  |

    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 from generate_packets.FieldType.

Definition at line 1281 of file generate_packets.py.

## ◆ get_code_declaration()

str generate_packets.ArrayType.get_code_declaration | ( |  | self,
|  | Location | location
| ) |  |

    Generate a code snippet declaring a field with this type in a
    packet struct.

Reimplemented from generate_packets.FieldType.

Definition at line 1248 of file generate_packets.py.

## ◆ get_code_fill()

str generate_packets.ArrayType.get_code_fill | ( |  | self,
|  | Location | location
| ) |  |

    Generate a code snippet shallow-copying a value of this type from
    dsend arguments into a packet struct.

Reimplemented from generate_packets.FieldType.

Definition at line 1295 of file generate_packets.py.

## ◆ get_code_free()

str generate_packets.ArrayType.get_code_free | ( |  | self,
|  | Location | location
| ) |  |

    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 from generate_packets.FieldType.

Definition at line 1307 of file generate_packets.py.

## ◆ get_code_get()

str generate_packets.ArrayType.get_code_get | ( |  | self,
|  | Location | location,
|  | bool | deep_diff = `False`
| ) |  |

    Generate a code snippet reading a field of this type from the
    dataio stream.

Reimplemented from generate_packets.FieldType.

Definition at line 1553 of file generate_packets.py.

## ◆ get_code_handle_param()

str generate_packets.ArrayType.get_code_handle_param | ( |  | self,
|  | Location | location
| ) |  |

    Generate a code fragment declaring a parameter with this type for
    a handle function.

    See also self.get_code_handle_arg()

Reimplemented from generate_packets.FieldType.

Definition at line 1253 of file generate_packets.py.

## ◆ get_code_hash()

str generate_packets.ArrayType.get_code_hash | ( |  | self,
|  | Location | location
| ) |  |

    Generate a code snippet factoring a field of this type into a
    hash computation's `result`.

Reimplemented from generate_packets.FieldType.

Definition at line 1324 of file generate_packets.py.

## ◆ get_code_init()

str generate_packets.ArrayType.get_code_init | ( |  | self,
|  | Location | location
| ) |  |

    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 from generate_packets.FieldType.

Definition at line 1264 of file generate_packets.py.

## ◆ get_code_put()

str generate_packets.ArrayType.get_code_put | ( |  | self,
|  | Location | location,
|  | bool | deep_diff = `False`
| ) |  |

    Generate a code snippet writing a field of this type to the
    dataio stream.

Reimplemented from generate_packets.FieldType.

Definition at line 1455 of file generate_packets.py.

## Field Documentation

## ◆ elem [1/2]

FieldType generate_packets.ArrayType.elem

static

Definition at line 1234 of file generate_packets.py.

## ◆ elem [2/2]

generate_packets.ArrayType.elem

Definition at line 1241 of file generate_packets.py.

## ◆ size [1/2]

SizeInfo generate_packets.ArrayType.size

static

Definition at line 1237 of file generate_packets.py.

## ◆ size [2/2]

generate_packets.ArrayType.size

Definition at line 1242 of file generate_packets.py.