profile_load Subroutine

public subroutine profile_load(self, table, error)

Read from toml table (no checks made at this stage)

Read all file scope flags

Type Bound

profile_config_t

Arguments

Type IntentOptional Attributes Name
class(profile_config_t), intent(inout) :: self

Instance of the serializable object

type(toml_table), intent(inout) :: table

Data structure

type(error_t), intent(out), allocatable :: error

Error handling


Variables

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: compiler_name

Local variables

type(toml_key), public, allocatable :: dep_keys(:)
character(len=:), public, allocatable :: flag

Local variables

integer, public :: ii
integer, public :: jj
type(toml_key), public, allocatable :: keys(:)
type(toml_table), public, pointer :: ptr
type(toml_table), public, pointer :: ptr_dep

Source Code

     subroutine profile_load(self, table, error)

        !> Instance of the serializable object
        class(profile_config_t), intent(inout) :: self

        !> Data structure
        type(toml_table), intent(inout) :: table

        !> Error handling
        type(error_t), allocatable, intent(out) :: error

        !> Local variables
        character(len=:), allocatable :: flag, compiler_name
        integer :: ii, jj
        type(toml_table), pointer :: ptr_dep, ptr
        type(toml_key), allocatable :: keys(:),dep_keys(:)

        call table%get_keys(keys)

        ! Load into feature structure
       ! Dump the underlying feature data
       call self%profile_feature%load_from_toml(table, error)
       if (allocated(error)) return

        if (allocated(self%file_scope_flags)) deallocate(self%file_scope_flags)
        sub_deps: do ii = 1, size(keys)

           select case (keys(ii)%key)
              case ("file-scope-flags")

               call get_value(table, keys(ii), ptr)
               if (.not.associated(ptr)) then
                  call fatal_error(error,'profile_config_t: error retrieving file_scope_flags table')
                  return
               end if

               !> Read all file scope flags
               call ptr%get_keys(dep_keys)
               allocate(self%file_scope_flags(size(dep_keys)))

               do jj = 1, size(dep_keys)

                   call get_value(ptr, dep_keys(jj), ptr_dep)
                   call self%file_scope_flags(jj)%load_from_toml(ptr_dep, error)
                   if (allocated(error)) return

               end do

           end select
        end do sub_deps

     end subroutine profile_load