Ejemplo n.º 1
0
def add_print_operator(c):
    """
    class exclusion helper
    because operator<< is missing in most classes

    Args:
        c: class
    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)
classes.add_pickle_suite(c)

for cls in ns_coordinate.classes():
    if any(
            cls.name.startswith(pre)
            for pre in ["WaferMixin", "HICANNMixin", "MergerProxy"]):
        cls.alias = '_' + cls.alias

for ns in [ns_coordinate, ns_common, ns_detail]:
    for fun in ns.free_functions("hash_value"):
        fun.exclude()

# Try to capture the std::container dependencies
std_filter = matchers.and_matcher_t([
    matchers.declaration_matcher_t(decl_type=decl_wrappers.class_t),
    matchers.namespace_contains_matcher_t("std")
])

for ns in [ns_coordinate]:
    for decl in namespaces.get_deps(
            ns_coordinate, matchers.namespace_contains_matcher_t("std")):
        if decl.indexing_suite or decl.name.startswith("bitset"):
            decl.include()

# std::hash specialisations are only used from within the member hash functions
mb.classes(matchers.match_std_container_t("hash"), allow_empty=True).exclude()

# include base classes
for cl in mb.classes():
    if cl.ignore:
        continue
Ejemplo n.º 3
0
c.include()
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)

# HMF::Handle stuff & special handling (ECM)
for c in ns_hmf.namespace('Handle').classes(allow_empty=True):
    classes.add_context_manager(c)

# Try to capture the std::container dependcies
std_filter = matchers.and_matcher_t([
    matchers.declaration_matcher_t(decl_type=decl_wrappers.class_t),
    matchers.namespace_contains_matcher_t("std")
])

for ns in included_ns:
    for decl in namespaces.get_deps(
            ns_hmf, matchers.namespace_contains_matcher_t("std")):
        if decl.indexing_suite or decl.name.startswith("bitset"):
            decl.include()

# std::hash specialisations are only used from within the member hash functions
mb.classes(matchers.match_std_container_t("hash"), allow_empty=True).exclude()

ns_util.add_namespace(mb.namespace("std"))

ns_coordinate.exclude()