Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel

Class Xtc

Python wrapper for pdsdata/xtc/Xtc class. In addition to methods described below this class implements Python iterator interface. Instance can be used as iterator only when its contains type is TypeId.Type.Id_Xtc.


Construction

This class cannot be instantiated directly, methods of other classes return instances of this type.


Property damage

Usage: dmg = xtcObj.damage

Returns damage bitmask as an object of xtc.Damage type.


Property src

Usage: src = xtcObj.src

Returns data source object. Depending on the source level the type of the returned object will be one of xtc.BldInfo, xtc.DetInfo, or xtc.ProcInfo.


Property contains

Usage: typeId = xtcObj.contains

Returns the type of the object contained in XTC as object od xtc.TypeId type.


Property extent

Usage: size = xtcObj.extent

Returns the extent (total size) of the XTC.


Method sizeofPayload()

Usage: size = xtcObj.sizeofPayload()

Returns the size of payload object.


Method payload()

Usage: obj = xtcObj.payload()

Returns data object. If contains is TypeId.Type.Any it returns None. If contains is TypeId.Type.Id_Xtc it returns xtc.XtcIterator object. For other values it returns one of the specific types such as acqiris.ConfigV1.

...

Panel

Class XtcFileIterator

Unlike its C++ counterpart class pdsdata/xtc/XtcFileIterator this Python class implements true Python iterator interface. Like the C++ class it also returns objects of type xtc.Dgram. It does not have any special methods besides what is need for iterator. Typical use of this class is like this:

Code Block
none
none

    # iterate over all datagrams in a file
    for dg in xtc.XtcFileIterator(file):
        # do something with datagram
        xtcObj = dg.xtc

Construction

Usage: iter = XtcFileIterator(file)

Arguments:

  • file – regular Python file object, for example created with open() function

...

Panel

Class XtcIterator

This class is not like its C++ counterpart pdsdata/xtc/XtcIterator. It implements true Python iterator interface, the return type for the iterator is xtc.Xtc. Typical use of this class is like this:

Code Block
none
none

    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtc.XtcIterator(xtcObj):
            ..................

    # which is identical to this
    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtcObj.payload():
            ..................

    # and also identical to this
    if xtcObj.contains == xtc.TypeId.Type.Id_Xtc:
        for subXtc in xtcObj:
            ..................

Construction

Usage: iter = xtc.Xtciterator(xtcObj)

Arguments:

  • xtcObj – XTC object whose contains type is Id_Xtc, otherwise an exception will be thrown.