def __init__(self, parent, name, stream, description, size): BasicFieldSet.__init__(self, parent, name, stream, description, size) self._generator = self.createFields() self._offset = 0 self._current_size = 0 if size: self._current_max_size = size else: self._current_max_size = 0 self._field_dict = {} self._field_array = []
def reset(self): """ Reset a field set: * clear fields ; * restart field generator ; * set current size to zero ; * clear field array count. But keep: name, value, description and size. """ BasicFieldSet.reset(self) self._fields = Dict() self._field_generator = self.createFields() self._current_size = 0 self._array_cache = {}
def __init__(self, parent, name, stream, description=None, size=None): """ Constructor @param parent: Parent field set, None for root parser @param name: Name of the field, have to be unique in parent. If it ends with "[]", end will be replaced with "[new_id]" (eg. "raw[]" becomes "raw[0]", next will be "raw[1]", and then "raw[2]", etc.) @type name: str @param stream: Input stream from which data are read @type stream: L{InputStream} @param description: Optional string description @type description: str|None @param size: Size in bits. If it's None, size will be computed. You can also set size with class attribute static_size """ BasicFieldSet.__init__(self, parent, name, stream, description, size) self._fields = Dict() self._field_generator = self.createFields() self._array_cache = {} self.__is_feeding = False