#!/usr/bin/env python from pywrap.wrapper import Wrapper import pywrap.namespaces as ns wrap = Wrapper() mb = wrap.mb # include everything from test namespace mb.namespace("test").include() # expose only public interfaces ns.exclude_by_access_type(mb, ['variables', 'calldefs', 'classes'], 'private') ns.exclude_by_access_type(mb, ['variables', 'calldefs', 'classes'], 'protected') # exclude names begining with a single underscore or ending with Cpp ns.exclude_by_regex(mb, ['calldefs'], r'(^_[^_])|(.*Cpp$)|(^impl$)') wrap.finish()
# propagate "explictness" to python :) cl.constructors(lambda c: c.explicit == True, allow_empty=True).allow_implicit_conversion = False # expose member variables of type `boost::optional<vector<...>>` uns = mb.namespace('::marocco::placement::algorithms') namespaces.extend_array_operators(uns) for cl in uns.classes(allow_empty=True): cl.include() for variable in cl.variables(allow_empty=True): classes.add_optional_vector_wrapper_for(mb, variable) classes.add_pickle_suite(cl) cl.constructors(lambda c: c.explicit == True, allow_empty=True).allow_implicit_conversion = False # Do not expose typedefs (prevent AttributeErrors on import) for td in mb.typedefs(allow_empty=True): td.exclude() # expose only public interfaces and protected interfaces, # protected variables cannot be exposed :( namespaces.exclude_by_access_type( mb, ['variables', 'calldefs', 'classes', 'typedefs'], 'private') mb.namespace('::boost::serialization').exclude() containers.extend_std_containers(mb) wrap.set_number_of_files(0) wrap.finish()
calibtic.typedefs(points_to_smart_ptr).exclude() free_functions = [ 'loadADCCalibration', 'storeADCCalibration', ] for fun in free_functions: mb.free_function(fun).include() ns.exclude(mb, 'namespaces', [ '::boost::serialization', '::boost::archive', '::boost::mpi', ], allow_missing=True) # expose only public interfaces ns.exclude_by_access_type(mb, ['classes'], 'private') mb.decl("::std::pair< double, double>").include() ns_hmf = mb.namespace("::HMF") f = ns_hmf.free_function( "to_string", arg_types=["::HMF::NeuronCalibrationParameters::Calibrations::calib"]) f.include() wrap.finish()