fgen.wrapper_building.fortran_wrapper_module#
Generation of the Fortran wrapper module
FortranWrapperModuleBuilder#
- class FortranWrapperModuleBuilder(package, module, shared)[source]#
Bases:
objectBuilder of a Fortran wrapper module
- get_module_level_docstring()[source]#
Get the module-level docstring
- Returns:
str– Module-level docstring
- get_module_use_statements()[source]#
Get the module-level use statements
- Returns:
str– Module-level use statements
- get_provided_type_build_methods()[source]#
Get the provided type’s build methods
- Returns:
str– Class methods
- get_provided_type_getters_and_setters()[source]#
Get the provided type’s getters and setters
- Returns:
str– Provided type’s getters and setters
- get_provided_type_methods()[source]#
Get the provided type’s methods
- Returns:
str– Provided type’s methods
- get_receiving_from_python_steps(arguments)[source]#
Get receiving from Python steps for a set of arguments
- Parameters:
arguments (
collections.abc.Iterable[typing.Union[fgen.data_models.multi_return.MultiReturn,fgen.data_models.value.Value]]) – Arguments for which to get the receiving from Python steps- Returns:
fgen.wrapping_strategies.receiving_from_python_steps.ReceivingFromPythonSteps– Steps for receiving the arguments from Python
- get_requirements_fortran_use_statements()[source]#
Get the Fortran
usestatements needed for the module- Returns:
str– Fortranusestatements needed for the module
- get_requirements_fortran_uses(module)[source]#
Get the Fortran
use’s needed for the module- Parameters:
module (
fgen.data_models.module.Module) – Module for which to get theuse’s- Returns:
dict[str,fgen.wrapper_building.fortran_wrapper_module.NeededType] – Fortranusestatements needed for the module
- get_statement_declarations_getters_and_setters()[source]#
Get the statement declarations for getters and setters
- Returns:
str– Statement declarations for the getters and setters
- get_statement_declarations_methods()[source]#
Get the statement declarations for methods
- Returns:
str– Statement declarations for the methods exposed by the derived type defined by this module.
- get_wrapping_strategy(value)[source]#
Get wrapping strategy
- Parameters:
value (
typing.Union[fgen.data_models.multi_return.MultiReturn,fgen.data_models.value.Value]) – Value for which to get the wrapping strategy- Returns:
fgen.wrapping_strategies.interface.WrappingStrategyLike– Wrapping strategy to use with the value
-
module:
fgen.data_models.module.Module# Module for which to build the wrapper
-
package:
fgen.data_models.package.Package# Package for which the builder is building wrappers
- requires_import(value, module)[source]#
Return whether a value requires an import or not
- Parameters:
value (
typing.Union[fgen.data_models.value.Value,fgen.data_models.multi_return.MultiReturn]) – Value to checkmodule (
fgen.data_models.module.Module) – Module in which the value is being used
- Returns:
bool–Trueif this values requires an import,Falseotherwise.
Elements which have to be shared across the package
For example, the names of functions which are used in more than one wrapper module.
NeededType#
- class NeededType(name, providing_module, requires_get_instance, requires_get_free_instance_number)[source]#
Bases:
objectHelper class for keeping track of the first-party types needed by the modle
-
providing_module:
typing.Union[fgen.data_models.module.Module,str]# Module or name of the module which provides this type
-
providing_module:
generate_fortran_wrapper_module#
- generate_fortran_wrapper_module(builder)[source]#
Generate the Fortran wrapper module
- Parameters:
builder (
fgen.wrapper_building.fortran_wrapper_module.FortranWrapperModuleBuilder) – Builder to use to generate the Fortran wrapper module- Returns:
str– Fortran wrapper module as code