serial_class Derived Type

type, public :: serial_class

Serialisation class.


Type-Bound Procedures

procedure, public :: create => serial_create

  • private subroutine serial_create(this, type, format, callback, unit, empty, header, newline, separator, error)

    Constructor of serialisation class. Argument type must be one of:

    • beat_type
    • log_type
    • node_type
    • observ_type
    • sensor_type
    • target_type

    If argument newline is passed and .true., a newline character is appended to output in format CSV, JSONL, or NML passed to the callback routine callback. The argument error is set to E_INVALID if one of the arguments is invalid.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(out) :: this

    Serial object to create.

    class(*), intent(inout) :: type

    Type to serialise.

    integer, intent(in) :: format

    Format enumerator (FORMAT_*).

    procedure(dm_serial_callback), optional :: callback

    Output callback.

    integer, intent(in), optional :: unit

    Output unit.

    logical, intent(in), optional :: empty

    No content to expect.

    logical, intent(in), optional :: header

    Add CSV header.

    logical, intent(in), optional :: newline

    Add newline to callback argument.

    character(len=1), intent(in), optional :: separator

    CSV separator.

    integer, intent(out), optional :: error

    Error code.

procedure, public :: destroy => serial_destroy

  • private subroutine serial_destroy(this, error)

    Destroys serialisation object and outputs last bytes.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    integer, intent(out), optional :: error

    Error code.

generic, public :: next => next_beat, next_log, next_node, next_observ, next_sensor, next_target

  • private subroutine serial_next_beat(this, beat, error)

    Serialises the passed beat type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(beat_type), intent(inout) :: beat

    Beat type.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine serial_next_log(this, log, error)

    Serialises the passed log type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(log_type), intent(inout) :: log

    Log type.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine serial_next_node(this, node, error)

    Serialises the passed node type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(node_type), intent(inout) :: node

    Node type.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine serial_next_observ(this, observ, error)

    Serialises the passed observation type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(observ_type), intent(inout) :: observ

    Observation type.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine serial_next_sensor(this, sensor, error)

    Serialises the passed sensor type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(sensor_type), intent(inout) :: sensor

    Sensor type.

    integer, intent(out), optional :: error

    Error code.

  • private subroutine serial_next_target(this, target, error)

    Serialises the passed target type to CSV, JSON, JSONL, or Namelist, depending on the format configured.

    On error, the subroutine sets argument error to:

    • E_EMPTY if the serial object has been declared as empty.
    • E_WRITE if writing to unit failed.

    Arguments

    Type IntentOptional Attributes Name
    class(serial_class), intent(inout) :: this

    Serial object.

    type(target_type), intent(inout) :: target

    Target type.

    integer, intent(out), optional :: error

    Error code.