Package pyplusplus :: Package module_builder :: Module builder :: Class module_builder_t

# type module_builder_t

source code

    object --+
             |
            module_builder_t

This class provides users with simple and intuitive interface to Py++ and/or pygccxml functionality. If this is your first attempt to use Py++ consider to read tutorials. You can find them on web site.

Instance Methods

__init__(self, files, gccxml_path=`'````'`, working_directory=`'``.``'`, include_paths=None, define_symbols=None, undefine_symbols=None, start_with_declarations=None, compilation_mode=None, cache=None, optimize_queries=True, ignore_gccxml_output=False, indexing_suite_version=1, cflags=`'````'`, encoding=`'``ascii``'`, compiler=None) | source code

register_module_dependency(self, other_module_generated_code_dir) ``already_exposed`` solution is pretty good when you mix hand-written modules with Py++ generated. | source code

run_query_optimizer(self) It is possible to optimze time that takes to execute queries. | source code

print_declarations(self, decl=None, detailed=True, recursive=True, writer=<bound method _DevNull.write of <epydoc.docintrospecter._DevNu`...`) This function will print detailed description of all declarations or some specific one. | source code

build_code_creator(self, module_name, boost_python_ns_name=`'``bp``'`, create_casting_constructor=True, call_policies_resolver_=None, types_db=None, target_configuration=None, enable_indexing_suite=True, doc_extractor=None) Creates module_t code creator. | source code

has_code_creator(self) Function, that will return True if build_code_creator function has been called and False otherwise | source code

add_declaration_code(self, code, tail=True) | source code

add_registration_code(self, code, tail=True) | source code

add_constants(self, **keywds) adds code that exposes some constants to Python. | source code

write_module(self, file_name) Writes module to single file | source code

split_module(self, dir_name, huge_classes=None, on_unused_file_found=<built-in function remove>, use_files_sum_repository=False) Writes module to multiple files | source code

balanced_split_module(self, dir_name, number_of_files, on_unused_file_found=<built-in function remove>, use_files_sum_repository=False) Writes module to fixed number of multiple cpp files | source code

decl(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

decls(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

class_(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

classes(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

variable(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

var(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

variables(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

vars(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

calldef(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

calldefs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

operator(self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

operators(self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

member_function(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

mem_fun(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

member_functions(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

mem_funs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

constructor(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

constructors(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

member_operator(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

member_operators(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

casting_operator(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

casting_operators(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

enumeration(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

enum(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

enumerations(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

enums(self, name=None, function=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.scopedef_t class documentation | source code

namespace(self, name=None, function=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

namespaces(self, name=None, function=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_function(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_fun(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_functions(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_funs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_operator(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

free_operators(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None) Please see decl_wrappers.namespace_t class documentation | source code

Properties
| global_ns reference to global namespace
| encoding
| declarations_code_head List of user code, that will be added to the head of the declarations section.
| declarations_code_tail List of user code, that will be added to the tail of the declarations section.
| registrations_code_head List of user code, that will be added to the head of the registrations section.
| registrations_code_tail List of user code, that will be added to the tail of the registrations section.
| code_creator reference to code_creators.module_t instance
| BOOST_PYTHON_MAX_ARITY

Method Details

### __init__(self, files, gccxml_path=`'````'`, working_directory=`'``.``'`, include_paths=None, define_symbols=None, undefine_symbols=None, start_with_declarations=None, compilation_mode=None, cache=None, optimize_queries=True, ignore_gccxml_output=False, indexing_suite_version=1, cflags=`'````'`, encoding=`'``ascii``'`, compiler=None)
(Constructor)

source code

Parameters:
  - `files` (list of strings or file_configuration_t instances) - list of files, declarations from them you want to export
  - `gccxml_path` (str) - path to gccxml binary. If you don't pass this argument, pygccxml parser will try to locate it using you environment PATH variable
  - `include_paths` (list of strings) - additional header files location. You don't have to specify system and standard directories.
  - `define_symbols` - list of symbols to be defined for preprocessor.
  - `define_symbols` - list of strings
  - `undefine_symbols` - list of symbols to be undefined for preprocessor.
  - `undefine_symbols` - list of strings
  - `cflags` - Raw string to be added to gccxml command line.
Overrides: object.__init__

### register_module_dependency(self, other_module_generated_code_dir)

source code

``already_exposed`` solution is pretty good when you mix hand-written modules with Py++ generated. It doesn't work/scale for "true" multi-module development. This is exactly the reason why ``Py++``_ offers "semi automatic" solution.

For every exposed module, ``Py++``_ generates "exposed_decl.pypp.txt" file. This file contains the list of all parsed declarations and whether they were included or excluded. Later, when you work on another module, you can tell ``Py++``_ that the current module depends on the previously generated one. ``Py++``_ will load "exposed_decl.pypp.txt" file and update the declarations.

### run_query_optimizer(self)

source code

It is possible to optimze time that takes to execute queries. In most cases this is done from __init__ method. But there are use-case, when you need to disable optimizer at __init__ and run it later.

### print_declarations(self, decl=None, detailed=True, recursive=True, writer=<bound method _DevNull.write of <epydoc.docintrospecter._DevNu`...`)

source code

This function will print detailed description of all declarations or some specific one.

Parameters:
  - `decl` (instance of decl_wrappers.decl_wrapper_t class) - optional, if passed, then only it will be printed

### build_code_creator(self, module_name, boost_python_ns_name=`'``bp``'`, create_casting_constructor=True, call_policies_resolver_=None, types_db=None, target_configuration=None, enable_indexing_suite=True, doc_extractor=None)

source code

Creates module_t code creator.

Parameters:
  - `module_name` (string) - module name
  - `boost_python_ns_name` (string) - boost::python namespace alias, by default it is 'bp'
  - `call_policies_resolver_` (callable) - callable, that will be invoked on every calldef object. It should return call policies.
  - `doc_extractor` (callable or None) - callable, that takes as argument reference to declaration and returns documentation string

### add_constants(self, **keywds)

source code

    adds code that exposes some constants to Python.

    For example:
        mb.add_constants( version='"1.2.3"' )
    or
        mb.add_constants( **{ version:'"1.2.3"' } )
    will generate next code:
        boost::python::scope().attr("version") = "1.2.3";

### write_module(self, file_name)

source code

Writes module to single file

Parameters:
  - `file_name` (string) - file name

### split_module(self, dir_name, huge_classes=None, on_unused_file_found=<built-in function remove>, use_files_sum_repository=False)

source code

Writes module to multiple files

Parameters:
  - `dir_name` (string) - directory name
  - `huge_classes` - list that contains reference to classes, that should be split
  - `on_unused_file_found` - callable object that represents the action that should be taken on file, which is no more in use

### balanced_split_module(self, dir_name, number_of_files, on_unused_file_found=<built-in function remove>, use_files_sum_repository=False)

source code

Writes module to fixed number of multiple cpp files

Parameters:
  - `number_of_files` (int) - the desired number of generated cpp files
  - `dir_name` (string) - directory name
  - `on_unused_file_found` - callable object that represents the action that should be taken on file, which is no more in use

Property Details

### global_ns

reference to global namespace

### encoding

### declarations_code_head

List of user code, that will be added to the head of the declarations section.

### declarations_code_tail

List of user code, that will be added to the tail of the declarations section.

### registrations_code_head

List of user code, that will be added to the head of the registrations section.

### registrations_code_tail

List of user code, that will be added to the tail of the registrations section.

### code_creator

reference to code_creators.module_t instance

### BOOST_PYTHON_MAX_ARITY

Get Method:
  _get_BOOST_PYTHON_MAX_ARITY(self)
Set Method:
  _set_BOOST_PYTHON_MAX_ARITY(self, value)