runtimepy.primitives.serializable package#
Submodules#
runtimepy.primitives.serializable.base module#
A module defining a base interface fore serializable objects.
- class runtimepy.primitives.serializable.base.Serializable(byte_order: ByteOrder = ByteOrder.NETWORK, chain: T = None)[source]#
Bases:
ABC
An interface for serializable objects.
- add_to_end(chain: T, array_length: int = None) list[T] [source]#
Add a new serializable to the end of this chain.
- property end: Serializable#
Get the end of this chain.
- from_stream(stream: BinaryIO, timestamp_ns: int = None) int [source]#
Update this serializable from a stream.
- size: int#
- abstractmethod update(data: bytes, timestamp_ns: int = None) int [source]#
Update this serializable from a bytes instance.
- update_chain(data: bytes, timestamp_ns: int = None) int [source]#
Update this serializable from a bytes instance.
runtimepy.primitives.serializable.fixed module#
A module implementing a fixed-size bytes serializable.
- class runtimepy.primitives.serializable.fixed.FixedChunk(data: bytes, chain: Serializable = None)[source]#
Bases:
Serializable
A simple fixed-size serializable chunk.
runtimepy.primitives.serializable.framer module#
A module implementing a message framing interface for serializables.
- class runtimepy.primitives.serializable.framer.SerializableFramer(instance: Serializable, mtu: int)[source]#
Bases:
object
A class implementing a serializable message framer.
- capture(sample: bool = True, flush: bool = False) bytes | None [source]#
Optionally sample this struct and attempt to resolve a full or flushed frame.
- elements: int#
- raw: bytes#
runtimepy.primitives.serializable.prefixed module#
A module implementing a variable-size bytes serializable, using an integer primitive prefix to determine the size of the chunk portion.
- class runtimepy.primitives.serializable.prefixed.PrefixedChunk(prefix: Uint8Primitive | Uint16Primitive | Uint32Primitive | Uint64Primitive, byte_order: ByteOrder = ByteOrder.NETWORK, chain: Serializable = None)[source]#
Bases:
Serializable
A simple integer-prefixed chunk serializable.
- classmethod create(prefix: type[Int8Primitive | Int16Primitive | Int32Primitive | Int64Primitive | Uint8Primitive | Uint16Primitive | Uint32Primitive | Uint64Primitive | HalfPrimitive | FloatPrimitive | DoublePrimitive | BooleanPrimitive] | str = 'uint16', chain: Serializable = None) T [source]#
Create a prefixed chunk.
Module contents#
A module defining an interface for serializable objects.
- class runtimepy.primitives.serializable.FixedChunk(data: bytes, chain: Serializable = None)[source]#
Bases:
Serializable
A simple fixed-size serializable chunk.
- class runtimepy.primitives.serializable.PrefixedChunk(prefix: Uint8Primitive | Uint16Primitive | Uint32Primitive | Uint64Primitive, byte_order: ByteOrder = ByteOrder.NETWORK, chain: Serializable = None)[source]#
Bases:
Serializable
A simple integer-prefixed chunk serializable.
- classmethod create(prefix: type[Int8Primitive | Int16Primitive | Int32Primitive | Int64Primitive | Uint8Primitive | Uint16Primitive | Uint32Primitive | Uint64Primitive | HalfPrimitive | FloatPrimitive | DoublePrimitive | BooleanPrimitive] | str = 'uint16', chain: Serializable = None) T [source]#
Create a prefixed chunk.
- class runtimepy.primitives.serializable.Serializable(byte_order: ByteOrder = ByteOrder.NETWORK, chain: T = None)[source]#
Bases:
ABC
An interface for serializable objects.
- add_to_end(chain: T, array_length: int = None) list[T] [source]#
Add a new serializable to the end of this chain.
- property end: Serializable#
Get the end of this chain.
- from_stream(stream: BinaryIO, timestamp_ns: int = None) int [source]#
Update this serializable from a stream.
- size: int#
- abstractmethod update(data: bytes, timestamp_ns: int = None) int [source]#
Update this serializable from a bytes instance.
- update_chain(data: bytes, timestamp_ns: int = None) int [source]#
Update this serializable from a bytes instance.