!Enum

The !Enum tag allows the value of a !Field or !Port to be discretised into a number of named, integer values.

Usage

The !Enum tag is primitive and so it may be declared using either sequence or mapping syntax - examples of both formats are given below:

- !Field
  name : my_field
  width: 2
  enums:
  - !Enum [state_a, 0, "First state"]
  - !Enum
    name: state_b
    val : 1
    sd  : Second state
  ...
class blade.schema.ph_enum.Enum(name, val='', sd='', ld='', options=[], hir_name='')

Enumerates the value of a !Field or !Port using named constants

__init__(name, val='', sd='', ld='', options=[], hir_name='')

Initialisation of the !Enum tag

Parameters
  • name – Name of the discretised value

  • val – The integer value this enumerated item should represent

  • sd – Short description of the value - maximum 150 characters

  • ld – Long description - no maximum length

  • options – List of options either in the form ‘KEY=VAL’ or just ‘KEY’ if a value is not required.

  • hir_name – Deprecated - to be removed.

validate()

Check that this tag agrees with our YAML schema