dm_csv Module

Contains subroutines to convert various derived types to CSV format.


Uses

  • module~~dm_csv~~UsesGraph module~dm_csv dm_csv module~dm_ascii dm_ascii module~dm_csv->module~dm_ascii module~dm_error dm_error module~dm_csv->module~dm_error module~dm_kind dm_kind module~dm_csv->module~dm_kind module~dm_string dm_string module~dm_csv->module~dm_string module~dm_util dm_util module~dm_csv->module~dm_util module~dm_error->module~dm_ascii module~dm_error->module~dm_kind iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_string->module~dm_error module~dm_string->module~dm_kind module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_csv~~UsedByGraph module~dm_csv dm_csv module~dmpack dmpack module~dmpack->module~dm_csv

Variables

Type Visibility Attributes Name Initial
character(len=1), public, parameter :: CSV_SEPARATOR = ','

Default CSV field separator.

integer, public, parameter :: CSV_BUFFER_LEN = 8192

CSV line buffer length.


Interfaces

public interface dm_csv_from

Generic derived type to CSV serialisation function.

  • private function csv_from_beat(beat, separator) result(csv)

    Returns allocatable string of beat in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(beat_type), intent(inout) :: beat

    Beat type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_beats(beats, header, separator) result(csv)

    Returns allocatable string of beats in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(beat_type), intent(inout) :: beats(:)

    Beat array.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_data_point(dp, separator) result(csv)

    Arguments

    Type IntentOptional Attributes Name
    type(dp_type), intent(inout) :: dp

    Data point type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_data_points(data_points, header, separator) result(csv)

    Returns allocatable string of data points in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(dp_type), intent(inout) :: data_points(:)

    Data point array.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_log(log, separator) result(csv)

    Returns allocatable string of log in CSV format: id, level, error, timestamp, node_id, sensor_id, target_id, observ_id, message.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(inout) :: log

    Log data.

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

    CSV field separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_logs(logs, header, separator) result(csv)

    Returns allocatable string of logs in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(inout) :: logs(:)

    Array of log data.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_node(node, separator) result(csv)

    Returns allocatable string of node in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(node_type), intent(inout) :: node

    Node type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_nodes(nodes, header, separator) result(csv)

    Returns allocatable string of nodes in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(node_type), intent(inout) :: nodes(:)

    Nodes array.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_observ(observ, separator) result(csv)

    Returns allocatable string of observation in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_type), intent(inout) :: observ

    Observation data.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_observ_view(view, separator) result(csv)

    Returns allocatable string of observation view (stub observation without receivers, requests, responses) in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_view_type), intent(inout) :: view

    Observation view type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_observ_views(views, header, separator) result(csv)

    Returns allocatable string of observation views in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_view_type), intent(inout) :: views(:)

    Array of observation views.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_observs(observs, header, separator) result(csv)

    Returns allocatable string of observations in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_type), intent(inout) :: observs(:)

    Array of observations.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_sensor(sensor, separator) result(csv)

    Returns allocatable string of sensor in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(sensor_type), intent(inout) :: sensor

    Sensor type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_sensors(sensors, header, separator) result(csv)

    Returns allocatable string of sensors in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(sensor_type), intent(inout) :: sensors(:)

    Sensors array.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_target(target, separator) result(csv)

    Returns allocatable string of target in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(target_type), intent(inout) :: target

    Target type.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

  • private function csv_from_targets(targets, header, separator) result(csv)

    Returns allocatable string of targets in CSV format.

    Arguments

    Type IntentOptional Attributes Name
    type(target_type), intent(inout) :: targets(:)

    Targets array.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value character(len=:), allocatable

    Allocatable CSV string.

public interface dm_csv_read

Generic derived type from CSV reader.

  • private function csv_read_log(log, unit, separator, quote) result(rc)

    Reads log from file or standard input. If no separator character is passed, the default one will be used (comma). If a quote character is given, separators within quoted strings will be ignored.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(out) :: log

    Log type.

    integer, intent(in), optional :: unit

    File unit.

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

    CSV separator.

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

    CSV quote character.

    Return Value integer

  • private function csv_read_node(node, unit, separator, quote) result(rc)

    Reads node from file or standard input. If no separator character is passed, the default one will be used (comma). If a quote character is given, separators within quoted strings will be ignored.

    Arguments

    Type IntentOptional Attributes Name
    type(node_type), intent(out) :: node

    Node type.

    integer, intent(in), optional :: unit

    File unit.

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

    CSV separator.

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

    CSV quote character.

    Return Value integer

  • private function csv_read_observ(observ, unit, separator, quote) result(rc)

    Reads observation from file or standard input. If no separator character is passed, the default one will be used (comma). If a quote character is given, separators within quoted strings will be ignored.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_type), intent(out) :: observ

    Observation type.

    integer, intent(in), optional :: unit

    File unit.

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

    CSV separator.

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

    CSV quote character.

    Return Value integer

  • private function csv_read_sensor(sensor, unit, separator, quote) result(rc)

    Reads sensor from file or standard input. If no separator character is passed, the default one will be used (comma). If a quote character is given, separators within quoted strings will be ignored.

    Arguments

    Type IntentOptional Attributes Name
    type(sensor_type), intent(out) :: sensor

    Sensor type.

    integer, intent(in), optional :: unit

    File unit.

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

    CSV separator.

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

    CSV quote character.

    Return Value integer

  • private function csv_read_target(target, unit, separator, quote) result(rc)

    Reads target from file or standard input. If no separator character is passed, the default one will be used (comma). If a quote character is given, separators within quoted strings will be ignored.

    Arguments

    Type IntentOptional Attributes Name
    type(target_type), intent(out) :: target

    Target type.

    integer, intent(in), optional :: unit

    File unit.

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

    CSV separator.

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

    CSV quote character.

    Return Value integer

public interface dm_csv_write

Generic derived type to CSV writer.

  • private function csv_write_beat(beat, unit, header, separator) result(rc)

    Writes beat to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(beat_type), intent(inout) :: beat

    Beat type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_beats(beats, unit, header, separator) result(rc)

    Writes beats to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(beat_type), intent(inout) :: beats(:)

    Beat array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_data_point(data_point, unit, header, separator) result(rc)

    Writes data point to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(dp_type), intent(inout) :: data_point

    Data point type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_data_points(data_points, unit, header, separator) result(rc)

    Writes data points to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(dp_type), intent(inout) :: data_points(:)

    Data point array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_log(log, unit, header, separator) result(rc)

    Writes log to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(inout) :: log

    Log type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV field separator.

    Return Value integer

  • private function csv_write_logs(logs, unit, header, separator) result(rc)

    Writes logs to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(log_type), intent(inout) :: logs(:)

    Log array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV field separator.

    Return Value integer

  • private function csv_write_node(node, unit, header, separator) result(rc)

    Writes node to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(node_type), intent(inout) :: node

    Node type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_nodes(nodes, unit, header, separator) result(rc)

    Writes nodes to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(node_type), intent(inout) :: nodes(:)

    Node array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_observ(observ, unit, header, separator) result(rc)

    Writes observation to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_type), intent(inout) :: observ

    Observation type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_observs(observs, unit, header, separator) result(rc)

    Writes observations to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(observ_type), intent(inout) :: observs(:)

    Observation array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_sensor(sensor, unit, header, separator) result(rc)

    Write sensor to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(sensor_type), intent(inout) :: sensor

    Sensor type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_sensors(sensors, unit, header, separator) result(rc)

    Writes sensors to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(sensor_type), intent(inout) :: sensors(:)

    Sensor array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_target(target, unit, header, separator) result(rc)

    Writes target to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(target_type), intent(inout) :: target

    Target type.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer

  • private function csv_write_targets(targets, unit, header, separator) result(rc)

    Writes targets to file or standard output.

    Arguments

    Type IntentOptional Attributes Name
    type(target_type), intent(inout) :: targets(:)

    Target array.

    integer, intent(in), optional :: unit

    File unit.

    logical, intent(in), optional :: header

    CSV header flag.

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

    CSV separator.

    Return Value integer


Functions

public function dm_csv_header_beat(separator) result(header)

Returns header string of CSV representation of the beat type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_data_point(separator) result(header)

Returns header string of CSV representation of the data point type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_log(separator) result(header)

Returns header string of CSV representation of the log type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_node(separator) result(header)

Returns header string of CSV representation of the node type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_observ(separator) result(header)

Returns CSV header string of CSV representation of the observation type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_observ_view(separator) result(header)

Returns CSV header string of CSV representation of the observation view type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_sensor(separator) result(header)

Returns header string of CSV representation of the sensor type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.

public function dm_csv_header_target(separator) result(header)

Returns header string of CSV representation of the target type as allocatable string.

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in), optional :: separator

CSV separator.

Return Value character(len=:), allocatable

CSV header string.