コード例 #1
0
ファイル: generate.py プロジェクト: cpehle/halbe
    Returns:
        True if __str__() should be wrapped
        False otherwise
    """
    allowed_namespace = matchers.namespace_contains_matcher_t(
        ns_hmf_hicann.name)(c)
    return allowed_namespace and (c.decl_string in cls_w_ostream)


# Special fix up
containers.extend_std_containers(mb)
namespaces.include_default_copy_constructors(mb)

for f in ['get_trace']:
    f = ns_hmf.free_function("get_trace")
    f.call_policies = call_policies.custom_call_policies(
        "::pywrap::ReturnNumpyPolicy", "pywrap/return_numpy_policy.hpp")

#Normally included classes
for ns in included_ns:
    ns.include()
    add_numpy_construtor_to_strong_typedefs(ns)
    namespaces.extend_array_operators(ns)

    for c in ns.classes(allow_empty=True):
        if ignore(c):
            continue

        c.include()
        for base in classes.get_all_bases(c):
            base.include()
            base.constructors(
コード例 #2
0
cls = [
    'NeuronCalibrationParameters',
    'VoltageMeasurement',
    'DataPoint',
]

ns.include(mb, 'classes', cls)

ns.include(mb, 'namespaces', ['::calibtic::backend'])

calibtic = mb.global_ns.namespace('::calibtic')

cls = mb.class_('Polynomial')
for fname in ('find_roots', 'find_real_roots'):
    cls.mem_fun(fname).call_policies = call_policies.custom_call_policies(
        "::pywrap::ReturnNumpyPolicy", "pywrap/return_numpy_policy.hpp")


def points_to_smart_ptr(td):
    return smart_pointer_traits.is_smart_pointer(td.target_decl)


calibtic.typedefs(points_to_smart_ptr).exclude()

free_functions = [
    'loadADCCalibration',
    'storeADCCalibration',
]

for fun in free_functions:
    mb.free_function(fun).include()
コード例 #3
0
containers.extend_std_containers(mb)
namespaces.include_default_copy_constructors(mb)

c = mb.class_('::boost::asio::ip::address_v4')
c.include()
c.rename('IPv4')
classes.add_comparison_operators(c)
classes.expose_std_hash(c)
c.add_registration_code('def(bp::self == bp::self)')
c.include_files.append('pywrap/print_helper.hpp')
c.add_registration_code('def(pywrap::PrintNice())')
classes.add_pickle_suite(c)

for f in ['get_trace']:
    f = ns_hmf.free_function("get_trace")
    f.call_policies = call_policies.custom_call_policies(
        "::pywrap::ReturnNumpyPolicy", "pywrap/return_numpy_policy.hpp")

f = ns_hmf.free_function("get_pyoneer")
f.call_policies = call_policies.custom_call_policies(
    "bp::return_value_policy<bp::reference_existing_object>")
f.add_declaration_code('#include "pyoneer/PyOneer.h"')

#Normally included classes
for ns in included_ns:
    ns.include()
    add_numpy_construtor_to_strong_typedefs(ns)
    namespaces.extend_array_operators(ns)

    for c in ns.classes(allow_empty=True):

        c.include()