Library of Assembled Shared Sources
 
Loading...
Searching...
No Matches
Module Declaration Macros

Detailed Description

These macros declare and define ModuleDefinition objects that represent Python modules.

They create the fundamental module object that serves as the container for all exported functions, classes, and constants.

Macros

#define PY_DECLARE_MODULE_NAME_DOC(i_module, s_name, s_doc)
 Declare and define a ModuleDefinition object representing a Python module.
 
#define PY_DECLARE_MODULE_NAME(i_module, s_name)
 Declare a module with name only (no documentation).
 
#define PY_DECLARE_MODULE_DOC(i_module, s_doc)
 Declare a module with documentation, using the identifier as the module name.
 
#define PY_DECLARE_MODULE(i_module)
 Declare a module with minimal setup (name derived from identifier, no documentation).
 

Macro Definition Documentation

◆ PY_DECLARE_MODULE_NAME_DOC

#define PY_DECLARE_MODULE_NAME_DOC ( i_module,
s_name,
s_doc )
Value:
::lass::python::ModuleDefinition i_module( s_name, s_doc );
Definition of a Python module.

Declare and define a ModuleDefinition object representing a Python module.

Creates a ModuleDefinition instance that can be used to build a Python module with the specified name and documentation.

Parameters
i_moduleUnscoped identifier of the module, used as C++ variable name
s_namePython module name (const char* string, will be copied)
s_docmodule docstring (const char* string, will be copied), or nullptr
Example
PY_DECLARE_MODULE_NAME_DOC(mod_mymodule, "mymodule", "My module with awesome things")
#define PY_DECLARE_MODULE_NAME_DOC(i_module, s_name, s_doc)
Declare and define a ModuleDefinition object representing a Python module.

Definition at line 196 of file pyobject_macros.h.

◆ PY_DECLARE_MODULE_NAME

#define PY_DECLARE_MODULE_NAME ( i_module,
s_name )
Value:
PY_DECLARE_MODULE_NAME_DOC( i_module, s_name, 0)

Declare a module with name only (no documentation).

Wraps PY_DECLARE_MODULE_NAME_DOC() with s_doc = nullptr.

Parameters
i_moduleUnscoped identifier of the module, used as C++ variable name
s_namePython module name (const char* string, will be copied)
Example
PY_DECLARE_MODULE_NAME(mod_mymodule, "mymodule")
#define PY_DECLARE_MODULE_NAME(i_module, s_name)
Declare a module with name only (no documentation).

Definition at line 212 of file pyobject_macros.h.

◆ PY_DECLARE_MODULE_DOC

#define PY_DECLARE_MODULE_DOC ( i_module,
s_doc )
Value:
PY_DECLARE_MODULE_NAME_DOC( i_module, LASS_STRINGIFY(i_module), s_doc)

Declare a module with documentation, using the identifier as the module name.

Wraps PY_DECLARE_MODULE_NAME_DOC() with s_name derived from i_module.

Parameters
i_moduleUnscoped identifier of the module, used as C++ variable and Python module name
s_docModule documentation string (const char* string, will be copied), or nullptr
Example
PY_DECLARE_MODULE_DOC(mymodule, "My module with awesome things")
#define PY_DECLARE_MODULE_DOC(i_module, s_doc)
Declare a module with documentation, using the identifier as the module name.

Definition at line 228 of file pyobject_macros.h.

◆ PY_DECLARE_MODULE

#define PY_DECLARE_MODULE ( i_module)
Value:
PY_DECLARE_MODULE_NAME_DOC( i_module, LASS_STRINGIFY(i_module), 0)

Declare a module with minimal setup (name derived from identifier, no documentation).

Wraps PY_DECLARE_MODULE_NAME_DOC() with defaults.

Parameters
i_moduleUnscoped identifier of the module, used as C++ variable and Python module name
Example
#define PY_DECLARE_MODULE(i_module)
Declare a module with minimal setup (name derived from identifier, no documentation).

Definition at line 243 of file pyobject_macros.h.