Beispiel #1
0
    def __init__(self, ref):
        """
        Create either a new TRE or refer to an existing underlying TRE
        The ref parameter is checked
        """
        self.error = Error()

        if isinstance(ref, str):
            tag = ref
            ref = nitropy.nitf_TRE_construct(tag, None, self.error)
            if not ref:
                raise Exception('Unable to create TRE with tag \'%s\'' % tag)
        self.ref = ref
Beispiel #2
0
 def newSubheaderFields(self, tag, id=None):
     self.ref.subheaderFields = nitropy.nitf_TRE_construct(
         tag, id, self.error)
     if not self.ref.subheaderFields:
         raise Exception('Unable to create TRE with tag \'%s\'' % tag)
     return TRE(self.ref.subheaderFields)