vfbLib.compilers.base.BaseCompiler
- class vfbLib.compilers.base.BaseCompiler
Bases:
StreamWriterBase class to compile vfb data.
Methods
__init__()compile(data[, master_count])Compile the JSON-like main data structure and return the compiled binary data.
compile_hex(data[, master_count])Compile the data given into a hex string format, e.g. "8c 8d 89 8b".
merge(masters_data, data)Merge the data of additional masters into the main data structure.
write_bytes(value)Write binary data to the stream.
write_double(value)write_doubles(values)Write several double-precision floats to the stream.
write_float(value[, fmt])Write a float value to the stream.
write_floats(values)write_int16(value)write_int32(value)write_str(value[, pad])write_uint16(value)Write a uint16 value to the stream.
write_uint32(value)write_uint8(value)Write a uint8 value to the stream.
write_value(value[, shortest])Encode and write an int value to the stream.
- compile(data: Any, master_count: int = 0) bytes
Compile the JSON-like main data structure and return the compiled binary data.
The actual compilation is done by calling the _compile method, which must be implemented for all specialized compiler subclasses.
- compile_hex(data: Any, master_count: int = 0) str
Compile the data given into a hex string format, e.g. “8c 8d 89 8b”. Used for testing.
- classmethod merge(masters_data: list[Any], data: Any) None
Merge the data of additional masters into the main data structure. This operates on the uncompiled JSON-like data structure.
- Parameters:
masters_data (List[Any]) – The additional masters data as a list with one entry per master.
data (Any) – The main data structure.
- write_bytes(value: bytes) None
Write binary data to the stream.
- Parameters:
value (bytes) – The data.
- write_uint16(value: int) None
Write a uint16 value to the stream.
- Parameters:
value (int) – The integer to write.
- write_uint8(value: int) None
Write a uint8 value to the stream.
- Parameters:
value (int) – The integer to write.