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 25 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 561 of file conversions.F90.

562  integer, target , intent(in) :: input
563  logical, intent(in) :: makecopy
564  class(*), pointer :: integer_to_generic
565 
566  if (makecopy) then
567  allocate(integer_to_generic, source=input)
568  else
569  integer_to_generic=>input
570  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 609 of file conversions.F90.

610  logical, target, intent(in) :: input
611  logical, intent(in) :: makecopy
612  class(*), pointer :: logical_to_generic
613 
614  if (makecopy) then
615  allocate(logical_to_generic, source=input)
616  else
617  logical_to_generic=>input
618  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 593 of file conversions.F90.

594  real(kind=double_precision), target, intent(in) :: input
595  logical, intent(in) :: makecopy
596  class(*), pointer :: real_double_to_generic
597 
598  if (makecopy) then
599  allocate(real_double_to_generic, source=input)
600  else
601  real_double_to_generic=>input
602  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 577 of file conversions.F90.

578  real(kind=single_precision), target, intent(in) :: input
579  logical, intent(in) :: makecopy
580  class(*), pointer :: real_single_to_generic
581 
582  if (makecopy) then
583  allocate(real_single_to_generic, source=input)
584  else
585  real_single_to_generic=>input
586  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 545 of file conversions.F90.

546  character(len=*), target, intent(in) :: string
547  logical, intent(in) :: makecopy
548  class(*), pointer :: string_to_generic
549 
550  if (makecopy) then
551  allocate(string_to_generic, source=string)
552  else
553  string_to_generic=>string
554  end if

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