! wrapfcaliper.F
! This file is generated by Shroud 0.12.2. Do not edit.
!>
!! \file wrapfcaliper.F
!! \brief Shroud generated wrapper for cali namespace
!<
! splicer begin file_top
! splicer end file_top
module caliper_mod
    use iso_c_binding, only : C_INT, C_LONG, C_NULL_PTR, C_PTR, C_SIZE_T
    ! splicer begin module_use
    ! splicer end module_use
    implicit none

    ! splicer begin module_top
    ! splicer end module_top

    ! helper capsule_data_helper
    type, bind(C) :: cali_SHROUD_capsule_data
        type(C_PTR) :: addr = C_NULL_PTR  ! address of C++ memory
        integer(C_INT) :: idtor = 0       ! index of destructor
    end type cali_SHROUD_capsule_data

    ! helper array_context
    type, bind(C) :: cali_SHROUD_array
        ! address of C++ memory
        type(cali_SHROUD_capsule_data) :: cxx
        ! address of data in cxx
        type(C_PTR) :: base_addr = C_NULL_PTR
        ! type of element
        integer(C_INT) :: type
        ! bytes-per-item or character len of data in cxx
        integer(C_SIZE_T) :: elem_len = 0_C_SIZE_T
        ! size of data in cxx
        integer(C_SIZE_T) :: size = 0_C_SIZE_T
        ! number of dimensions
        integer(C_INT) :: rank = -1
        integer(C_LONG) :: shape(7) = 0
    end type cali_SHROUD_array

    !  enum cali::cali_attr_properties
    integer(C_INT), parameter :: cali_attr_default = 0
    integer(C_INT), parameter :: cali_attr_asvalue = 1
    integer(C_INT), parameter :: cali_attr_nomerge = 2
    integer(C_INT), parameter :: cali_attr_scope_process = 12
    integer(C_INT), parameter :: cali_attr_scope_thread = 20
    integer(C_INT), parameter :: cali_attr_scope_task = 24
    integer(C_INT), parameter :: cali_attr_skip_events = 64
    integer(C_INT), parameter :: cali_attr_hidden = 128
    integer(C_INT), parameter :: cali_attr_nested = 256
    integer(C_INT), parameter :: cali_attr_global = 512
    integer(C_INT), parameter :: cali_attr_unaligned = 1024

    !  enum cali::cali_attr_type
    integer(C_INT), parameter :: cali_type_inv = 0
    integer(C_INT), parameter :: cali_type_usr = 1
    integer(C_INT), parameter :: cali_type_int = 2
    integer(C_INT), parameter :: cali_type_uint = 3
    integer(C_INT), parameter :: cali_type_string = 4
    integer(C_INT), parameter :: cali_type_addr = 5
    integer(C_INT), parameter :: cali_type_double = 6
    integer(C_INT), parameter :: cali_type_bool = 7
    integer(C_INT), parameter :: cali_type_type = 8
    integer(C_INT), parameter :: cali_type_ptr = 9

    !  enum cali::cali_flush_opts
    integer(C_INT), parameter :: cali_flush_clear_buffers = 1

    type scopeannotation
        type(cali_SHROUD_capsule_data) :: cxxmem
        ! splicer begin class.ScopeAnnotation.component_part
        ! splicer end class.ScopeAnnotation.component_part
    contains
        procedure :: end => scopeannotation_end
        procedure :: get_instance => scopeannotation_get_instance
        procedure :: set_instance => scopeannotation_set_instance
        procedure :: associated => scopeannotation_associated
        ! splicer begin class.ScopeAnnotation.type_bound_procedure_part
        ! splicer end class.ScopeAnnotation.type_bound_procedure_part
    end type scopeannotation

    type annotation
        type(cali_SHROUD_capsule_data) :: cxxmem
        ! splicer begin class.Annotation.component_part
        ! splicer end class.Annotation.component_part
    contains
        procedure :: delete => annotation_delete
        procedure :: begin_int => annotation_begin_int
        procedure :: begin_string => annotation_begin_string
        procedure :: set_int => annotation_set_int
        procedure :: set_string => annotation_set_string
        procedure :: end => annotation_end
        procedure :: get_instance => annotation_get_instance
        procedure :: set_instance => annotation_set_instance
        procedure :: associated => annotation_associated
        generic :: begin => begin_int, begin_string
        generic :: set => set_int, set_string
        ! splicer begin class.Annotation.type_bound_procedure_part
        ! splicer end class.Annotation.type_bound_procedure_part
    end type annotation

    type configmanager
        type(cali_SHROUD_capsule_data) :: cxxmem
        ! splicer begin class.ConfigManager.component_part
        ! splicer end class.ConfigManager.component_part
    contains
        procedure :: delete => configmanager_delete
        procedure :: set_default_parameter => configmanager_set_default_parameter
        procedure :: add => configmanager_add
        procedure :: error => configmanager_error
        procedure :: error_msg => configmanager_error_msg
        procedure :: start => configmanager_start
        procedure :: stop => configmanager_stop
        procedure :: flush => configmanager_flush
        procedure :: get_instance => configmanager_get_instance
        procedure :: set_instance => configmanager_set_instance
        procedure :: associated => configmanager_associated
        ! splicer begin class.ConfigManager.type_bound_procedure_part
        ! splicer end class.ConfigManager.type_bound_procedure_part
    end type configmanager

    type bufferedregionprofile
        type(cali_SHROUD_capsule_data) :: cxxmem
        ! splicer begin class.BufferedRegionProfile.component_part
        ! splicer end class.BufferedRegionProfile.component_part
    contains
        procedure :: delete => bufferedregionprofile_delete
        procedure :: start => bufferedregionprofile_start
        procedure :: stop => bufferedregionprofile_stop
        procedure :: clear => bufferedregionprofile_clear
        procedure :: fetch_exclusive_region_times => bufferedregionprofile_fetch_exclusive_region_times
        procedure :: fetch_inclusive_region_times => bufferedregionprofile_fetch_inclusive_region_times
        procedure :: total_profiling_time => bufferedregionprofile_total_profiling_time
        procedure :: total_region_time => bufferedregionprofile_total_region_time
        procedure :: region_time => bufferedregionprofile_region_time
        procedure :: get_instance => bufferedregionprofile_get_instance
        procedure :: set_instance => bufferedregionprofile_set_instance
        procedure :: associated => bufferedregionprofile_associated
        ! splicer begin class.BufferedRegionProfile.type_bound_procedure_part
        ! splicer end class.BufferedRegionProfile.type_bound_procedure_part
    end type bufferedregionprofile

    interface operator (.eq.)
        module procedure scopeannotation_eq
        module procedure annotation_eq
        module procedure configmanager_eq
        module procedure bufferedregionprofile_eq
    end interface

    interface operator (.ne.)
        module procedure scopeannotation_ne
        module procedure annotation_ne
        module procedure configmanager_ne
        module procedure bufferedregionprofile_ne
    end interface

    interface

        function c_scopeannotation_begin(name, SHT_crv) &
                result(SHT_rv) &
                bind(C, name="cali_ScopeAnnotation_begin")
            use iso_c_binding, only : C_CHAR, C_PTR
            import :: cali_SHROUD_capsule_data
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
            type(cali_SHROUD_capsule_data), intent(OUT) :: SHT_crv
            type(C_PTR) SHT_rv
        end function c_scopeannotation_begin

        subroutine c_scopeannotation_end(self) &
                bind(C, name="cali_ScopeAnnotation_end")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_scopeannotation_end

        ! splicer begin class.ScopeAnnotation.additional_interfaces
        ! splicer end class.ScopeAnnotation.additional_interfaces

        function c_annotation_new(key, SHT_crv) &
                result(SHT_rv) &
                bind(C, name="cali_Annotation_new")
            use iso_c_binding, only : C_CHAR, C_PTR
            import :: cali_SHROUD_capsule_data
            implicit none
            character(kind=C_CHAR), intent(IN) :: key(*)
            type(cali_SHROUD_capsule_data), intent(OUT) :: SHT_crv
            type(C_PTR) SHT_rv
        end function c_annotation_new

        function c_annotation_new_with_properties(key, properties, &
                SHT_crv) &
                result(SHT_rv) &
                bind(C, name="cali_Annotation_new_with_properties")
            use iso_c_binding, only : C_CHAR, C_INT, C_PTR
            import :: cali_SHROUD_capsule_data
            implicit none
            character(kind=C_CHAR), intent(IN) :: key(*)
            integer(C_INT), value, intent(IN) :: properties
            type(cali_SHROUD_capsule_data), intent(OUT) :: SHT_crv
            type(C_PTR) SHT_rv
        end function c_annotation_new_with_properties

        subroutine c_annotation_delete(self) &
                bind(C, name="cali_Annotation_delete")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_annotation_delete

        subroutine c_annotation_begin_int(self, val) &
                bind(C, name="cali_Annotation_begin_int")
            use iso_c_binding, only : C_INT
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            integer(C_INT), value, intent(IN) :: val
        end subroutine c_annotation_begin_int

        subroutine c_annotation_begin_string(self, val) &
                bind(C, name="cali_Annotation_begin_string")
            use iso_c_binding, only : C_CHAR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            character(kind=C_CHAR), intent(IN) :: val(*)
        end subroutine c_annotation_begin_string

        subroutine c_annotation_set_int(self, val) &
                bind(C, name="cali_Annotation_set_int")
            use iso_c_binding, only : C_INT
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            integer(C_INT), value, intent(IN) :: val
        end subroutine c_annotation_set_int

        subroutine c_annotation_set_string(self, val) &
                bind(C, name="cali_Annotation_set_string")
            use iso_c_binding, only : C_CHAR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            character(kind=C_CHAR), intent(IN) :: val(*)
        end subroutine c_annotation_set_string

        subroutine c_annotation_end(self) &
                bind(C, name="cali_Annotation_end")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_annotation_end

        ! splicer begin class.Annotation.additional_interfaces
        ! splicer end class.Annotation.additional_interfaces

        function c_configmanager_new(SHT_crv) &
                result(SHT_rv) &
                bind(C, name="cali_ConfigManager_new")
            use iso_c_binding, only : C_PTR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(OUT) :: SHT_crv
            type(C_PTR) SHT_rv
        end function c_configmanager_new

        subroutine c_configmanager_delete(self) &
                bind(C, name="cali_ConfigManager_delete")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_configmanager_delete

        subroutine c_configmanager_set_default_parameter(self, option, &
                val) &
                bind(C, name="cali_ConfigManager_set_default_parameter")
            use iso_c_binding, only : C_CHAR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            character(kind=C_CHAR), intent(IN) :: option(*)
            character(kind=C_CHAR), intent(IN) :: val(*)
        end subroutine c_configmanager_set_default_parameter

        subroutine c_configmanager_add(self, config) &
                bind(C, name="cali_ConfigManager_add")
            use iso_c_binding, only : C_CHAR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            character(kind=C_CHAR), intent(IN) :: config(*)
        end subroutine c_configmanager_add

        function c_configmanager_error(self) &
                result(SHT_rv) &
                bind(C, name="cali_ConfigManager_error")
            use iso_c_binding, only : C_BOOL
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            logical(C_BOOL) :: SHT_rv
        end function c_configmanager_error

        subroutine c_configmanager_error_msg_bufferify(self, DSHF_rv) &
                bind(C, name="cali_ConfigManager_error_msg_bufferify")
            import :: cali_SHROUD_array, cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            type(cali_SHROUD_array), intent(OUT) :: DSHF_rv
        end subroutine c_configmanager_error_msg_bufferify

        subroutine c_configmanager_start(self) &
                bind(C, name="cali_ConfigManager_start")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_configmanager_start

        subroutine c_configmanager_stop(self) &
                bind(C, name="cali_ConfigManager_stop")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_configmanager_stop

        subroutine c_configmanager_flush(self) &
                bind(C, name="cali_ConfigManager_flush")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_configmanager_flush

        ! splicer begin class.ConfigManager.additional_interfaces
        ! splicer end class.ConfigManager.additional_interfaces

        function c_bufferedregionprofile_new(SHT_crv) &
                result(SHT_rv) &
                bind(C, name="cali_BufferedRegionProfile_new")
            use iso_c_binding, only : C_PTR
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(OUT) :: SHT_crv
            type(C_PTR) SHT_rv
        end function c_bufferedregionprofile_new

        subroutine c_bufferedregionprofile_delete(self) &
                bind(C, name="cali_BufferedRegionProfile_delete")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_delete

        subroutine c_bufferedregionprofile_start(self) &
                bind(C, name="cali_BufferedRegionProfile_start")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_start

        subroutine c_bufferedregionprofile_stop(self) &
                bind(C, name="cali_BufferedRegionProfile_stop")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_stop

        subroutine c_bufferedregionprofile_clear(self) &
                bind(C, name="cali_BufferedRegionProfile_clear")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_clear

        subroutine c_bufferedregionprofile_fetch_exclusive_region_times( &
                self) &
                bind(C, name="cali_BufferedRegionProfile_fetch_exclusive_region_times")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_fetch_exclusive_region_times

        subroutine c_bufferedregionprofile_fetch_inclusive_region_times( &
                self) &
                bind(C, name="cali_BufferedRegionProfile_fetch_inclusive_region_times")
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
        end subroutine c_bufferedregionprofile_fetch_inclusive_region_times

        pure function c_bufferedregionprofile_total_profiling_time(self) &
                result(SHT_rv) &
                bind(C, name="cali_BufferedRegionProfile_total_profiling_time")
            use iso_c_binding, only : C_DOUBLE
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            real(C_DOUBLE) :: SHT_rv
        end function c_bufferedregionprofile_total_profiling_time

        pure function c_bufferedregionprofile_total_region_time(self) &
                result(SHT_rv) &
                bind(C, name="cali_BufferedRegionProfile_total_region_time")
            use iso_c_binding, only : C_DOUBLE
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            real(C_DOUBLE) :: SHT_rv
        end function c_bufferedregionprofile_total_region_time

        function c_bufferedregionprofile_region_time(self, region) &
                result(SHT_rv) &
                bind(C, name="cali_BufferedRegionProfile_region_time")
            use iso_c_binding, only : C_CHAR, C_DOUBLE
            import :: cali_SHROUD_capsule_data
            implicit none
            type(cali_SHROUD_capsule_data), intent(IN) :: self
            character(kind=C_CHAR), intent(IN) :: region(*)
            real(C_DOUBLE) :: SHT_rv
        end function c_bufferedregionprofile_region_time

        ! splicer begin class.BufferedRegionProfile.additional_interfaces
        ! splicer end class.BufferedRegionProfile.additional_interfaces

#ifdef CALIPER_HAVE_MPI
        subroutine cali_mpi_init() &
                bind(C, name="cali_mpi_init")
            implicit none
        end subroutine cali_mpi_init
#endif

        subroutine cali_init() &
                bind(C, name="cali_init")
            implicit none
        end subroutine cali_init

        subroutine c_cali_config_preset(key, value) &
                bind(C, name="cali_config_preset")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: key(*)
            character(kind=C_CHAR), intent(IN) :: value(*)
        end subroutine c_cali_config_preset

        subroutine c_cali_config_set(key, value) &
                bind(C, name="cali_config_set")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: key(*)
            character(kind=C_CHAR), intent(IN) :: value(*)
        end subroutine c_cali_config_set

        subroutine cali_flush(flush_opts) &
                bind(C, name="cali_flush")
            use iso_c_binding, only : C_INT
            implicit none
            integer(C_INT), value, intent(IN) :: flush_opts
        end subroutine cali_flush

        function c_cali_create_attribute(name, type, prop) &
                result(SHT_rv) &
                bind(C, name="cali_create_attribute")
            use iso_c_binding, only : C_CHAR, C_INT, C_INT64_T
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
            integer(C_INT), value, intent(IN) :: type
            integer(C_INT), value, intent(IN) :: prop
            integer(C_INT64_T) :: SHT_rv
        end function c_cali_create_attribute

        function c_cali_find_attribute(name) &
                result(SHT_rv) &
                bind(C, name="cali_find_attribute")
            use iso_c_binding, only : C_CHAR, C_INT64_T
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
            integer(C_INT64_T) :: SHT_rv
        end function c_cali_find_attribute

        subroutine cali_begin_int(attr_id, val) &
                bind(C, name="cali_begin_int")
            use iso_c_binding, only : C_INT, C_INT64_T
            implicit none
            integer(C_INT64_T), value, intent(IN) :: attr_id
            integer(C_INT), value, intent(IN) :: val
        end subroutine cali_begin_int

        subroutine c_cali_begin_string(attr_id, val) &
                bind(C, name="cali_begin_string")
            use iso_c_binding, only : C_CHAR, C_INT64_T
            implicit none
            integer(C_INT64_T), value, intent(IN) :: attr_id
            character(kind=C_CHAR), intent(IN) :: val(*)
        end subroutine c_cali_begin_string

        subroutine cali_end(attr_id) &
                bind(C, name="cali_end")
            use iso_c_binding, only : C_INT64_T
            implicit none
            integer(C_INT64_T), value, intent(IN) :: attr_id
        end subroutine cali_end

        subroutine c_cali_begin_int_byname(attr_name, val) &
                bind(C, name="cali_begin_int_byname")
            use iso_c_binding, only : C_CHAR, C_INT
            implicit none
            character(kind=C_CHAR), intent(IN) :: attr_name(*)
            integer(C_INT), value, intent(IN) :: val
        end subroutine c_cali_begin_int_byname

        subroutine c_cali_begin_string_byname(attr_name, val) &
                bind(C, name="cali_begin_string_byname")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: attr_name(*)
            character(kind=C_CHAR), intent(IN) :: val(*)
        end subroutine c_cali_begin_string_byname

        subroutine c_cali_end_byname(attr_name) &
                bind(C, name="cali_end_byname")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: attr_name(*)
        end subroutine c_cali_end_byname

        subroutine c_cali_begin_region(name) &
                bind(C, name="cali_begin_region")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
        end subroutine c_cali_begin_region

        subroutine c_cali_end_region(name) &
                bind(C, name="cali_end_region")
            use iso_c_binding, only : C_CHAR
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
        end subroutine c_cali_end_region

        function c_cali_make_loop_iteration_attribute(name) &
                result(SHT_rv) &
                bind(C, name="cali_make_loop_iteration_attribute")
            use iso_c_binding, only : C_CHAR, C_INT64_T
            implicit none
            character(kind=C_CHAR), intent(IN) :: name(*)
            integer(C_INT64_T) :: SHT_rv
        end function c_cali_make_loop_iteration_attribute

        ! splicer begin additional_interfaces
        ! splicer end additional_interfaces
    end interface

    interface annotation
        module procedure annotation_new
        module procedure annotation_new_with_properties
    end interface annotation

    interface bufferedregionprofile
        module procedure bufferedregionprofile_new
    end interface bufferedregionprofile

    interface configmanager
        module procedure configmanager_new
    end interface configmanager

    interface scopeannotation
        module procedure scopeannotation_begin
    end interface scopeannotation

    interface
        ! helper copy_string
        ! Copy the char* or std::string in context into c_var.
        subroutine cali_SHROUD_copy_string_and_free(context, c_var, c_var_size) &
             bind(c,name="cali_ShroudCopyStringAndFree")
            use, intrinsic :: iso_c_binding, only : C_CHAR, C_SIZE_T
            import cali_SHROUD_array
            type(cali_SHROUD_array), intent(IN) :: context
            character(kind=C_CHAR), intent(OUT) :: c_var(*)
            integer(C_SIZE_T), value :: c_var_size
        end subroutine cali_SHROUD_copy_string_and_free
    end interface

contains

    function scopeannotation_begin(name) &
            result(SHT_rv)
        use iso_c_binding, only : C_NULL_CHAR, C_PTR
        character(len=*), intent(IN) :: name
        type(scopeannotation) :: SHT_rv
        ! splicer begin class.ScopeAnnotation.method.begin
        type(C_PTR) :: SHT_prv
        SHT_prv = c_scopeannotation_begin(trim(name)//C_NULL_CHAR, &
            SHT_rv%cxxmem)
        ! splicer end class.ScopeAnnotation.method.begin
    end function scopeannotation_begin

    subroutine scopeannotation_end(obj)
        class(scopeannotation) :: obj
        ! splicer begin class.ScopeAnnotation.method.end
        call c_scopeannotation_end(obj%cxxmem)
        ! splicer end class.ScopeAnnotation.method.end
    end subroutine scopeannotation_end

    ! Return pointer to C++ memory.
    function scopeannotation_get_instance(obj) result (cxxptr)
        use iso_c_binding, only: C_PTR
        class(scopeannotation), intent(IN) :: obj
        type(C_PTR) :: cxxptr
        cxxptr = obj%cxxmem%addr
    end function scopeannotation_get_instance

    subroutine scopeannotation_set_instance(obj, cxxmem)
        use iso_c_binding, only: C_PTR
        class(scopeannotation), intent(INOUT) :: obj
        type(C_PTR), intent(IN) :: cxxmem
        obj%cxxmem%addr = cxxmem
        obj%cxxmem%idtor = 0
    end subroutine scopeannotation_set_instance

    function scopeannotation_associated(obj) result (rv)
        use iso_c_binding, only: c_associated
        class(scopeannotation), intent(IN) :: obj
        logical rv
        rv = c_associated(obj%cxxmem%addr)
    end function scopeannotation_associated

    ! splicer begin class.ScopeAnnotation.additional_functions
    ! splicer end class.ScopeAnnotation.additional_functions

    function annotation_new(key) &
            result(SHT_rv)
        use iso_c_binding, only : C_NULL_CHAR, C_PTR
        character(len=*), intent(IN) :: key
        type(annotation) :: SHT_rv
        ! splicer begin class.Annotation.method.new
        type(C_PTR) :: SHT_prv
        SHT_prv = c_annotation_new(trim(key)//C_NULL_CHAR, &
            SHT_rv%cxxmem)
        ! splicer end class.Annotation.method.new
    end function annotation_new

    function annotation_new_with_properties(key, properties) &
            result(SHT_rv)
        use iso_c_binding, only : C_INT, C_NULL_CHAR, C_PTR
        character(len=*), intent(IN) :: key
        integer(C_INT), value, intent(IN) :: properties
        type(annotation) :: SHT_rv
        ! splicer begin class.Annotation.method.new_with_properties
        type(C_PTR) :: SHT_prv
        SHT_prv = c_annotation_new_with_properties(trim(key)//C_NULL_CHAR, &
            properties, SHT_rv%cxxmem)
        ! splicer end class.Annotation.method.new_with_properties
    end function annotation_new_with_properties

    subroutine annotation_delete(obj)
        class(annotation) :: obj
        ! splicer begin class.Annotation.method.delete
        call c_annotation_delete(obj%cxxmem)
        ! splicer end class.Annotation.method.delete
    end subroutine annotation_delete

    subroutine annotation_begin_int(obj, val)
        use iso_c_binding, only : C_INT
        class(annotation) :: obj
        integer(C_INT), value, intent(IN) :: val
        ! splicer begin class.Annotation.method.begin_int
        call c_annotation_begin_int(obj%cxxmem, val)
        ! splicer end class.Annotation.method.begin_int
    end subroutine annotation_begin_int

    subroutine annotation_begin_string(obj, val)
        use iso_c_binding, only : C_NULL_CHAR
        class(annotation) :: obj
        character(len=*), intent(IN) :: val
        ! splicer begin class.Annotation.method.begin_string
        call c_annotation_begin_string(obj%cxxmem, &
            trim(val)//C_NULL_CHAR)
        ! splicer end class.Annotation.method.begin_string
    end subroutine annotation_begin_string

    subroutine annotation_set_int(obj, val)
        use iso_c_binding, only : C_INT
        class(annotation) :: obj
        integer(C_INT), value, intent(IN) :: val
        ! splicer begin class.Annotation.method.set_int
        call c_annotation_set_int(obj%cxxmem, val)
        ! splicer end class.Annotation.method.set_int
    end subroutine annotation_set_int

    subroutine annotation_set_string(obj, val)
        use iso_c_binding, only : C_NULL_CHAR
        class(annotation) :: obj
        character(len=*), intent(IN) :: val
        ! splicer begin class.Annotation.method.set_string
        call c_annotation_set_string(obj%cxxmem, trim(val)//C_NULL_CHAR)
        ! splicer end class.Annotation.method.set_string
    end subroutine annotation_set_string

    subroutine annotation_end(obj)
        class(annotation) :: obj
        ! splicer begin class.Annotation.method.end
        call c_annotation_end(obj%cxxmem)
        ! splicer end class.Annotation.method.end
    end subroutine annotation_end

    ! Return pointer to C++ memory.
    function annotation_get_instance(obj) result (cxxptr)
        use iso_c_binding, only: C_PTR
        class(annotation), intent(IN) :: obj
        type(C_PTR) :: cxxptr
        cxxptr = obj%cxxmem%addr
    end function annotation_get_instance

    subroutine annotation_set_instance(obj, cxxmem)
        use iso_c_binding, only: C_PTR
        class(annotation), intent(INOUT) :: obj
        type(C_PTR), intent(IN) :: cxxmem
        obj%cxxmem%addr = cxxmem
        obj%cxxmem%idtor = 0
    end subroutine annotation_set_instance

    function annotation_associated(obj) result (rv)
        use iso_c_binding, only: c_associated
        class(annotation), intent(IN) :: obj
        logical rv
        rv = c_associated(obj%cxxmem%addr)
    end function annotation_associated

    ! splicer begin class.Annotation.additional_functions
    ! splicer end class.Annotation.additional_functions

    function configmanager_new() &
            result(SHT_rv)
        use iso_c_binding, only : C_PTR
        type(configmanager) :: SHT_rv
        ! splicer begin class.ConfigManager.method.new
        type(C_PTR) :: SHT_prv
        SHT_prv = c_configmanager_new(SHT_rv%cxxmem)
        ! splicer end class.ConfigManager.method.new
    end function configmanager_new

    subroutine configmanager_delete(obj)
        class(configmanager) :: obj
        ! splicer begin class.ConfigManager.method.delete
        call c_configmanager_delete(obj%cxxmem)
        ! splicer end class.ConfigManager.method.delete
    end subroutine configmanager_delete

    subroutine configmanager_set_default_parameter(obj, option, val)
        use iso_c_binding, only : C_NULL_CHAR
        class(configmanager) :: obj
        character(len=*), intent(IN) :: option
        character(len=*), intent(IN) :: val
        ! splicer begin class.ConfigManager.method.set_default_parameter
        call c_configmanager_set_default_parameter(obj%cxxmem, &
            trim(option)//C_NULL_CHAR, trim(val)//C_NULL_CHAR)
        ! splicer end class.ConfigManager.method.set_default_parameter
    end subroutine configmanager_set_default_parameter

    subroutine configmanager_add(obj, config)
        use iso_c_binding, only : C_NULL_CHAR
        class(configmanager) :: obj
        character(len=*), intent(IN) :: config
        ! splicer begin class.ConfigManager.method.add
        call c_configmanager_add(obj%cxxmem, trim(config)//C_NULL_CHAR)
        ! splicer end class.ConfigManager.method.add
    end subroutine configmanager_add

    function configmanager_error(obj) &
            result(SHT_rv)
        use iso_c_binding, only : C_BOOL
        class(configmanager) :: obj
        logical :: SHT_rv
        ! splicer begin class.ConfigManager.method.error
        SHT_rv = c_configmanager_error(obj%cxxmem)
        ! splicer end class.ConfigManager.method.error
    end function configmanager_error

    function configmanager_error_msg(obj) &
            result(SHT_rv)
        class(configmanager) :: obj
        type(cali_SHROUD_array) :: DSHF_rv
        character(len=:), allocatable :: SHT_rv
        ! splicer begin class.ConfigManager.method.error_msg
        call c_configmanager_error_msg_bufferify(obj%cxxmem, DSHF_rv)
        allocate(character(len=DSHF_rv%elem_len):: SHT_rv)
        call cali_SHROUD_copy_string_and_free(DSHF_rv, SHT_rv, DSHF_rv%elem_len)
        ! splicer end class.ConfigManager.method.error_msg
    end function configmanager_error_msg

    subroutine configmanager_start(obj)
        class(configmanager) :: obj
        ! splicer begin class.ConfigManager.method.start
        call c_configmanager_start(obj%cxxmem)
        ! splicer end class.ConfigManager.method.start
    end subroutine configmanager_start

    subroutine configmanager_stop(obj)
        class(configmanager) :: obj
        ! splicer begin class.ConfigManager.method.stop
        call c_configmanager_stop(obj%cxxmem)
        ! splicer end class.ConfigManager.method.stop
    end subroutine configmanager_stop

    subroutine configmanager_flush(obj)
        class(configmanager) :: obj
        ! splicer begin class.ConfigManager.method.flush
        call c_configmanager_flush(obj%cxxmem)
        ! splicer end class.ConfigManager.method.flush
    end subroutine configmanager_flush

    ! Return pointer to C++ memory.
    function configmanager_get_instance(obj) result (cxxptr)
        use iso_c_binding, only: C_PTR
        class(configmanager), intent(IN) :: obj
        type(C_PTR) :: cxxptr
        cxxptr = obj%cxxmem%addr
    end function configmanager_get_instance

    subroutine configmanager_set_instance(obj, cxxmem)
        use iso_c_binding, only: C_PTR
        class(configmanager), intent(INOUT) :: obj
        type(C_PTR), intent(IN) :: cxxmem
        obj%cxxmem%addr = cxxmem
        obj%cxxmem%idtor = 0
    end subroutine configmanager_set_instance

    function configmanager_associated(obj) result (rv)
        use iso_c_binding, only: c_associated
        class(configmanager), intent(IN) :: obj
        logical rv
        rv = c_associated(obj%cxxmem%addr)
    end function configmanager_associated

    ! splicer begin class.ConfigManager.additional_functions
    ! splicer end class.ConfigManager.additional_functions

    function bufferedregionprofile_new() &
            result(SHT_rv)
        use iso_c_binding, only : C_PTR
        type(bufferedregionprofile) :: SHT_rv
        ! splicer begin class.BufferedRegionProfile.method.new
        type(C_PTR) :: SHT_prv
        SHT_prv = c_bufferedregionprofile_new(SHT_rv%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.new
    end function bufferedregionprofile_new

    subroutine bufferedregionprofile_delete(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.delete
        call c_bufferedregionprofile_delete(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.delete
    end subroutine bufferedregionprofile_delete

    subroutine bufferedregionprofile_start(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.start
        call c_bufferedregionprofile_start(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.start
    end subroutine bufferedregionprofile_start

    subroutine bufferedregionprofile_stop(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.stop
        call c_bufferedregionprofile_stop(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.stop
    end subroutine bufferedregionprofile_stop

    subroutine bufferedregionprofile_clear(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.clear
        call c_bufferedregionprofile_clear(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.clear
    end subroutine bufferedregionprofile_clear

    subroutine bufferedregionprofile_fetch_exclusive_region_times(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.fetch_exclusive_region_times
        call c_bufferedregionprofile_fetch_exclusive_region_times(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.fetch_exclusive_region_times
    end subroutine bufferedregionprofile_fetch_exclusive_region_times

    subroutine bufferedregionprofile_fetch_inclusive_region_times(obj)
        class(bufferedregionprofile) :: obj
        ! splicer begin class.BufferedRegionProfile.method.fetch_inclusive_region_times
        call c_bufferedregionprofile_fetch_inclusive_region_times(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.fetch_inclusive_region_times
    end subroutine bufferedregionprofile_fetch_inclusive_region_times

    function bufferedregionprofile_total_profiling_time(obj) &
            result(SHT_rv)
        use iso_c_binding, only : C_DOUBLE
        class(bufferedregionprofile) :: obj
        real(C_DOUBLE) :: SHT_rv
        ! splicer begin class.BufferedRegionProfile.method.total_profiling_time
        SHT_rv = c_bufferedregionprofile_total_profiling_time(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.total_profiling_time
    end function bufferedregionprofile_total_profiling_time

    function bufferedregionprofile_total_region_time(obj) &
            result(SHT_rv)
        use iso_c_binding, only : C_DOUBLE
        class(bufferedregionprofile) :: obj
        real(C_DOUBLE) :: SHT_rv
        ! splicer begin class.BufferedRegionProfile.method.total_region_time
        SHT_rv = c_bufferedregionprofile_total_region_time(obj%cxxmem)
        ! splicer end class.BufferedRegionProfile.method.total_region_time
    end function bufferedregionprofile_total_region_time

    function bufferedregionprofile_region_time(obj, region) &
            result(SHT_rv)
        use iso_c_binding, only : C_DOUBLE, C_NULL_CHAR
        class(bufferedregionprofile) :: obj
        character(len=*), intent(IN) :: region
        real(C_DOUBLE) :: SHT_rv
        ! splicer begin class.BufferedRegionProfile.method.region_time
        SHT_rv = c_bufferedregionprofile_region_time(obj%cxxmem, &
            trim(region)//C_NULL_CHAR)
        ! splicer end class.BufferedRegionProfile.method.region_time
    end function bufferedregionprofile_region_time

    ! Return pointer to C++ memory.
    function bufferedregionprofile_get_instance(obj) result (cxxptr)
        use iso_c_binding, only: C_PTR
        class(bufferedregionprofile), intent(IN) :: obj
        type(C_PTR) :: cxxptr
        cxxptr = obj%cxxmem%addr
    end function bufferedregionprofile_get_instance

    subroutine bufferedregionprofile_set_instance(obj, cxxmem)
        use iso_c_binding, only: C_PTR
        class(bufferedregionprofile), intent(INOUT) :: obj
        type(C_PTR), intent(IN) :: cxxmem
        obj%cxxmem%addr = cxxmem
        obj%cxxmem%idtor = 0
    end subroutine bufferedregionprofile_set_instance

    function bufferedregionprofile_associated(obj) result (rv)
        use iso_c_binding, only: c_associated
        class(bufferedregionprofile), intent(IN) :: obj
        logical rv
        rv = c_associated(obj%cxxmem%addr)
    end function bufferedregionprofile_associated

    ! splicer begin class.BufferedRegionProfile.additional_functions
    ! splicer end class.BufferedRegionProfile.additional_functions

    subroutine cali_config_preset(key, value)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: key
        character(len=*), intent(IN) :: value
        ! splicer begin function.cali_config_preset
        call c_cali_config_preset(trim(key)//C_NULL_CHAR, &
            trim(value)//C_NULL_CHAR)
        ! splicer end function.cali_config_preset
    end subroutine cali_config_preset

    subroutine cali_config_set(key, value)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: key
        character(len=*), intent(IN) :: value
        ! splicer begin function.cali_config_set
        call c_cali_config_set(trim(key)//C_NULL_CHAR, &
            trim(value)//C_NULL_CHAR)
        ! splicer end function.cali_config_set
    end subroutine cali_config_set

    function cali_create_attribute(name, type, prop) &
            result(SHT_rv)
        use iso_c_binding, only : C_INT, C_INT64_T, C_NULL_CHAR
        character(len=*), intent(IN) :: name
        integer(C_INT), value, intent(IN) :: type
        integer(C_INT), value, intent(IN) :: prop
        integer(C_INT64_T) :: SHT_rv
        ! splicer begin function.cali_create_attribute
        SHT_rv = c_cali_create_attribute(trim(name)//C_NULL_CHAR, type, &
            prop)
        ! splicer end function.cali_create_attribute
    end function cali_create_attribute

    function cali_find_attribute(name) &
            result(SHT_rv)
        use iso_c_binding, only : C_INT64_T, C_NULL_CHAR
        character(len=*), intent(IN) :: name
        integer(C_INT64_T) :: SHT_rv
        ! splicer begin function.cali_find_attribute
        SHT_rv = c_cali_find_attribute(trim(name)//C_NULL_CHAR)
        ! splicer end function.cali_find_attribute
    end function cali_find_attribute

    subroutine cali_begin_string(attr_id, val)
        use iso_c_binding, only : C_INT64_T, C_NULL_CHAR
        integer(C_INT64_T), value, intent(IN) :: attr_id
        character(len=*), intent(IN) :: val
        ! splicer begin function.cali_begin_string
        call c_cali_begin_string(attr_id, trim(val)//C_NULL_CHAR)
        ! splicer end function.cali_begin_string
    end subroutine cali_begin_string

    subroutine cali_begin_int_byname(attr_name, val)
        use iso_c_binding, only : C_INT, C_NULL_CHAR
        character(len=*), intent(IN) :: attr_name
        integer(C_INT), value, intent(IN) :: val
        ! splicer begin function.cali_begin_int_byname
        call c_cali_begin_int_byname(trim(attr_name)//C_NULL_CHAR, val)
        ! splicer end function.cali_begin_int_byname
    end subroutine cali_begin_int_byname

    subroutine cali_begin_string_byname(attr_name, val)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: attr_name
        character(len=*), intent(IN) :: val
        ! splicer begin function.cali_begin_string_byname
        call c_cali_begin_string_byname(trim(attr_name)//C_NULL_CHAR, &
            trim(val)//C_NULL_CHAR)
        ! splicer end function.cali_begin_string_byname
    end subroutine cali_begin_string_byname

    subroutine cali_end_byname(attr_name)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: attr_name
        ! splicer begin function.cali_end_byname
        call c_cali_end_byname(trim(attr_name)//C_NULL_CHAR)
        ! splicer end function.cali_end_byname
    end subroutine cali_end_byname

    subroutine cali_begin_region(name)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: name
        ! splicer begin function.cali_begin_region
        call c_cali_begin_region(trim(name)//C_NULL_CHAR)
        ! splicer end function.cali_begin_region
    end subroutine cali_begin_region

    subroutine cali_end_region(name)
        use iso_c_binding, only : C_NULL_CHAR
        character(len=*), intent(IN) :: name
        ! splicer begin function.cali_end_region
        call c_cali_end_region(trim(name)//C_NULL_CHAR)
        ! splicer end function.cali_end_region
    end subroutine cali_end_region

    function cali_make_loop_iteration_attribute(name) &
            result(SHT_rv)
        use iso_c_binding, only : C_INT64_T, C_NULL_CHAR
        character(len=*), intent(IN) :: name
        integer(C_INT64_T) :: SHT_rv
        ! splicer begin function.cali_make_loop_iteration_attribute
        SHT_rv = c_cali_make_loop_iteration_attribute(trim(name)//C_NULL_CHAR)
        ! splicer end function.cali_make_loop_iteration_attribute
    end function cali_make_loop_iteration_attribute

    ! splicer begin additional_functions
    ! splicer end additional_functions

    function scopeannotation_eq(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(scopeannotation), intent(IN) ::a,b
        logical :: rv
        if (c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function scopeannotation_eq

    function scopeannotation_ne(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(scopeannotation), intent(IN) ::a,b
        logical :: rv
        if (.not. c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function scopeannotation_ne

    function annotation_eq(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(annotation), intent(IN) ::a,b
        logical :: rv
        if (c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function annotation_eq

    function annotation_ne(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(annotation), intent(IN) ::a,b
        logical :: rv
        if (.not. c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function annotation_ne

    function configmanager_eq(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(configmanager), intent(IN) ::a,b
        logical :: rv
        if (c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function configmanager_eq

    function configmanager_ne(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(configmanager), intent(IN) ::a,b
        logical :: rv
        if (.not. c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function configmanager_ne

    function bufferedregionprofile_eq(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(bufferedregionprofile), intent(IN) ::a,b
        logical :: rv
        if (c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function bufferedregionprofile_eq

    function bufferedregionprofile_ne(a,b) result (rv)
        use iso_c_binding, only: c_associated
        type(bufferedregionprofile), intent(IN) ::a,b
        logical :: rv
        if (.not. c_associated(a%cxxmem%addr, b%cxxmem%addr)) then
            rv = .true.
        else
            rv = .false.
        endif
    end function bufferedregionprofile_ne

end module caliper_mod
