zserio.array module

The module implements abstraction for arrays used by Zserio python extension.

class zserio.array.Array(array_traits: Any, raw_array: List | None = None, *, is_auto: bool = False, is_implicit: bool = False, set_offset_method: Callable[[int, int], None] | None = None, check_offset_method: Callable[[int, int], None] | None = None)[source]

Bases: object

Abstraction for arrays to which Zserio arrays are mapped in python.

Constructor.

Parameters:
  • array_traits – Array traits which specify the array type.

  • raw_array – Native python list which will be hold by this abstraction.

  • is_auto – True if mapped Zserio array is auto array.

  • is_implicit – True if mapped Zserio array is implicit array.

  • set_offset_method – Set offset method if mapped Zserio array is indexed offset array.

  • check_offset_method – Check offset method if mapped Zserio array is indexed offset array.

bitsizeof(bitposition: int) int[source]

Returns length of array stored in the bit stream in bits.

Parameters:

bitposition – Current bit stream position.

Returns:

Length of the array stored in the bit stream in bits.

bitsizeof_packed(bitposition: int) int[source]

Returns length of the packed array stored in the bit stream in bits.

Parameters:

bitposition – Current bit stream position.

Returns:

Length of the array stored in the bit stream in bits.

classmethod from_reader(array_traits: Any, reader: BitStreamReader, size: int = 0, *, is_auto: bool = False, is_implicit: bool = False, set_offset_method: Callable[[int, int], None] | None = None, check_offset_method: Callable[[int, int], None] | None = None) Array[source]

Constructs array and reads elements from the given bit stream reader.

Parameters:
  • array_traits – Array traits which specify the array type.

  • reader – Bit stream from which to read.

  • size – Number of elements to read or None in case of implicit or auto arrays.

  • raw_array – Native python list which will be hold by this abstraction.

  • is_auto – True if mapped Zserio array is auto array.

  • is_implicit – True if mapped Zserio array is implicit array.

  • set_offset_method – Set offset method if mapped Zserio array is indexed offset array.

  • check_offset_method – Check offset method if mapped Zserio array is indexed offset array.

Returns:

Array instance filled using given bit stream reader.

classmethod from_reader_packed(array_traits: Any, reader: BitStreamReader, size: int = 0, *, is_auto: bool = False, set_offset_method: Callable[[int, int], None] | None = None, check_offset_method: Callable[[int, int], None] | None = None) Array[source]

Constructs packed array and reads elements from the given bit stream reader.

Parameters:
  • array_traits – Array traits which specify the array type.

  • reader – Bit stream from which to read.

  • size – Number of elements to read or None in case of implicit or auto arrays.

  • raw_array – Native python list which will be hold by this abstraction.

  • is_auto – True if mapped Zserio array is auto array.

  • set_offset_method – Set offset method if mapped Zserio array is indexed offset array.

  • check_offset_method – Check offset method if mapped Zserio array is indexed offset array.

Returns:

Array instance filled using given bit stream reader.

initialize_offsets(bitposition: int) int[source]

Initializes indexed offsets for the array.

Parameters:

bitposition – Current bit stream position.

Returns:

Updated bit stream position which points to the first bit after the array.

initialize_offsets_packed(bitposition: int) int[source]

Initializes indexed offsets for the packed array.

Parameters:

bitposition – Current bit stream position.

Returns:

Updated bit stream position which points to the first bit after the array.

property raw_array: List

Gets raw array.

Returns:

Native python list which is hold by the array.

read(reader: BitStreamReader, size: int = 0) None[source]

Reads array from the bit stream.

Parameters:
  • reader – Bit stream from which to read.

  • size – Number of elements to read or None in case of implicit or auto arrays.

Raises:

PythonRuntimeException – If the implicit array does not have elements with constant bit size.

read_packed(reader: BitStreamReader, size: int = 0) None[source]

Reads packed array from the bit stream.

Parameters:
  • reader – Bit stream from which to read.

  • size – Number of elements to read or 0 in case of auto arrays.

write(writer: BitStreamWriter) None[source]

Writes array to the bit stream.

Parameters:

writer – Bit stream where to write.

write_packed(writer: BitStreamWriter) None[source]

Writes packed array to the bit stream.

Parameters:

writer – Bit stream where to write.

class zserio.array.BitBufferArrayTraits[source]

Bases: object

Array traits for Zserio extern bit buffer type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[Any]) int

Calculates hash code for an object array value.

This is used for arrays of all objects (in zserio runtime or generated) which override the default __hash__ method.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: BitBuffer) int[source]

Returns length of Zserio extern bit buffer type stored in the bit stream in bits.

Parameters:

value – Zserio extern bit buffer type value.

Returns:

Length of given Zserio string type in bits.

static initialize_offsets(bitposition: int, value: BitBuffer) int[source]

Initializes indexed offsets for Zserio extern bit buffer type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio extern bit buffer type value.

Returns:

Updated bit stream position which points to the first bit after Zserio extern bit buffer type.

property packed_traits: None

Returns None since BitBuffer type is not packable.

Returns:

None.

static read(reader: BitStreamReader) BitBuffer[source]

Reads Zserio extern bit buffer type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read bit buffer value.

static write(writer: BitStreamWriter, value: BitBuffer) None[source]

Writes Zserio extern bit buffer type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio extern bit buffer type to write.

class zserio.array.BitFieldArrayTraits(numbits: int)[source]

Bases: object

Array traits for unsigned fixed integer Zserio types (uint16, uint32, uint64, bit:5, etc…).

Constructor.

Parameters:

numbits – Number of bits for unsigned fixed integer Zserio type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
bitsizeof() int[source]

Returns length of unsigned fixed integer Zserio type stored in the bit stream in bits.

Returns:

Length of unsigned fixed integer Zserio type in bits.

initialize_offsets(bitposition: int, _value: int) int[source]

Initializes indexed offsets for unsigned fixed integer Zserio type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after unsigned fixed integer type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

read(reader: BitStreamReader) int[source]

Reads unsigned fixed integer Zserio type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read unsigned int value.

write(writer: BitStreamWriter, value: int) None[source]

Writes unsigned fixed integer Zserio type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Unsigned fixed integer Zserio type to write.

class zserio.array.BoolArrayTraits[source]

Bases: object

Array traits for Zserio bool type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[bool]) int

Calculates hash code for a boolean array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof() int[source]

Returns length of Zserio bool type stored in the bit stream in bits.

Returns:

Length of Zserio bool type in bits.

static initialize_offsets(bitposition: int, _value: bool) int[source]

Initializes indexed offsets for Zserio bool type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after Zserio bool type.

property packed_traits: None

Returns None since Bool type is not packable.

Returns:

None.

static read(reader: BitStreamReader) bool[source]

Reads Zserio bool type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read bool value.

static write(writer: BitStreamWriter, value: bool) None[source]

Writes Zserio bool type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio bool type to write.

class zserio.array.BytesArrayTraits[source]

Bases: object

Array traits for Zserio bytes type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[bytearray]) int

Calculates hash code for a bytes array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: bytearray) int[source]

Returns length of Zserio bytes type stored in the bit stream in bits.

Parameters:

value – Zserio bytes type value.

Returns:

Length of given Zserio bytes type in bits.

static initialize_offsets(bitposition: int, value: bytearray) int[source]

Initializes indexed offsets for Zserio bytes type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio bytes type value.

Returns:

Updated bit stream position which points to the first bit after Zserio bytes type.

property packed_traits: None

Returns None since Bytes type is not packable.

Returns:

None.

static read(reader: BitStreamReader) bytearray[source]

Reads Zserio bytes type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read bytes value.

static write(writer: BitStreamWriter, value: bytearray) None[source]

Writes Zserio bytes type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio bytes type to write.

class zserio.array.DeltaContext[source]

Bases: object

Context for delta packing created for each packable field.

Contexts are always newly created for each array operation (bitsizeof, initialize_offsets, read, write). They must be initialized at first via calling the init method for each packable element present in the array. After the full initialization, only a single method (bitsizeof, read, write) can be repeatedly called for exactly the same sequence of packable elements.

Example:

context = DeltaContext(array_traits)
for element in array:
    context.init(element) # initialization step, needed for max_bit_number calculation
context.write_descriptor(writer) # finishes the initialization
for element in array:
    context.write(writer, element)

Constructor.

bitsizeof(array_traits: Any, element: int) int[source]

Returns length of the element representation stored in the bit stream in bits.

Parameters:
  • array_traits – Standard integral array traits.

  • element – Current element.

Returns:

Length of the element representation stored in the bit stream in bits.

init(array_traits: Any, element: int) None[source]

Makes initialization step for the provided array element.

Parameters:
  • array_traits – Standard array traits.

  • element – Current element of the array.

read(array_traits: Any, reader: BitStreamReader) int[source]

Reads the packed element from the bit stream.

Parameters:
  • array_traits – Standard array traits.

  • reader – Bit stream reader.

write(array_traits: Any, writer: BitStreamWriter, element: int) None[source]

Writes the packed element representation to the bit stream.

Parameters:
  • array_traits – Standard array traits.

  • writer – Bit stream writer.

  • element – Element to write.

class zserio.array.Float16ArrayTraits[source]

Bases: object

Array traits for Zserio float16 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for a 32-bit float array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof() int[source]

Returns length of Zserio float16 type stored in the bit stream in bits.

Returns:

Length of Zserio float16 type in bits.

static initialize_offsets(bitposition: int, _value: float) int[source]

Initializes indexed offsets for Zserio float16 type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after Zserio float16 type.

property packed_traits: None

Returns None since float type is not packable.

Returns:

None.

static read(reader: BitStreamReader) float[source]

Reads Zserio float16 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

static write(writer: BitStreamWriter, value: float) None[source]

Writes Zserio float16 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio float16 type to write.

Returns:

Read float16 value.

class zserio.array.Float32ArrayTraits[source]

Bases: object

Array traits for Zserio float32 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for a 32-bit float array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof() int[source]

Returns length of Zserio float32 type stored in the bit stream in bits.

Returns:

Length of Zserio float32 type in bits.

static initialize_offsets(bitposition: int, _value: float) int[source]

Initializes indexed offsets for Zserio float32 type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after Zserio float32 type.

property packed_traits: None

Returns None since float type is not packable.

Returns:

None.

static read(reader: BitStreamReader) float[source]

Reads Zserio float32 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read float32 value.

static write(writer: BitStreamWriter, value: float) None[source]

Writes Zserio float32 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio float32 type to write.

class zserio.array.Float64ArrayTraits[source]

Bases: object

Array traits for Zserio float64 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for a 64-bit float array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof() int[source]

Returns length of Zserio float64 type stored in the bit stream in bits.

Returns:

Length of Zserio float64 type in bits.

static initialize_offsets(bitposition: int, _value: float) int[source]

Initializes indexed offsets for Zserio float64 type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after Zserio float64 type.

property packed_traits: None

Returns None since float type is not packable.

Returns:

None.

static read(reader: BitStreamReader) float[source]

Reads Zserio float64 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read float64 value.

static write(writer: BitStreamWriter, value: float) None[source]

Writes Zserio float64 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio float64 type to write.

class zserio.array.ObjectArrayTraits(element_factory: Any)[source]

Bases: object

Array traits for Zserio structure, choice, union and enum types.

Constructor.

Parameters:

element_factory – Element factory which creates object from the element index.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[Any]) int

Calculates hash code for an object array value.

This is used for arrays of all objects (in zserio runtime or generated) which override the default __hash__ method.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = True
NEEDS_READ_INDEX = True
static bitsizeof(bitposition: int, value: Any) int[source]

Returns length of Zserio object type stored in the bit stream in bits.

Parameters:
  • bitposition – Current bit position in bit stream.

  • value – Zserio object type value.

Returns:

Length of given Zserio object type in bits.

static initialize_offsets(bitposition: int, value: Any) int[source]

Initializes indexed offsets for the Zserio object type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio object type value.

Returns:

Updated bit stream position which points to the first bit after the Zserio object type.

property packed_traits: ObjectPackedArrayTraits | None

Gets packed array traits.

Returns:

ObjectPackedArrayTraits instance.

read(reader: BitStreamReader, index: int) Any[source]

Reads Zserio object type from the bit stream.

Parameters:
  • reader – Bit stream from which to read.

  • index – Element index in the array.

Returns:

Read object.

static write(writer: BitStreamWriter, value: Any) None[source]

Writes Zserio object type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio object type to write.

class zserio.array.ObjectPackedArrayTraits(element_factory: Any)[source]

Bases: object

Packed array traits for Zserio objects.

This traits are used for Zserio objects which must implement special _packed methods to allow itself to be used in a packed array.

Constructor.

Parameters:

element_factory – Element factory which creates packed object from the element index.

static bitsizeof(context: Any, bitposition: int, element: Any) int[source]

Returns length of the array element stored in the bit stream in bits.

Parameters:
  • context – Packing context.

  • bitposition – Current bit stream position.

  • elemnet – Current element.

Returns:

Length of the array element stored in the bit stream in bits.

create_context() Any[source]

Creates new packing context - generated ZserioPackingContext is used for object arrays.

Returns:

New packing context.

static init_context(context: Any, element: Any) None[source]

Calls context initialization step for the current element.

Parameters:
  • context – Packing context.

  • element – Current element.

static initialize_offsets(context: Any, bitposition: int, element: Any) int[source]

Calls indexed offsets initialization for the current element.

Parameters:
  • context – Packing context.

  • bitposition – Current bit stream position.

  • element – Current element.

Returns:

Updated bit stream position which points to the first bit after this element.

read(context: Any, reader: BitStreamReader, index: int) Any[source]

Read an element from the bit stream.

Parameters:
  • context – Packing context.

  • reader – Bit stream reader.

  • index – Index of the current element.

Returns:

Read element value.

static write(context: Any, writer: BitStreamWriter, element: Any) None[source]

Writes the element to the bit stream.

Parameters:
  • context – Packing context.

  • writer – Bit stream writer.

  • element – Element to write.

class zserio.array.PackedArrayTraits(array_traits: Any)[source]

Bases: object

Packed array traits.

Packed array traits are used for all built-in types.

Constructor.

Parameters:

array_traits – Standard array traits.

bitsizeof(delta_context: DeltaContext, _bitposition: int, element: int) int[source]

Returns length of the array element stored in the bit stream in bits.

Parameters:
  • delta_context – Delta context.

  • _bitposition – Current bit stream position (not used).

  • elemnet – Current element.

Returns:

Length of the array element stored in the bit stream in bits.

static create_context() DeltaContext[source]

Creates new packing context - DeltaContext is used for non-object arrays.

Returns:

New packing context.

init_context(delta_context: DeltaContext, element: int) None[source]

Calls context initialization step for the current element.

Parameters:
  • delta_context – Delta context.

  • element – Current element.

initialize_offsets(delta_context: DeltaContext, bitposition: int, element: int) int[source]

Calls indexed offsets initialization for the current element.

Parameters:
  • delta_context – Delta context.

  • _bitposition – Current bit stream position.

  • element – Current element.

Returns:

Updated bit stream position which points to the first bit after this element.

read(delta_context: DeltaContext, reader: BitStreamReader, _index: int) int[source]

Read an element from the bit stream.

Parameters:
  • delta_context – Delta context.

  • reader – Bit stream reader.

  • _index – Not used.

Returns:

Read element value.

write(delta_context: DeltaContext, writer: BitStreamWriter, element: int) None[source]

Writes the element to the bit stream.

Parameters:
  • delta_context – Delta context.

  • writer – Bit stream writer.

  • element – Element to write.

class zserio.array.SignedBitFieldArrayTraits(numbits: int)[source]

Bases: object

Array traits for signed fixed integer Zserio types (int16, int32, int64, int:5, etc…).

Constructor.

Parameters:

numbits – Number of bits for signed fixed integer Zserio type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = True
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
bitsizeof() int[source]

Returns length of signed fixed integer Zserio type stored in the bit stream in bits.

Returns:

Length of signed fixed integer Zserio type in bits.

initialize_offsets(bitposition: int, _value: int) int[source]

Initializes indexed offsets for signed fixed integer Zserio type.

Parameters:
  • bitposition – Current bit stream position.

  • _value – Not used.

Returns:

Updated bit stream position which points to the first bit after signed fixed integer type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

read(reader: BitStreamReader) int[source]

Reads signed fixed integer Zserio type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read signed int value.

write(writer: BitStreamWriter, value: int) None[source]

Writes signed fixed integer Zserio type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Signed fixed integer Zserio type to write.

class zserio.array.StringArrayTraits[source]

Bases: object

Array traits for Zserio string type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[str]) int

Calculates hash code for a string array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: str) int[source]

Returns length of Zserio string type stored in the bit stream in bits.

Parameters:

value – Zserio string type value.

Returns:

Length of given Zserio string type in bits.

static initialize_offsets(bitposition: int, value: str) int[source]

Initializes indexed offsets for Zserio string type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio string type value.

Returns:

Updated bit stream position which points to the first bit after Zserio string type.

property packed_traits: None

Returns None since String type is not packable.

Returns:

None.

static read(reader: BitStreamReader) str[source]

Reads Zserio string type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read string value.

static write(writer: BitStreamWriter, value: str) None[source]

Writes Zserio string type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio string type to write.

class zserio.array.VarInt16ArrayTraits[source]

Bases: object

Array traits for Zserio varint16 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varint16 type stored in the bit stream in bits.

Parameters:

value – Zserio varint16 type value.

Returns:

Length of given Zserio varint16 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varint16 type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varint16 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varint16 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varint16 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varint16 value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varint16 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varint16 type to write.

class zserio.array.VarInt32ArrayTraits[source]

Bases: object

Array traits for Zserio varint32 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varint32 type stored in the bit stream in bits.

Parameters:

value – Zserio varint32 type value.

Returns:

Length of given Zserio varint32 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varint32 type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varint32 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varint32 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varint32 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varint32 value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varint32 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varint32 type to write.

class zserio.array.VarInt64ArrayTraits[source]

Bases: object

Array traits for Zserio varint64 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varint64 type stored in the bit stream in bits.

Parameters:

value – Zserio varint64 type value.

Returns:

Length of given Zserio varint64 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varint64 type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varint64 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varint64 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varint64 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varint64 value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varint64 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varint64 type to write.

class zserio.array.VarIntArrayTraits[source]

Bases: object

Array traits for Zserio varint type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varint type stored in the bit stream in bits.

Parameters:

value – Zserio varint type value.

Returns:

Length of given Zserio varint type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varint type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varint type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varint type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varint type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varint value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varint type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varint type to write.

class zserio.array.VarSizeArrayTraits[source]

Bases: object

Array traits for Zserio varsize type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varsize type stored in the bit stream in bits.

Parameters:

value – Zserio varsize type value.

Returns:

Length of given Zserio varsize type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varsize type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varsize type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varsize type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varsize type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varsize value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varsize type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varsize type to write.

class zserio.array.VarUInt16ArrayTraits[source]

Bases: object

Array traits for Zserio varuint16 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varuint16 type stored in the bit stream in bits.

Parameters:

value – Zserio varuint16 type value.

Returns:

Length of given Zserio varuint16 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varuint16 type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varuint16 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varuint16 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varuint16 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varuint16 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varuint16 type to write.

Returns:

Read varuint16 value.

class zserio.array.VarUInt32ArrayTraits[source]

Bases: object

Array traits for Zserio varuint32 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varuint32 type stored in the bit stream in bits.

Parameters:

value – Zserio varuint32 type value.

Returns:

Length of given Zserio varuint32 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varuint32 type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varuint32 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varuint32 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varuint32 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varuint32 value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varuint32 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varuint32 type to write.

class zserio.array.VarUInt64ArrayTraits[source]

Bases: object

Array traits for Zserio varuint64 type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varuint64 type stored in the bit stream in bits.

Parameters:

value – Zserio varuint64 type value.

Returns:

Length of given Zserio varuint64 type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varuint64 type.

Parameters:

value – Zserio varuint64 type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varuint64 type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varuint64 type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varuint64 value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varuint64 type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varuint64 type to write.

class zserio.array.VarUIntArrayTraits[source]

Bases: object

Array traits for Zserio varuint type.

static CALC_HASHCODE_FUNC(seed_value: int, value: List[int]) int

Calculates hash code for an integral array value.

Parameters:
  • seed_value – Seed value (current hash code).

  • value – Value to use.

Returns:

Calculated hash code.

HAS_BITSIZEOF_CONSTANT = False
NEEDS_BITSIZEOF_POSITION = False
NEEDS_READ_INDEX = False
static bitsizeof(value: int) int[source]

Returns length of Zserio varuint type stored in the bit stream in bits.

Parameters:

value – Zserio varuint type value.

Returns:

Length of given Zserio varuint type in bits.

static initialize_offsets(bitposition: int, value: int) int[source]

Initializes indexed offsets for Zserio varuint type.

Parameters:
  • bitposition – Current bit stream position.

  • value – Zserio varuint type value.

Returns:

Updated bit stream position which points to the first bit after Zserio varuint type.

property packed_traits: PackedArrayTraits

Gets packed array traits.

Returns:

PackedArrayTraits instance.

static read(reader: BitStreamReader) int[source]

Reads Zserio varuint type from the bit stream.

Parameters:

reader – Bit stream from which to read.

Returns:

Read varuint value.

static write(writer: BitStreamWriter, value: int) None[source]

Writes Zserio varuint type to the bit stream.

Parameters:
  • writer – Bit stream where to write.

  • value – Zserio varuint type to write.