• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pybindgen.retval函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pybindgen.retval函数的典型用法代码示例。如果您正苦于以下问题:Python retval函数的具体用法?Python retval怎么用?Python retval使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了retval函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: inject_ParameterFunctional

def inject_ParameterFunctional(module, exceptions, interfaces, CONFIG_H):
    assert(isinstance(module, pybindgen.module.Module))
    assert(isinstance(exceptions, list))
    assert(isinstance(interfaces, dict))
    for element in interfaces:
        assert(isinstance(element, str))
        assert(len(element) > 0)
        assert(isinstance(CONFIG_H, dict))
    namespace = module.add_cpp_namespace('Dune').add_cpp_namespace('Pymor')
    ParameterFunctional = namespace.add_class('ParameterFunctional', parent=[interfaces['Dune::Pymor::Parametric']])
    ParameterFunctional.add_copy_constructor()
    ParameterFunctional.add_constructor([param('const Dune::Pymor::ParameterType&', 'tt'),
                                         param('const std::string', 'exp')],
                                         throw=exceptions)
    ParameterFunctional.add_method('expression', retval('const std::string'), [], is_const=True)
    ParameterFunctional.add_method('report', retval('std::string'), [], is_const=True)
    ParameterFunctional.add_method('report',
                                   retval('std::string'),
                                   [param('const std::string', 'name')],
                                   is_const=True)
    ParameterFunctional.add_method('evaluate',
                                   'double',
                                   [param('const Parameter&', 'mu')],
                                   throw=exceptions,
                                   is_const=True)
    ParameterFunctional.allow_subclassing = True
    return module, ParameterFunctional
开发者ID:ftalbrecht,项目名称:dune-pymor,代码行数:27,代码来源:functional.py


示例2: inject_Parametric

def inject_Parametric(module, exceptions, CONFIG_H):
    assert(isinstance(module, pybindgen.module.Module))
    assert(isinstance(exceptions, list))
    assert(isinstance(CONFIG_H, dict))
    namespace = module.add_cpp_namespace('Dune').add_cpp_namespace('Pymor')
    Parametric = namespace.add_class('Parametric')

    ###################################################################

    # The following code leads to segfaults of the python interpreter.
    # Not excactly sure why, but probably not needed on the python side
    # anyway.

    # Parametric.add_constructor([])
    # Parametric.add_constructor([param('Dune::Pymor::ParameterType', 'tt')])
    # Parametric.add_constructor([param('std::string', 'kk'),
    #                             param(CONFIG_H['DUNE_STUFF_SSIZE_T'], 'vv')])
    # Parametric.add_constructor([param('std::vector< std::string >', 'kk'),
    #                             param('std::vector< ' + CONFIG_H['DUNE_STUFF_SSIZE_T'] + ' >', 'vv')])
    # Parametric.add_copy_constructor()

    ###################################################################

    Parametric.add_method('parameter_type',
                          retval('const Dune::Pymor::ParameterType&'),
                          [],
                          is_const=True)
    Parametric.add_method('parametric', retval('bool'), [], is_const=True)
    # Parametric.allow_subclassing = True
    return module, Parametric
开发者ID:ftalbrecht,项目名称:dune-pymor,代码行数:30,代码来源:base.py


示例3: add_gram_schmidt

 def add_gram_schmidt(la_backend, name):
     MatrixType = 'Dune::Stuff::LA::'
     VectorType = 'Dune::Stuff::LA::'
     if 'eigen_sparse' in la_backend:
         MatrixType += 'EigenRowMajorSparseMatrix'
         VectorType += 'EigenDenseVector'
     elif 'istl_sparse' in la_backend:
         MatrixType += 'IstlRowMajorSparseMatrix'
         VectorType += 'IstlDenseVector'
     MatrixType += '< ' + RangeFieldType + ' >'
     VectorType += '< ' + RangeFieldType + ' >'
     module.add_function('gram_schmidt',
                         retval('std::vector< ' + VectorType + ' >'),
                         [param('const std::vector< ' + VectorType + ' >&', 'A'),
                          param('const bool', 'reiterate'),
                          param('const bool', 'check')],
                         throw=exceptions,
                         template_parameters=[VectorType],
                         custom_name='gram_schmidt_' + name)
     module.add_function('gram_schmidt',
                         retval('std::vector< ' + VectorType + ' >'),
                         [param('const std::vector< ' + VectorType + ' >&', 'A'),
                          param('const ' + MatrixType + '&', 'product'),
                          param('const bool', 'reiterate'),
                          param('const bool', 'check')],
                         throw=exceptions,
                         template_parameters=[VectorType, MatrixType],
                         custom_name='gram_schmidt_' + name)
开发者ID:dune-community,项目名称:dune-hdd,代码行数:28,代码来源:MRS2016__5_1_bindings_generator.py


示例4: module_gen

def module_gen(name):
    mod = Module('display')
    mod.add_include('"display.h"')
    display = mod.add_class('Display')
    display.add_constructor([param('int', 'height'),
                            param('int', 'width')])
    display.add_method('stop', None, [])
    display.add_method('getHeight', retval('int'), [])
    display.add_method('getWidth', retval('int'), [])
    display.add_method('getValue', retval('int'), 
                                  [param('int', 'row'),
                                   param('int', 'col')])
    display.add_method('setValue', None, [param('int', 'row'),
                                         param('int', 'col'),
                                         param('int', 'color')])
    display.add_method('drawRectangle', None, [param('int', 'x'),
                                            param('int', 'y'),
                                            param('int', 'width'),
                                            param('int', 'height'),
                                            param('int', 'color')])
    display.add_method('drawTriangle', None, [param('int', 'x'),
                                              param('int', 'y'),
                                              param('int', 'width'),
                                              param('int', 'height'),
                                              param('int', 'color')])
    display.add_method('clear', None, [])
    mod.add_function('loop', retval('int'), [param('Display *', 'disp', 
                                                  transfer_ownership=False)])
    mod.generate(name)
开发者ID:SArehalli,项目名称:SimpleLED,代码行数:29,代码来源:buildPythonBindings.py


示例5: reg_NfdCs

    def reg_NfdCs(root_module, cls):
        cls.add_method('size', retval('size_t'), [], is_const=True)
        cls.add_container_traits(retval('const ns3::ndn::nfd::cs::Entry&', caller_manages_return=False),
                                 begin_method='begin', end_method='end', iterator_type='const_iterator')

        def reg_Entry(cls):
            cls.add_method('getName', retval('const ns3::ndn::Name&'), [], is_const=True)
        reg_Entry(root_module['ns3::ndn::nfd::cs::Entry'])
开发者ID:cawka,项目名称:ndnSIM,代码行数:8,代码来源:modulegen__gcc_LP64.py


示例6: reg_strategychoicehelper

 def reg_strategychoicehelper(cls):
     cls.add_method('Install', retval('void'), [param('ns3::Ptr<ns3::Node>', 'node'),
                                                param('const const std::string&', 'name'),
                                                param('const const std::string&', 'strategy')], is_const=True, is_static=True)
     cls.add_method('Install', retval('void'), [param('const ns3::NodeContainer&', 'c'),
                                                param('const const std::string&', 'name'),
                                                param('const const std::string&', 'strategy')], is_const=True, is_static=True)
     cls.add_method('InstallAll', retval('void'), [param('const std::string&', 'name'),
                                                   param('const std::string&', 'strategy')], is_const=True, is_static=True)
开发者ID:cawka,项目名称:ndnSIM,代码行数:9,代码来源:modulegen__gcc_LP64.py


示例7: add_functions

def add_functions(mod):
    mod.add_function('iks_make_session',
                     retval('iks*', caller_owns_return=True),
                     [], custom_name='make_session')

    mod.add_function('iks_make_pres',
                     retval('iks*', caller_owns_return=True),
                     [param('int', 'show'),
                      param('const char *', 'status')],
                     custom_name='make_pres')
开发者ID:clarete,项目名称:python-taningia,代码行数:10,代码来源:iksbind.py


示例8: inject_VectorBasedImplementation

def inject_VectorBasedImplementation(module, exceptions, interfaces, CONFIG_H, Traits, template_parameters=None):
    assert isinstance(module, pybindgen.module.Module)
    assert isinstance(exceptions, list)
    assert isinstance(interfaces, dict)
    for element in interfaces:
        assert isinstance(element, str)
        assert len(element) > 0
    assert isinstance(CONFIG_H, dict)
    assert isinstance(Traits, dict)
    for key in Traits.keys():
        assert isinstance(Traits[key], str)
        assert len(Traits[key].strip()) > 0
    assert "SourceType" in Traits
    SourceType = Traits["SourceType"]
    assert "ScalarType" in Traits
    ScalarType = Traits["ScalarType"]
    assert "ContainerType" in Traits
    ContainerType = Traits["ContainerType"]
    if template_parameters is not None:
        if isinstance(template_parameters, str):
            assert len(template_parameters.strip()) > 0
            template_parameters = [template_parameters]
        elif isinstance(template_parameters, list):
            for element in template_parameters:
                assert isinstance(element, str)
                assert len(element.strip()) > 0
    module = module.add_cpp_namespace("Dune").add_cpp_namespace("Pymor").add_cpp_namespace("Functionals")
    Class = module.add_class(
        "VectorBased",
        parent=[interfaces["Dune::Pymor::Tags::FunctionalInterface"], interfaces["Dune::Pymor::Parametric"]],
        template_parameters=template_parameters,
    )
    Class.add_method("type_this", retval("std::string"), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method("type_source", retval("std::string"), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method("type_scalar", retval("std::string"), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method("type_frozen", retval("std::string"), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method("linear", retval("bool"), [], is_const=True)
    Class.add_method("dim_source", retval(CONFIG_H["DUNE_STUFF_SSIZE_T"]), [], is_const=True)
    Class.add_method(
        "apply", retval(ScalarType), [param("const " + SourceType + " &", "source")], is_const=True, throw=exceptions
    )
    Class.add_method(
        "apply",
        retval(ScalarType),
        [param("const " + SourceType + " &", "source"), param("const Dune::Pymor::Parameter", "mu")],
        is_const=True,
        throw=exceptions,
    )
    Class.add_method(
        "as_vector_and_return_ptr",
        retval(ContainerType + " *", caller_owns_return=True),
        [],
        is_const=True,
        throw=exceptions,
        custom_name="as_vector",
    )
    return Class
开发者ID:ftalbrecht,项目名称:dune-pymor,代码行数:57,代码来源:functionals.py


示例9: inject_Parameter

def inject_Parameter(module, exceptions, CONFIG_H):
    assert(isinstance(module, pybindgen.module.Module))
    assert(isinstance(exceptions, list))
    assert(isinstance(CONFIG_H, dict))
    namespace = module.add_cpp_namespace('Dune').add_cpp_namespace('Pymor')
    Parameter = namespace.add_class('Parameter')
    Parameter.add_constructor([])
    Parameter.add_constructor([param('std::string', 'kk'),
                               param('double', 'vv')])
    Parameter.add_constructor([param('Dune::Pymor::ParameterType', 'tt'),
                               param('double', 'vv')],
                              throw=exceptions)
    Parameter.add_constructor([param('std::string', 'kk'),
                               param('std::vector< double >', 'vv')],
                              throw=exceptions)
    Parameter.add_constructor([param('Dune::Pymor::ParameterType', 'tt'),
                               param('std::vector< double >', 'vv')],
                              throw=exceptions)
    Parameter.add_constructor([param('std::vector< std::string >', 'kk'),
                               param('std::vector< std::vector< double > >', 'vv')],
                              throw=exceptions)
    Parameter.add_constructor([param('Dune::Pymor::ParameterType', 'tt'),
                               param('std::vector< std::vector< double > >', 'vv')],
                              throw=exceptions)
    Parameter.add_method('type', retval('Dune::Pymor::ParameterType'), [], is_const=True)
    Parameter.add_method('empty', retval('bool'), [], is_const=True)
    Parameter.add_method('keys',
                         retval('std::vector< std::string >'),
                         [],
                         is_const=True)
    Parameter.add_method('values',
                         retval('std::vector< std::vector< double > >'),
                         [],
                         is_const=True)
    Parameter.add_method('hasKey',
                         retval('bool'),
                         [param('std::string', 'key')],
                         is_const=True)
    Parameter.add_method('set',
                         None,
                         [param('std::string', 'key'),
                          param('std::vector< double >', 'value')],
                         throw=exceptions)
    Parameter.add_method('get',
                         retval('std::vector< double >'),
                         [param('std::string', 'key')],
                         is_const=True,
                         throw=exceptions)
    Parameter.add_binary_comparison_operator('==')
    Parameter.add_binary_comparison_operator('!=')
    Parameter.add_method('size', retval(CONFIG_H['DUNE_STUFF_SSIZE_T']), [], is_const=True)
    Parameter.add_method('report', retval('std::string'), [], is_const=True)
    Parameter.add_method('report_for_filename', retval('std::string'), [], is_const=True)
    Parameter.allow_subclassing = True
    return module, Parameter
开发者ID:ftalbrecht,项目名称:dune-pymor,代码行数:55,代码来源:base.py


示例10: inject_VectorBasedImplementation

def inject_VectorBasedImplementation(module, exceptions, interfaces, CONFIG_H, Traits, template_parameters=None):
    assert(isinstance(module, pybindgen.module.Module))
    assert(isinstance(exceptions, list))
    assert(isinstance(interfaces, dict))
    for element in interfaces:
        assert(isinstance(element, str))
        assert(len(element) > 0)
    assert(isinstance(CONFIG_H, dict))
    assert(isinstance(Traits, dict))
    for key in Traits.keys():
        assert(isinstance(Traits[key], str))
        assert(len(Traits[key].strip()) > 0)
    assert('SourceType' in Traits)
    SourceType = Traits['SourceType']
    assert('ScalarType' in Traits)
    ScalarType = Traits['ScalarType']
    assert('ContainerType' in Traits)
    ContainerType = Traits['ContainerType']
    if template_parameters is not None:
        if isinstance(template_parameters, str):
            assert(len(template_parameters.strip()) > 0)
            template_parameters = [ template_parameters ]
        elif isinstance(template_parameters, list):
            for element in template_parameters:
                assert(isinstance(element, str))
                assert(len(element.strip()) > 0)
    module = module.add_cpp_namespace('Dune').add_cpp_namespace('Pymor').add_cpp_namespace('Functionals')
    Class = module.add_class('VectorBased',
                             parent=[interfaces['Dune::Pymor::Tags::FunctionalInterface'],
                                     interfaces['Dune::Pymor::Parametric']],
                             template_parameters=template_parameters)
    Class.add_method('type_this', retval('std::string'), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method('type_source', retval('std::string'), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method('type_scalar', retval('std::string'), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method('type_frozen', retval('std::string'), [], is_const=True, is_static=True, throw=exceptions)
    Class.add_method('linear', retval('bool'), [], is_const=True)
    Class.add_method('dim_source', retval(CONFIG_H['DUNE_STUFF_SSIZE_T']), [], is_const=True)
    Class.add_method('apply',
                     retval(ScalarType),
                     [param('const ' + SourceType + ' &', 'source')],
                     is_const=True,
                     throw=exceptions)
    Class.add_method('apply',
                     retval(ScalarType),
                     [param('const ' + SourceType + ' &', 'source'),
                      param('const Dune::Pymor::Parameter', 'mu')],
                     is_const=True,
                     throw=exceptions)
    Class.add_method('as_vector_and_return_ptr',
                     retval(ContainerType + ' *', caller_owns_return=True),
                     [],
                     is_const=True,
                     throw=exceptions,
                     custom_name='as_vector')
    return Class
开发者ID:pymor,项目名称:dune-pymor,代码行数:55,代码来源:functionals.py


示例11: reg_Name

    def reg_Name(root_module, cls):
        cls.add_output_stream_operator()
        for op in ['==', '!=', '<', '<=', '>', '>=']:
            cls.add_binary_comparison_operator(op)
        cls.add_container_traits(retval('const ns3::ndn::name::Component&'),
                                 begin_method='begin', end_method='end', iterator_type='const_iterator')

        cls.add_constructor([])
        cls.add_constructor([param('const ns3::ndn::Name&', 'other')])
        cls.add_constructor([param('const std::string&', 'url')])
        cls.add_method('append', 'ns3::ndn::Name &', [param('const ns3::ndn::name::Component&', 'comp')])
        cls.add_method('get', 'const ns3::ndn::name::Component&', [param('int', 'index')], is_const=True)
        cls.add_method('getPrefix', 'ns3::ndn::Name', [param('size_t', 'len')], is_const=True)
        cls.add_method('size', 'size_t', [], is_const=True)
        cls.add_method('toUri', retval('std::string'), [], is_const=True)
开发者ID:cawka,项目名称:ndnSIM,代码行数:15,代码来源:modulegen__gcc_LP64.py


示例12: register_Ns3GlobalRouter_methods

def register_Ns3GlobalRouter_methods(root_module, cls):
    ## global-router-interface.h: static ns3::TypeId ns3::GlobalRouter::GetTypeId() [member function]
    cls.add_method("GetTypeId", "ns3::TypeId", [], is_static=True)
    ## global-router-interface.h: ns3::GlobalRouter::GlobalRouter() [constructor]
    cls.add_constructor([])
    ## global-router-interface.h: void ns3::GlobalRouter::SetRoutingProtocol(ns3::Ptr<ns3::Ipv4GlobalRouting> routing) [member function]
    cls.add_method("SetRoutingProtocol", "void", [param("ns3::Ptr< ns3::Ipv4GlobalRouting >", "routing")])
    ## global-router-interface.h: ns3::Ptr<ns3::Ipv4GlobalRouting> ns3::GlobalRouter::GetRoutingProtocol() [member function]
    cls.add_method("GetRoutingProtocol", "ns3::Ptr< ns3::Ipv4GlobalRouting >", [])
    ## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
    cls.add_method("GetRouterId", "ns3::Ipv4Address", [], is_const=True)
    ## global-router-interface.h: uint32_t ns3::GlobalRouter::DiscoverLSAs() [member function]
    cls.add_method("DiscoverLSAs", "uint32_t", [])
    ## global-router-interface.h: uint32_t ns3::GlobalRouter::GetNumLSAs() const [member function]
    cls.add_method("GetNumLSAs", "uint32_t", [], is_const=True)
    ## global-router-interface.h: bool ns3::GlobalRouter::GetLSA(uint32_t n, ns3::GlobalRoutingLSA & lsa) const [member function]
    cls.add_method("GetLSA", "bool", [param("uint32_t", "n"), param("ns3::GlobalRoutingLSA &", "lsa")], is_const=True)
    ## global-router-interface.h: void ns3::GlobalRouter::InjectRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
    cls.add_method("InjectRoute", "void", [param("ns3::Ipv4Address", "network"), param("ns3::Ipv4Mask", "networkMask")])
    ## global-router-interface.h: uint32_t ns3::GlobalRouter::GetNInjectedRoutes() [member function]
    cls.add_method("GetNInjectedRoutes", "uint32_t", [])
    ## global-router-interface.h: ns3::Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute(uint32_t i) [member function]
    cls.add_method(
        "GetInjectedRoute", retval("ns3::Ipv4RoutingTableEntry *", caller_owns_return=False), [param("uint32_t", "i")]
    )
    ## global-router-interface.h: void ns3::GlobalRouter::RemoveInjectedRoute(uint32_t i) [member function]
    cls.add_method("RemoveInjectedRoute", "void", [param("uint32_t", "i")])
    ## global-router-interface.h: bool ns3::GlobalRouter::WithdrawRoute(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask) [member function]
    cls.add_method(
        "WithdrawRoute", "bool", [param("ns3::Ipv4Address", "network"), param("ns3::Ipv4Mask", "networkMask")]
    )
    ## global-router-interface.h: void ns3::GlobalRouter::DoDispose() [member function]
    cls.add_method("DoDispose", "void", [], visibility="private", is_virtual=True)
    return
开发者ID:csgrad,项目名称:ns-3-9-ngwmn-2011,代码行数:34,代码来源:ns3_module_global_routing.py


示例13: register_Ns3Ipv4DceRoutingHelper_methods

def register_Ns3Ipv4DceRoutingHelper_methods(root_module, cls):
    ## ipv4-dce-routing-helper.h: ns3::Ipv4DceRoutingHelper::Ipv4DceRoutingHelper() [constructor]
    cls.add_constructor([])
    ## ipv4-dce-routing-helper.h: ns3::Ipv4DceRoutingHelper::Ipv4DceRoutingHelper(ns3::Ipv4DceRoutingHelper const & arg0) [copy constructor]
    cls.add_constructor([param('ns3::Ipv4DceRoutingHelper const &', 'arg0')])
    ## ipv4-dce-routing-helper.h: ns3::Ipv4DceRoutingHelper * ns3::Ipv4DceRoutingHelper::Copy() const [member function]
    cls.add_method('Copy', 
                   retval('ns3::Ipv4DceRoutingHelper *', caller_owns_return=False),
                   [], 
                   is_const=True)
    ## ipv4-dce-routing-helper.h: ns3::Ptr<ns3::Ipv4RoutingProtocol> ns3::Ipv4DceRoutingHelper::Create(ns3::Ptr<ns3::Node> node) const [member function]
    cls.add_method('Create', 
                   retval('ns3::Ptr<ns3::Ipv4RoutingProtocol >', caller_owns_return=False),
                   [param('ns3::Node *', 'node', transfer_ownership=False)], 
                   is_const=True, is_virtual=True)
    return
开发者ID:jaredivey,项目名称:ns-3-dce,代码行数:16,代码来源:ns3_module_dce.py


示例14: inject_Example

def inject_Example(module, exceptions, interfaces, CONFIG_H):
    '''injects the user code into the module'''
    # first the discretization
    GridType = 'Dune::SGrid< 2, 2 >'
    GridLayerType = 'Dune::Stuff::Grid::ChooseLayer::leaf'
    RangeFieldType = 'double'
    dimRange = '1'
    polOrder = '1'
    SpaceBackendType = 'Dune::GDT::ChooseSpaceBackend::pdelab'
    LaBackendType = 'Dune::Stuff::LA::ChooseBackend::istl_sparse'
    if 'istl_sparse' in LaBackendType:
        MatrixType = 'Dune::Stuff::LA::IstlRowMajorSparseMatrix< ' + RangeFieldType + ' >'
        VectorType = 'Dune::Stuff::LA::IstlDenseVector< ' + RangeFieldType + ' >'
    elif 'eigen_sparse' in LaBackendType:
        MatrixType = 'Dune::Stuff::LA::EigenRowMajorSparseMatrix< ' + RangeFieldType + ' >'
        VectorType = 'Dune::Stuff::LA::EigenDenseVector< ' + RangeFieldType + ' >'
    DiscretizationName = 'Dune::HDD::LinearElliptic::Discretizations::CG'
    DiscretizationFullName = (DiscretizationName + '< '
                              + GridType + ', ' + GridLayerType + ', '
                              + RangeFieldType + ', ' + dimRange + ', ' + polOrder + ', '
                              + SpaceBackendType + ', '
                              + LaBackendType + ' >')
    discretization = inject_StationaryDiscretizationImplementation(
        module, exceptions, interfaces, CONFIG_H,
        DiscretizationName,
        Traits={'VectorType': VectorType,
                'OperatorType': 'Dune::Pymor::Operators::LinearAffinelyDecomposedContainerBased< ' + MatrixType + ', ' + VectorType + ' >',
                'FunctionalType': 'Dune::Pymor::Functionals::LinearAffinelyDecomposedVectorBased< ' + VectorType + ' >',
                'ProductType': 'Dune::Pymor::Operators::LinearAffinelyDecomposedContainerBased< ' + MatrixType + ', ' + VectorType + ' > '},
        template_parameters=[GridType, GridLayerType, RangeFieldType, dimRange, polOrder, SpaceBackendType, LaBackendType ])
    # then add the example
    LinearellipticExampleCG = module.add_class('LinearellipticExampleCG',
                                               template_parameters=['Dune::SGrid< 2, 2 >'],
                                               custom_name='LinearellipticExampleCG')
    LinearellipticExampleCG.add_method('static_id',
                                       retval('std::string'),
                                       [], is_const=True, throw=[exceptions['Exception']])
    LinearellipticExampleCG.add_method('write_config_file',
                                       None, [], is_const=True, throw=[exceptions['Exception']])
    LinearellipticExampleCG.add_constructor([], throw=[exceptions['Exception']])
    LinearellipticExampleCG.add_method('initialize', None,
                                       [param('const std::vector< std::string >', 'arguments')],
                                       is_const=True, throw=[exceptions['Exception']])
    LinearellipticExampleCG.add_method('discretization_and_return_ptr',
                                       retval(DiscretizationFullName + ' *', caller_owns_return=True),
                                       [], is_const=True, throw=[exceptions['Exception']],
                                       custom_name='discretization')
开发者ID:tobiasleibner,项目名称:dune-hdd,代码行数:47,代码来源:cg_bindings_generator.py


示例15: my_module_gen

def my_module_gen(out_file):

    mod = Module('bar')

    mod.add_include ('"bar.h"')

    Foo = mod.add_class('Foo', automatic_type_narrowing=True,
                        memory_policy=BoostSharedPtr('::Foo'))

    Foo.add_static_attribute('instance_count', ReturnValue.new('int'))
    Foo.add_constructor([Parameter.new('std::string', 'datum')])
    Foo.add_constructor([])
    Foo.add_method('get_datum', ReturnValue.new('const std::string'), [])
    Foo.add_method('is_initialized', ReturnValue.new('bool'), [], is_const=True)
    Foo.add_output_stream_operator()


    mod.add_function('function_that_takes_foo', ReturnValue.new('void'),
                               [param('boost::shared_ptr<Foo>', 'foo')])
    mod.add_function('function_that_returns_foo', retval('boost::shared_ptr<Foo>'), [])
    
    cls = mod.add_class('ClassThatTakesFoo', allow_subclassing=True)
    cls.add_constructor([Parameter.new('boost::shared_ptr<Foo>', 'foo')])
    cls.add_method('get_foo', ReturnValue.new('boost::shared_ptr<Foo>'), [])
    cls.add_method('get_modified_foo', retval('boost::shared_ptr<Foo>'),
                   [param('boost::shared_ptr<Foo>', 'foo')],
                   is_virtual=True, is_const=True)


    
    #### --- error handler ---
    class MyErrorHandler(pybindgen.settings.ErrorHandler):
        def __init__(self):
            super(MyErrorHandler, self).__init__()
            self.num_errors = 0
        def handle_error(self, wrapper, exception, traceback_):
            print("exception %s in wrapper %s" % (exception, wrapper), file=sys.stderr)
            self.num_errors += 1
            if 0: # verbose?
                import traceback
                traceback.print_tb(traceback_)
            return True
    pybindgen.settings.error_handler = MyErrorHandler()

    ## ---- finally, generate the whole thing ----
    mod.generate(FileCodeSink(out_file))
开发者ID:AaronTien,项目名称:pybindgen,代码行数:46,代码来源:barmodulegen.py


示例16: reg_NfdFib

    def reg_NfdFib(root_module, cls):
        cls.add_method('size', retval('size_t'), [], is_const=True)
        cls.add_container_traits(retval('const ns3::ndn::nfd::fib::Entry&', caller_manages_return=False),
                                 begin_method='begin', end_method='end', iterator_type='const_iterator')

        # The following is not supported
        # cls.add_method('findLongestPrefixMatch', retval('std::shared_ptr<ns3::ndn::nfd::fib::Entry>'),
        #                [param('const ns3::ndn::Name&', 'prefix')], is_const=True)
        # cls.add_method('findExactMatch', retval('std::shared_ptr<ns3::ndn::nfd::fib::Entry>'),
        #                [param('const ns3::ndn::Name&', 'prefix')], is_const=True)
        # cls.add_method('findLongestPrefixMatch', retval('shared_ptr<ns3::ndn::nfd::fib::Entry>'),
        #                [param('const pit::Entry&', 'pitEntry')], is_const=True)
        # cls.add_method('findLongestPrefixMatch', retval('shared_ptr<ns3::ndn::nfd::fib::Entry>'),
        #                [param('const measurements::Entry&', 'measurementsEntry')], is_const=True)

        # cls.add_method('insert', retval('std::pair<std::shared_ptr<ns3::ndn::nfd::fib::Entry>, bool>'), [param('const ns3::ndn::Name&', 'prefix')])
        cls.add_method('erase', retval('void'), [param('const ns3::ndn::Name&', 'prefix')])
        cls.add_method('erase', retval('void'), [param('const ns3::ndn::nfd::fib::Entry&', 'entry')])
        # cls.add_method('removeNextHopFromAllEntries', retval('void'), [param('std::shared_ptr<ns3::ndn::Face>', 'face')])

        def reg_Entry(cls):
            cls.add_method('getPrefix', 'const ns3::ndn::Name&', [], is_const=True)
            cls.add_method('getNextHops', retval('const ns3::ndn::nfd::fib::NextHopList&', caller_manages_return=False), [], is_const=True)
            cls.add_method('hasNextHops', 'bool', [], is_const=True)
        reg_Entry(root_module['ns3::ndn::nfd::fib::Entry'])

        def reg_NextHop(cls):
            cls.add_constructor([param('const ns3::ndn::Face&', 'face'), param('uint64_t', 'endpointId')])

            cls.add_function_as_method('getFaceFromFibNextHop', 'std::shared_ptr<ns3::ndn::Face>',
                                       [param('const ns3::ndn::nfd::fib::NextHop&', 'obj')],
                                       custom_name='getFace')
            cls.add_method('setCost', 'void', [param('uint64_t', 'cost')])
            cls.add_method('getCost', 'uint64_t', [], is_const=True)
        reg_NextHop(root_module['ns3::ndn::nfd::fib::NextHop'])

        def reg_NextHopList(cls):
            cls.add_method('size', retval('size_t'), [], is_const=True)
            cls.add_container_traits(retval('const ns3::ndn::nfd::fib::NextHop&', caller_manages_return=False),
                                     begin_method='begin', end_method='end', iterator_type='const_iterator')
        reg_NextHopList(root_module['ns3::ndn::nfd::fib::NextHopList'])
开发者ID:cawka,项目名称:ndnSIM,代码行数:41,代码来源:modulegen__gcc_LP64.py


示例17: my_module_gen

def my_module_gen(out_file):

    mod = Module('bsp')

    mod.add_include ('"bsp.h"')

    Foo = mod.add_class('Foo', memory_policy=BoostSharedPtr('::Foo'))

    Foo.add_constructor([param('std::string', 'datum')])
    Foo.add_constructor([])
    Foo.add_method('get_datum', retval('const std::string'), [])
    Foo.add_method('set_datum', None, [param('const std::string', 'datum')])


    mod.add_function('function_that_takes_foo', None,
                     [param('boost::shared_ptr<Foo>', 'foo')])

    mod.add_function('function_that_returns_foo', retval('boost::shared_ptr<Foo>'), [])
    
    ## ---- finally, generate the whole thing ----
    mod.generate(FileCodeSink(out_file))
开发者ID:AaronTien,项目名称:pybindgen,代码行数:21,代码来源:modulegen.py


示例18: reg_stackhelper

    def reg_stackhelper(cls):
        cls.add_constructor([])

        cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('ns3::Ptr<ns3::Node>', 'node')], is_const=True)
        cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('std::string const&', 'nodeName')], is_const=True)
        cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('const ns3::NodeContainer&', 'c')], is_const=True)
        cls.add_method('InstallAll', 'ns3::Ptr<ns3::ndn::FaceContainer>', [], is_const=True)

        cls.add_method('SetDefaultRoutes', retval('void'), [param('bool', 'isEnabled', default_value='true')], is_const=True)
        cls.add_method('SetStackAttributes',
                       retval('void'),
                       [param('const std::string&', 'attr1', default_value='""'), param('const std::string&', 'value1', default_value='""'),
                        param('const std::string&', 'attr2', default_value='""'), param('const std::string&', 'value2', default_value='""'),
                        param('const std::string&', 'attr3', default_value='""'), param('const std::string&', 'value3', default_value='""'),
                        param('const std::string&', 'attr4', default_value='""'), param('const std::string&', 'value4', default_value='""')])

        cls.add_method('setCsSize', retval('void'), [param('size_t', 'maxSize')])
        cls.add_method('SetOldContentStore',
                       retval('void'),
                       [param('const std::string&', 'contentStoreClass'),
                        param('const std::string&', 'attr1', default_value='""'), param('const std::string&', 'value1', default_value='""'),
                        param('const std::string&', 'attr2', default_value='""'), param('const std::string&', 'value2', default_value='""'),
                        param('const std::string&', 'attr3', default_value='""'), param('const std::string&', 'value3', default_value='""'),
                        param('const std::string&', 'attr4', default_value='""'), param('const std::string&', 'value4', default_value='""')])
开发者ID:NDN-Routing,项目名称:ndnSIM,代码行数:24,代码来源:modulegen__gcc_LP64.py


示例19: reg_fibhelper

 def reg_fibhelper(cls):
     cls.add_method('AddRoute', retval('void'), [
         param('const std::string&', 'nodeName'), param('const std::string&', 'prefix'),
         param('uint32_t', 'faceId'), param('int32_t', 'metric'),
         ], is_const=True, is_static=True)
     cls.add_method('AddRoute', retval('void'), [
         param('ns3::Ptr<ns3::Node>', 'node'), param('const ns3::ndn::Name&', 'prefix'),
         param('uint32_t', 'faceId'), param('int32_t', 'metric')
         ], is_const=True, is_static=True)
     cls.add_method('AddRoute', retval('void'), [
         param('ns3::Ptr<ns3::Node>', 'node'), param('const ns3::ndn::Name&', 'prefix'),
         param('std::shared_ptr<ns3::ndn::Face>', 'face'),
         param('int32_t', 'metric'),
         ], is_const=True, is_static=True)
     cls.add_method('AddRoute', retval('void'), [
         param('ns3::Ptr<ns3::Node>', 'node'), param('const ns3::ndn::Name&', 'prefix'),
         param('ns3::Ptr<ns3::Node>', 'otherNode'),
         param('int32_t', 'metric'),
         ], is_const=True, is_static=True)
     cls.add_method('AddRoute', retval('void'), [
         param('const std::string&', 'nodeName'), param('const std::string&', 'prefix'),
         param('const std::string&', 'otherNodeName'),
         param('int32_t', 'metric'),
         ], is_const=True, is_static=True)
开发者ID:cawka,项目名称:ndnSIM,代码行数:24,代码来源:modulegen__gcc_LP64.py


示例20: load_module

def load_module(module, parent):
    print "Processing module `%s'" % module['name']
    mod = SubModule(module['name'], parent)

    for enum in module['enums']:
        print " - enum `%s'" % enum['name']
        mod.add_enum(enum['name'], enum['entries'])

    overrided = []

    for func in module['functions']:
        name = func['name']['name']
        custom_name = name.replace('ta_%s_' % mod.name, '')
        func['name']['pyname'] = custom_name

        # Adding method to a different list. This list holds methods
        # that are not generated by pybindgen.
        get_overrided = OVERRIDES.get(name)

        if get_overrided == '':
            # this empty string means that we have overrided the
            # method aiming to do not generate it
            continue
        elif get_overrided:
            # This means that a valid override was found.
            func['override'] = get_overrided
            overrided.append(func)
            continue

        try:
            mod.add_function(name,
                             retval(func['rtype'], call 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pybitcoin.make_pay_to_address_script函数代码示例发布时间:2022-05-25
下一篇:
Python pybindgen.param函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap