Пример #1
0
 def customize(self, mb ):
     mb.classes().redefine_operators = True
     mb.add_declaration_code( 'const operators_bug::vector operators_bug::vector::one(1);' )
     tg = code_creators.target_configuration_t( )
     #tg.boost_python_has_wrapper_held_type = False
     mb.build_code_creator( self.EXTENSION_NAME, target_configuration=tg )
     mb.constructors().allow_implicit_conversion = False
Пример #2
0
 def customize(self, mb):
     mb.classes().redefine_operators = True
     mb.add_declaration_code(
         'const operators_bug::vector operators_bug::vector::one(1);')
     tg = code_creators.target_configuration_t()
     #tg.boost_python_has_wrapper_held_type = False
     mb.build_code_creator(self.EXTENSION_NAME, target_configuration=tg)
     mb.constructors().allow_implicit_conversion = False
Пример #3
0
    def __init__( self
                  , decls
                  , module_name
                  , boost_python_ns_name='bp'
                  , call_policies_resolver_=None
                  , types_db=None
                  , target_configuration=None
                  , enable_indexing_suite=True ):
        """Constructor.

        :param decls: Declarations that should be exposed in the final module.
        :param module_name: The name of the final module.
        :param boost_python_ns_name: The alias for the boost::python namespace.
        :param call_policies_resolver_: Callable that takes one declaration (calldef_t) as input and returns a call policy object which should be used for this declaration.
        :param types_db: ...todo...
        :param target_configuration: A target configuration object can be used to customize the generated source code to a particular compiler or a particular version of Boost.Python.
        :param already_exposed_dbs: list of files/directories other modules, this module depends on, generated their code too
        :type decls: list of declaration_t
        :type module_name: str
        :type boost_python_ns_name: str
        :type call_policies_resolver_: callable
        :type types_db: L:class:`types_database.types_database_t`
        :type target_configuration: :class:`code_creators.target_configuration_t`
        :type already_exposed_dbs: list of strings
        """
        declarations.decl_visitor_t.__init__(self)
        self.logger = _logging_.loggers.module_builder
        self.decl_logger = _logging_.loggers.declarations

        self.__enable_indexing_suite = enable_indexing_suite
        self.__target_configuration = target_configuration
        if not self.__target_configuration:
            self.__target_configuration = code_creators.target_configuration_t()

        self.__call_policies_resolver = call_policies_resolver_
        if not self.__call_policies_resolver:
            self.__call_policies_resolver \
                = call_policies_resolver.built_in_resolver_t(self.__target_configuration)

        self.__types_db = types_db
        if not self.__types_db:
            self.__types_db = types_database.types_database_t()

        global_ns = declarations.get_global_namespace(decls)

        self.__extmodule = code_creators.bpmodule_t( global_ns )
        if boost_python_ns_name:
            bp_ns_alias = code_creators.namespace_alias_t( alias=boost_python_ns_name
                                                           , full_namespace_name='::boost::python' )
            self.__extmodule.adopt_creator( bp_ns_alias )

        self.__module_body = code_creators.module_body_t( name=module_name )

        self.__extmodule.adopt_creator( self.__module_body )

        self.__opaque_types_manager = opaque_types_manager.manager_t( self.__extmodule )
        self.__dependencies_manager = dependencies_manager.manager_t(self.decl_logger)

        prepared_decls = self._prepare_decls( decls )
        self.__decls = sort_algorithms.sort( prepared_decls )

        self.curr_code_creator = self.__module_body
        self.curr_decl = None
        self.__array_1_registered = set() #(type.decl_string,size)
        self.__free_operators = []
        self.__std_containers_free_operators = {}
        self.__exposed_free_fun_overloads = set()
        self.__fc_manager = fake_constructors_manager.manager_t( global_ns )