real64_to_base64_single Subroutine

public subroutine real64_to_base64_single(indata, outfile)

this routine encodes a single variable of type real64 into base64 format

Arguments

Type IntentOptional AttributesName
real(kind=c_double), intent(in), target:: indata

data to be encoded

integer, intent(in) :: outfile

output file unit


Calls

proc~~real64_to_base64_single~~CallsGraph proc~real64_to_base64_single real64_to_base64_single interface~encodeblock EncodeBlock proc~real64_to_base64_single->interface~encodeblock interface~encodeindex EncodeIndex proc~real64_to_base64_single->interface~encodeindex

Called by

proc~~real64_to_base64_single~~CalledByGraph proc~real64_to_base64_single real64_to_base64_single interface~convert_to_base64_single convert_to_Base64_single interface~convert_to_base64_single->proc~real64_to_base64_single proc~int8_to_base64 int8_to_base64 proc~int8_to_base64->interface~convert_to_base64_single proc~int32_to_base64 int32_to_base64 proc~int32_to_base64->interface~convert_to_base64_single proc~char_to_base64 char_to_base64 proc~char_to_base64->interface~convert_to_base64_single proc~real64_to_base64 real64_to_base64 proc~real64_to_base64->interface~convert_to_base64_single proc~int64_to_base64 int64_to_base64 proc~int64_to_base64->interface~convert_to_base64_single proc~real32_to_base64 real32_to_base64 proc~real32_to_base64->interface~convert_to_base64_single interface~convert_to_base64 convert_to_Base64 interface~convert_to_base64->proc~int8_to_base64 interface~convert_to_base64->proc~int32_to_base64 interface~convert_to_base64->proc~char_to_base64 interface~convert_to_base64->proc~real64_to_base64 interface~convert_to_base64->proc~int64_to_base64 interface~convert_to_base64->proc~real32_to_base64 proc~hvs_vtk_write_meshdata~2 hvs_vtk_write_meshdata proc~hvs_vtk_write_meshdata~2->interface~convert_to_base64 proc~hvs_vtk_dump_data~2 hvs_vtk_dump_data proc~hvs_vtk_dump_data~2->interface~convert_to_base64 proc~hvs_dump_debug_array hvs_dump_debug_array proc~hvs_dump_debug_array->interface~convert_to_base64

Contents


Source Code

  subroutine real64_to_base64_single( indata, outfile )
    ! ---------------------------------------------------------------------------
    !> data to be encoded
    real(kind=c_double), target, intent(in) :: indata
    !> output file unit
    integer, intent(in) :: outfile
    ! ---------------------------------------------------------------------------
    integer(kind=c_int) :: baserc
    integer(kind=c_int) :: insize, outsize, ipindex, min_iplen
    integer :: ind
    type(c_ptr) :: base64_out
    type(c_ptr) :: base64_in
    type(c_ptr) :: encoder_in
    character, target :: base64_string(encoderlen), encoder_str(encoderblocklen)
    ! ---------------------------------------------------------------------------

    base64_in = c_loc(indata)

    insize = int(c_sizeof(indata), kind=4)

    outsize = ceiling(insize/3._rk)*4

    base64_out = c_loc(base64_string)

    encoder_in = c_loc(encoder_str)

    ipindex = 0
    do
      do ind = 0, 2
        baserc = encodeindex( base64_in, encoder_in, insize, ind, ipindex )
        ipindex = ipindex + 1
      end do
      min_iplen = min(insize - ipindex + 3, 3)
      baserc = encodeblock( encoder_in, base64_out, min_iplen, outsize )
      write(outfile) base64_string
      if (ipindex >= insize) exit
    end do

  end subroutine real64_to_base64_single