def __init__(self, *args, **kwargs):
        """Creates a new PacketDefinition."""
        for slot in PacketDefinition.__slots__:
            name = slot[1:] if slot.startswith("_") else slot
            setattr(self, slot, kwargs.get(name, None))

        if self.ccsds:
            import ccsds
            self.ccsds = ccsds.CcsdsDefinition(**self.ccsds)

        if self.derivations is None:
            self.derivations   = [ ]
            self.derivationmap = { }
        else:
            self.derivations   = handle_includes(self.derivations)
            self.derivationmap = { defn.name: defn for defn in self.derivations }

        if self.fields is None:
            self.fields   = [ ]
            self.fieldmap = { }
        else:
            self.fields   = handle_includes(self.fields)
            self.fieldmap = { defn.name: defn for defn in self.fields }

        if self.history:
            self.history = PacketHistory(self, names=self.history)

        if self.ccsds:
            self.uid = self.ccsds.apid
        else:
            self.uid                  = PacketDefinition.NextUID
            PacketDefinition.NextUID += 1

        self._update_globals()
        self._update_bytes(self.fields)
def __init__ ( self , * args , ** kwargs ) : for slot in PacketDefinition . __slots__ : name = slot [ 1 : ] if slot . startswith ( "_" ) else slot setattr ( self , slot , kwargs . get ( name , None ) ) if self . ccsds : import ccsds self . ccsds = ccsds . CcsdsDefinition ( ** self . ccsds ) if self . derivations is None : self . derivations = [ ] self . derivationmap = { } else : self . derivations = handle_includes ( self . derivations ) self . derivationmap = { defn . name : defn for defn in self . derivations } if self . fields is None : self . fields = [ ] self . fieldmap = { } else : self . fields = handle_includes ( self . fields ) self . fieldmap = { defn . name : defn for defn in self . fields } if self . history : self . history = PacketHistory ( self , names = self . history ) if self . ccsds : self . uid = self . ccsds . apid else : self . uid = PacketDefinition . NextUID PacketDefinition . NextUID += 1 self . _update_globals ( ) self . _update_bytes ( self . fields )
Creates a new PacketDefinition.