Freeciv-3.2
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
generate_packets.Variant Class Reference

Public Member Functions

 __init__ (self, typing.Iterable[str] poscaps, typing.Iterable[str] negcaps, "Packet" packet, int no)
 
ScriptConfig cfg (self)
 
bool gen_stats (self)
 
"str | None" log_macro (self)
 
bool gen_log (self)
 
str packet_name (self)
 
str type (self)
 
bool no_packet (self)
 
bool delta (self)
 
 want_force (self)
 
str is_info (self)
 
"list[str]" cancel (self)
 
bool differ_used (self)
 
str condition (self)
 
int bits (self)
 
str receive_prototype (self)
 
str send_prototype (self)
 
str send_handler (self)
 
str receive_handler (self)
 
str get_stats (self)
 
str get_bitvector (self)
 
str get_report_part (self)
 
str get_reset_part (self)
 
str get_hash (self)
 
str get_cmp (self)
 
str get_send (self)
 
str get_delta_send_body (self, str before_return="")
 
str get_receive (self)
 
str get_delta_receive_body (self)
 

Data Fields

 packet
 
 no
 
 name
 
 poscaps
 
 negcaps
 
 fields
 
 key_fields
 
 other_fields
 
 keys_format
 
 keys_arg
 
 no_packet
 

Detailed Description

Represents one variant of a packet. Packets with add-cap or
remove-cap fields have different variants for different combinations of
the relevant optional capabilities.

Definition at line 1752 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.Variant.__init__ (   self,
typing.Iterable[str poscaps,
typing.Iterable[str negcaps,
"Packet"  packet,
int  no 
)

Definition at line 1757 of file generate_packets.py.

Member Function Documentation

◆ bits()

int generate_packets.Variant.bits (   self)
The length of the bitvector for this variant.

Definition at line 1909 of file generate_packets.py.

◆ cancel()

"list[str]" generate_packets.Variant.cancel (   self)
List of packets to cancel when sending or receiving this packet

See Packet.cancel

Definition at line 1870 of file generate_packets.py.

◆ cfg()

ScriptConfig generate_packets.Variant.cfg (   self)
Configuration used when generating code for this packet
variant

See self.packet and Packet.cfg

Definition at line 1800 of file generate_packets.py.

◆ condition()

str generate_packets.Variant.condition (   self)
The condition determining whether this variant should be used,
based on capabilities.

See get_packet_handlers_fill_capability()

Definition at line 1894 of file generate_packets.py.

◆ delta()

bool generate_packets.Variant.delta (   self)
Whether this packet can use delta optimization

See Packet.delta

Definition at line 1851 of file generate_packets.py.

◆ differ_used()

bool generate_packets.Variant.differ_used (   self)
Whether the send function needs a `differ` boolean.

See get_send()

Definition at line 1877 of file generate_packets.py.

◆ gen_log()

bool generate_packets.Variant.gen_log (   self)
Whether to generate log calls for this packet variant

See self.log_macro

Definition at line 1823 of file generate_packets.py.

◆ gen_stats()

bool generate_packets.Variant.gen_stats (   self)
Whether to generate delta stats code for this packet variant

See self.cfg and ScriptConfig.gen_stats

Definition at line 1808 of file generate_packets.py.

◆ get_bitvector()

str generate_packets.Variant.get_bitvector (   self)
Generate the declaration of the fields bitvector type for this
packet variant

Definition at line 1968 of file generate_packets.py.

◆ get_cmp()

str generate_packets.Variant.get_cmp (   self)
Generate the key comparison function for this variant

Definition at line 2037 of file generate_packets.py.

◆ get_delta_receive_body()

str generate_packets.Variant.get_delta_receive_body (   self)
Helper for get_receive(). Generate the part of the receive
function responsible for recreating the full packet from the
received delta and the last cached packet.

Definition at line 2403 of file generate_packets.py.

◆ get_delta_send_body()

str generate_packets.Variant.get_delta_send_body (   self,
str   before_return = "" 
)
Helper for get_send(). Generate the part of the send function
that computes and transmits the delta between the real packet and
the last cached packet.

Definition at line 2214 of file generate_packets.py.

◆ get_hash()

str generate_packets.Variant.get_hash (   self)
Generate the key hash function for this variant

Definition at line 2005 of file generate_packets.py.

◆ get_receive()

str generate_packets.Variant.get_receive (   self)
Generate the receive function for this packet variant

Definition at line 2309 of file generate_packets.py.

◆ get_report_part()

str generate_packets.Variant.get_report_part (   self)
Generate the part of the delta_stats_report8) function specific
to this packet variant

Definition at line 1975 of file generate_packets.py.

◆ get_reset_part()

str generate_packets.Variant.get_reset_part (   self)
Generate the part of the delta_stats_reset() function specific
to this packet variant

Definition at line 1995 of file generate_packets.py.

◆ get_send()

str generate_packets.Variant.get_send (   self)
Generate the send function for this packet variant

Definition at line 2072 of file generate_packets.py.

◆ get_stats()

str generate_packets.Variant.get_stats (   self)
Generate the declaration of the delta stats counters associated
with this packet variant

Definition at line 1952 of file generate_packets.py.

◆ is_info()

str generate_packets.Variant.is_info (   self)
Whether this is an info or game-info packet

Definition at line 1865 of file generate_packets.py.

◆ log_macro()

"str | None" generate_packets.Variant.log_macro (   self)
The log macro used to generate log calls for this packet variant,
or None if no log calls should be generated

See self.cfg and ScriptConfig.log_macro

Definition at line 1815 of file generate_packets.py.

◆ no_packet()

bool generate_packets.Variant.no_packet (   self)
Whether the send function should not take/need a packet struct

See Packet.no_packet

Definition at line 1844 of file generate_packets.py.

◆ packet_name()

str generate_packets.Variant.packet_name (   self)
Name of the packet this is a variant of

See Packet.name

Definition at line 1830 of file generate_packets.py.

◆ receive_handler()

str generate_packets.Variant.receive_handler (   self)
Code to set the receive handler for this variant

See get_packet_handlers_fill_initial and
get_packet_handlers_fill_capability

Definition at line 1943 of file generate_packets.py.

◆ receive_prototype()

str generate_packets.Variant.receive_prototype (   self)
The prototype of this variant's receive function

Definition at line 1914 of file generate_packets.py.

◆ send_handler()

str generate_packets.Variant.send_handler (   self)
Code to set the send handler for this variant

See get_packet_handlers_fill_initial and
get_packet_handlers_fill_capability

Definition at line 1924 of file generate_packets.py.

◆ send_prototype()

str generate_packets.Variant.send_prototype (   self)
The prototype of this variant's send function

Definition at line 1919 of file generate_packets.py.

◆ type()

str generate_packets.Variant.type (   self)
Type (enum constant) of the packet this is a variant of

See Packet.type

Definition at line 1837 of file generate_packets.py.

◆ want_force()

generate_packets.Variant.want_force (   self)
Whether send function takes a force_to_send boolean

See Packet.want_force

Definition at line 1858 of file generate_packets.py.

Field Documentation

◆ fields

generate_packets.Variant.fields

Definition at line 1772 of file generate_packets.py.

◆ key_fields

generate_packets.Variant.key_fields

Definition at line 1778 of file generate_packets.py.

◆ keys_arg

generate_packets.Variant.keys_arg

Definition at line 1788 of file generate_packets.py.

◆ keys_format

generate_packets.Variant.keys_format

Definition at line 1783 of file generate_packets.py.

◆ name

generate_packets.Variant.name

Definition at line 1763 of file generate_packets.py.

◆ negcaps

generate_packets.Variant.negcaps

Definition at line 1769 of file generate_packets.py.

◆ no

generate_packets.Variant.no

Definition at line 1761 of file generate_packets.py.

◆ no_packet

generate_packets.Variant.no_packet

Definition at line 1882 of file generate_packets.py.

◆ other_fields

generate_packets.Variant.other_fields

Definition at line 1780 of file generate_packets.py.

◆ packet

generate_packets.Variant.packet

Definition at line 1759 of file generate_packets.py.

◆ poscaps

generate_packets.Variant.poscaps

Definition at line 1766 of file generate_packets.py.