BIT STRINGs with named bits

A Python class is generated for an ASN.1 BIT STRING defined with named bits. The generated class defines attributes and properties that are useful for working with the value using the named bits. As an example, consider this ASN.1:

Operations ::= BIT STRING  { compute-checksum(0), compute-signature(1), 
   verify-checksum(2), verify-signature(3), encipher(4), decipher(5), hash(6),
   generate-key(7) }        
      

The resulting (elided) class is:

class Operations(univ.NamedBitsBase):
    ...
    named_bits = {0: "compute-checksum",
        1: "compute-signature",
        ...        
        7: "generate-key"}
        """Named bit map for use with NamedBitsBase."""
        
    @property
    def compute_checksum(self):
    """Return true if compute-checksum bit is set."""
    ...
        
    @compute_checksum.setter
    def compute_checksum(self, value=True):
    """Set compute-checksum bit on/off."""
    ...

As you can see, properties are defined with names correponding to each of the named bits. You can use these to set/get the value of each named bit.

Also, the generated class derives from osyspyrt.asn1univtype.NamedBitBase, so that it ultimately derives from, and enhances, the behavior of osyspyrt.asn1univtype.Asn1BitString. In particular:

You are not required to use the generated class, but the generated decoders will use it for decoded values.