MONC
Private Member Functions | List of all members
conversions_mod::conv_to_generic Interface Reference

Converts a data type into the generic (class *) form. More...

Private Member Functions

class(*) function, pointer string_to_generic (string, makecopy)
 Converts a string into its generic data representation. More...
 
class(*) function, pointer integer_to_generic (input, makecopy)
 Converts an integer into its generic data representation. More...
 
class(*) function, pointer real_single_to_generic (input, makecopy)
 Converts a single real into its generic data representation. More...
 
class(*) function, pointer real_double_to_generic (input, makecopy)
 Converts a double real into its generic data representation. More...
 
class(*) function, pointer logical_to_generic (input, makecopy)
 Converts a logical into its generic data representation. More...
 

Detailed Description

Converts a data type into the generic (class *) form.

Will convert structured data into its generic form and return a pointer to this. The caller should also specify whether to make a copy of the data or not

Parameters
dataThe structured data to convert into generic
copyflagWhether to use a copy of the structured data or not
Returns
A pointer to the generic representation of the data

Definition at line 23 of file conversions.F90.

Member Function/Subroutine Documentation

◆ integer_to_generic()

class(*) function, pointer conversions_mod::conv_to_generic::integer_to_generic ( integer, intent(in), target  input,
logical, intent(in)  makecopy 
)
private

Converts an integer into its generic data representation.

Parameters
inputThe integer to convert into its generic representation
makecopyWhether make a copy of the underlying data or just return a simple pointer
Returns
A pointer to the generic data

Definition at line 550 of file conversions.F90.

550  integer, target , intent(in) :: input
551  logical, intent(in) :: makecopy
552  class(*), pointer :: integer_to_generic
553 
554  if (makecopy) then
555  allocate(integer_to_generic, source=input)
556  else
557  integer_to_generic=>input
558  end if

◆ logical_to_generic()

class(*) function, pointer conversions_mod::conv_to_generic::logical_to_generic ( logical, intent(in), target  input,
logical, intent(in)  makecopy 
)
private

Converts a logical into its generic data representation.

Parameters
inputThe logical to convert into its generic representation
makecopyWhether make a copy of the underlying data or just return a simple pointer
Returns
A pointer to the generic data

Definition at line 598 of file conversions.F90.

598  logical, target, intent(in) :: input
599  logical, intent(in) :: makecopy
600  class(*), pointer :: logical_to_generic
601 
602  if (makecopy) then
603  allocate(logical_to_generic, source=input)
604  else
605  logical_to_generic=>input
606  end if

◆ real_double_to_generic()

class(*) function, pointer conversions_mod::conv_to_generic::real_double_to_generic ( real(kind=double_precision), intent(in), target  input,
logical, intent(in)  makecopy 
)
private

Converts a double real into its generic data representation.

Parameters
inputThe real to convert into its generic representation
makecopyWhether make a copy of the underlying data or just return a simple pointer
Returns
A pointer to the generic data

Definition at line 582 of file conversions.F90.

582  real(kind=DOUBLE_PRECISION), target, intent(in) :: input
583  logical, intent(in) :: makecopy
584  class(*), pointer :: real_double_to_generic
585 
586  if (makecopy) then
587  allocate(real_double_to_generic, source=input)
588  else
589  real_double_to_generic=>input
590  end if

◆ real_single_to_generic()

class(*) function, pointer conversions_mod::conv_to_generic::real_single_to_generic ( real(kind=single_precision), intent(in), target  input,
logical, intent(in)  makecopy 
)
private

Converts a single real into its generic data representation.

Parameters
inputThe real to convert into its generic representation
makecopyWhether make a copy of the underlying data or just return a simple pointer
Returns
A pointer to the generic data

Definition at line 566 of file conversions.F90.

566  real(kind=SINGLE_PRECISION), target, intent(in) :: input
567  logical, intent(in) :: makecopy
568  class(*), pointer :: real_single_to_generic
569 
570  if (makecopy) then
571  allocate(real_single_to_generic, source=input)
572  else
573  real_single_to_generic=>input
574  end if

◆ string_to_generic()

class(*) function, pointer conversions_mod::conv_to_generic::string_to_generic ( character(len=*), intent(in), target  string,
logical, intent(in)  makecopy 
)
private

Converts a string into its generic data representation.

Parameters
stringThe string to convert into its generic representation
makecopyWhether make a copy of the underlying data or just return a simple pointer
Returns
A pointer to the generic data

Definition at line 534 of file conversions.F90.

534  character(len=*), target, intent(in) :: string
535  logical, intent(in) :: makecopy
536  class(*), pointer :: string_to_generic
537 
538  if (makecopy) then
539  allocate(string_to_generic, source=string)
540  else
541  string_to_generic=>string
542  end if

The documentation for this interface was generated from the following file: