| |
- runtimepy.codec.protocol.base.ProtocolBase(builtins.object)
-
- JsonProtocol
class JsonProtocol(runtimepy.codec.protocol.base.ProtocolBase) |
|
JsonProtocol(enum_registry: runtimepy.enum.registry.EnumRegistry, names: runtimepy.registry.name.NameRegistry = None, fields: runtimepy.primitives.field.manager.BitFieldsManager = None, build: list[typing.Union[int, runtimepy.codec.protocol.base.FieldSpec, str]] = None, identifier: int = 1, byte_order: Union[runtimepy.primitives.byte_order.ByteOrder, str, int] = <ByteOrder.NETWORK: 4>, serializables: dict[str, runtimepy.primitives.serializable.base.Serializable] = None) -> None
A class for defining runtime communication protocols. |
|
- Method resolution order:
- JsonProtocol
- runtimepy.codec.protocol.base.ProtocolBase
- builtins.object
Methods defined here:
- export_json(self, resolve_enum: bool = True) -> dict[str, typing.Dict[str, typing.Union[str, int, float, bool, NoneType, typing.Dict[str, typing.Union[str, int, float, bool, NoneType]], typing.List[typing.Union[str, int, float, bool, NoneType]]]]]
- Export this protocol's data to JSON.
- meta_bytes(self, resolve_enum: bool = True) -> bytes
- Get protocol metadata as a bytes object.
- meta_str(self, resolve_enum: bool = True) -> str
- Get protocol metadata as a string..
- write_meta(self, stream: <class 'BinaryIO'>, resolve_enum: bool = True) -> int
- Write protocol metadata to a stream.
Class methods defined here:
- import_json(data: dict[str, typing.Dict[str, typing.Union[str, int, float, bool, NoneType, typing.Dict[str, typing.Union[str, int, float, bool, NoneType]], typing.List[typing.Union[str, int, float, bool, NoneType]]]]]) -> ~T from builtins.type
- Create a bit-fields manager from JSON data.
Methods inherited from runtimepy.codec.protocol.base.ProtocolBase:
- __copy__(self: ~T) -> ~T
- Create another protocol instance from this one.
- __getitem__(self, name: str) -> Union[int, float, bool, str]
- Get the value of a protocol field.
- __init__(self, enum_registry: runtimepy.enum.registry.EnumRegistry, names: runtimepy.registry.name.NameRegistry = None, fields: runtimepy.primitives.field.manager.BitFieldsManager = None, build: list[typing.Union[int, runtimepy.codec.protocol.base.FieldSpec, str]] = None, identifier: int = 1, byte_order: Union[runtimepy.primitives.byte_order.ByteOrder, str, int] = <ByteOrder.NETWORK: 4>, serializables: dict[str, runtimepy.primitives.serializable.base.Serializable] = None) -> None
- Initialize this protocol.
- __setitem__(self, name: str, val: Union[int, float, bool, str]) -> None
- Set a value of a field belonging to the protocol.
- __str__(self) -> str
- Get this instance as a string.
- add_bit_fields(self, kind: Union[type[Union[runtimepy.primitives.int.Int8Primitive, runtimepy.primitives.int.Int16Primitive, runtimepy.primitives.int.Int32Primitive, runtimepy.primitives.int.Int64Primitive, runtimepy.primitives.int.Uint8Primitive, runtimepy.primitives.int.Uint16Primitive, runtimepy.primitives.int.Uint32Primitive, runtimepy.primitives.int.Uint64Primitive, runtimepy.primitives.float.HalfPrimitive, runtimepy.primitives.float.FloatPrimitive, runtimepy.primitives.float.DoublePrimitive, runtimepy.primitives.bool.BooleanPrimitive]], str] = 'uint8') -> Iterator[runtimepy.primitives.field.fields.BitFields]
- Add a bit-fields primitive to the protocol.
- add_field(self, name: str, kind: Union[type[Union[runtimepy.primitives.int.Int8Primitive, runtimepy.primitives.int.Int16Primitive, runtimepy.primitives.int.Int32Primitive, runtimepy.primitives.int.Int64Primitive, runtimepy.primitives.int.Uint8Primitive, runtimepy.primitives.int.Uint16Primitive, runtimepy.primitives.int.Uint32Primitive, runtimepy.primitives.int.Uint64Primitive, runtimepy.primitives.float.HalfPrimitive, runtimepy.primitives.float.FloatPrimitive, runtimepy.primitives.float.DoublePrimitive, runtimepy.primitives.bool.BooleanPrimitive]], str] = None, enum: Union[str, int] = None, serializable: runtimepy.primitives.serializable.base.Serializable = None, track: bool = True, array_length: int = None) -> int
- Add a new field to the protocol.
- add_serializable(self, name: str, serializable: runtimepy.primitives.serializable.base.Serializable, array_length: int = None) -> int
- Add a serializable instance.
- register_name(self, name: str) -> int
- Register the field name.
- trace_size(self, logger: Union[logging.Logger, logging.LoggerAdapter[Any]]) -> None
- Log a size trace.
- value(self, name: str, resolve_enum: bool = True) -> Union[int, float, bool, str]
- Get the value of a field belonging to the protocol.
Readonly properties inherited from runtimepy.codec.protocol.base.ProtocolBase:
- size
- Get this protocol's size in bytes.
Data descriptors inherited from runtimepy.codec.protocol.base.ProtocolBase:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |