Peach :: Generators :: dictionary :: Flags2 :: Class Flags2
[hide private]

Class Flags2

source code


Define the layout of flags and provide a generator for each. Each flag has a position, length, and generator. The Flag itself also has a total length and byte order (litte or big). If values generated for each field in the flag are masked such as they always fit and do not affect other fields in the flag.

Example:

>>> gen = Flags2(None, 8, [ [0, 1, Bit()], [4, 1, Bit()], [6, 2, List(None, [0, 1, 2])] ])
>>> print gen.getValue()
0
>>> gen.next()
>>> print gen.getValue()
81
>>> gen.next()
>>> print gen.getValue()
145
>>> gen.next()
>>> print gen.getValue()
209
Instance Methods [hide private]
 
__init__(self, group, length, flags, isLittleEndian=True) source code
 
next(self) source code
 
getRawValue(self) source code
Method Details [hide private]

__init__(self, group, length, flags, isLittleEndian=True)
(Constructor)

source code 
Parameters:
  • group (Group) - Group for this Generator
  • flags (Array of Arrays) - Each sub-array must contain a position (zero based), length (in bits), and a generator.
  • length (Integer)