Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Development v1.2 #2

Merged
merged 22 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding CSV support
  • Loading branch information
jchristopherson committed Mar 19, 2021
commit d49c9b4f003491c7843553cb7f0853ca8e50e2f4
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set(fcore_sources
collections_hash.f90
csv.f90
csv_column.f90
collections_linked_list.f90
)

# Build the library
Expand Down
95 changes: 92 additions & 3 deletions src/csv.f90
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,116 @@ module csv
!!
!! @par Syntax 1
!! @code{.f90}
!! subroutine set_array(class(csv_column) this, class(string) x(:))
!! subroutine set_array(class(csv_column) this, class(string) x(:), optional class(errors) err)
!! @endcode
!!
!! @par Syntax 2
!! @code{.f90}
!! subroutine set_array(class(csv_column) this, real(real64) x(:))
!! subroutine set_array(class(csv_column) this, real(real64) x(:), optional class(errors) err)
!! @endcode
!!
!! @par Syntax 3
!! @code{.f90}
!! subroutine set_array(class(csv_column) this, logical x(:))
!! subroutine set_array(class(csv_column) this, logical x(:), optional class(errors) err)
!! @endcode
!!
!! @param[in,out] this The csv_column object.
!! @param[in] x The array.
!! @param[in,out] err An optional errors-based object that if provided
!! can be used to retrieve information relating to any errors
!! encountered during execution. If not provided, a default
!! implementation of the errors class is used internally to provide
!! error handling. Possible errors and warning messages that may be
!! encountered are as follows.
!! - FCORE_DATA_TYPE_ERROR: Occurs if @p id doesn't match the stored
!! data type.
!! - FCORE_OUT_OF_MEMORY_ERROR: Occurs if there is insufficient
!! memory available.
generic, public :: set_array => cc_set_string_array, &
cc_set_numeric_array, cc_set_logical_array
!> @brief Inserts an item into the column.
!!
!! @par Syntax 1
!! @code{.f90}
!! subroutine insert(class(csv_column) this, integer(int32) index, character(len = *) x, optional class(errors) err)
!! @endcode
!!
!! @par Syntax 2
!! @code{.f90}
!! subroutine insert(class(csv_column) this, integer(int32) index, real(real64) x, optional class(errors) err)
!! @endcode
!!
!! @par Syntax 1
!! @code{.f90}
!! subroutine insert(class(csv_column) this, integer(int32) index, logical x, optional class(errors) err)
!! @endcode
!!
!! @param[in,out] this The csv_column object.
!! @param[in] index The index defining where the item should be
!! inserted.
!! @param[in] x The item to insert.
!! @param[in,out] err An optional errors-based object that if provided
!! can be used to retrieve information relating to any errors
!! encountered during execution. If not provided, a default
!! implementation of the errors class is used internally to provide
!! error handling. Possible errors and warning messages that may be
!! encountered are as follows.
!! - FCORE_DATA_TYPE_ERROR: Occurs if @p id doesn't match the stored
!! data type.
!! - FCORE_INDEX_OUT_OF_RANGE_ERROR: Occurs if @p index is outside
!! the bounds of the column.
!! - FCORE_OUT_OF_MEMORY_ERROR: Occurs if there is insufficient
!! memory available.
generic, public :: insert => cc_insert_string_item, &
cc_insert_numeric_item, cc_insert_logical_item
!> @brief Appends an item onto the column.
!!
!! @par Syntax 1
!! @code{.f90}
!! subroutine append(class(csv_column) this, character(len = *) x, optional class(errors) err)
!! @endcode
!!
!! @par Syntax 2
!! @code{.f90}
!! subroutine append(class(csv_column) this, real(real64) x, optional class(errors) err)
!! @endcode
!!
!! @par Syntax 1
!! @code{.f90}
!! subroutine append(class(csv_column) this, logical x, optional class(errors) err)
!! @endcode
!!
!! @param[in,out] this The csv_column object.
!! @param[in] x The item to append.
!! @param[in,out] err An optional errors-based object that if provided
!! can be used to retrieve information relating to any errors
!! encountered during execution. If not provided, a default
!! implementation of the errors class is used internally to provide
!! error handling. Possible errors and warning messages that may be
!! encountered are as follows.
!! - FCORE_DATA_TYPE_ERROR: Occurs if @p id doesn't match the stored
!! data type.
!! - FCORE_OUT_OF_MEMORY_ERROR: Occurs if there is insufficient
!! memory available.
generic, public :: append => cc_append_string_item, &
cc_append_numeric_item, cc_append_logical_item
!> @brief Removes an item from the column.
!!
!! @par Syntax
!! @code{.f90}
!! subroutine remove(class(csv_column), integer(int32) index, optional class(errors) err)
!! @endcode
!!
!! @param[in,out] this The csv_column object.
!! @param[in] index The index of the item to remove.
!! @param[in,out] err An optional errors-based object that if provided
!! can be used to retrieve information relating to any errors
!! encountered during execution. If not provided, a default
!! implementation of the errors class is used internally to provide
!! error handling. Possible errors and warning messages that may be
!! encountered are as follows.
!! - FCORE_INDEX_OUT_OF_RANGE_ERROR: Occurs if @p index is outside
!! the bounds of the column.
procedure, public :: remove => cc_remove_item

procedure :: cc_get_string_item
Expand Down
Loading