cast_nonstrict Interface

public interface cast_nonstrict

Non-strict casts/transforms between Fortran and Python datatypes

Result is 1st argument to cast, 2nd argument object/scalar to cast

In contrast to cast, cast_nonstrict tries to convert to the type specified by the 1st argument even when there is no exact correspondence of types. Non-strict cast might lead to loss of information (e. g. when casting a float to an integer) or might need additional memory and time for making a copy (e. g. casting a list to a tuple)

Use to cast/transform a Python object into a Fortran value and to cast an unspecific Python object into more specific objects, such as list or tuple, converting between types when necessary. Fortran values can be scalars or character strings.

Can be used to get the string representation of a Python object as a Fortran character string. Python strings are encoded as UTF-8



Module Procedures

private function cast_nonstrict_to_list(li, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
type(list), intent(out) :: li
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_tuple(tu, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
type(tuple), intent(out) :: tu
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_chars(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
character(kind=C_CHAR,len=:), intent(out), allocatable:: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_int32(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_int64(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
integer(kind=int64), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_real32(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
real(kind=real32), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_real64(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
real(kind=real64), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_complex_real32(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
complex(kind=real32), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_complex_real64(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
complex(kind=real64), intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)

private function cast_nonstrict_to_logical(out_value, obj) result(ierror)

Arguments

Type IntentOptional AttributesName
logical, intent(out) :: out_value
class(object), intent(in) :: obj

Return Value integer(kind=C_INT)