[docs]classFrameGenerator(ABC,Serializable):"""Base class for frame generators."""
[docs]@abstractmethoddefpack_frame(self,source:BitsSource,num_bits:int)->np.ndarray:"""Generate a frame of num_bits bits from the given bitsource. Args: source: Payload source. num_bits: Number of bits in the whole resulting frame. Returns: Array of ints with each element beeing an individual bit. """...# pragma: no cover
[docs]@abstractmethoddefunpack_frame(self,frame:np.ndarray)->np.ndarray:"""Extract the original payload from the frame generated with pack_frame. Args: frame: Array of bits of a frame, generated with pack_frame. Returns: Array of payload bits."""...# pragma: no cover
[docs]classFrameGeneratorStub(FrameGenerator):"""A dummy placeholder frame generator, packing and unpacking payload without any overhead."""