Python pybindgen.Module() Examples

The following are 30 code examples of pybindgen.Module(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pybindgen , or try the search function .
Example #1
Source File: modulegen.py    From royal-chaos with MIT License 6 votes vote down vote up
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)) 
Example #2
Source File: modulegen.py    From royal-chaos with MIT License 6 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('h')
    mod.add_include('"h.h"')

    H = mod.add_class('H')
    H.add_constructor([])
    H.add_method('Do', None, [])

    Inner = mod.add_class('Inner', outer_class=H)
    Inner.add_constructor([])
    Inner.add_method('Do', None, [])

    MostInner = mod.add_class('MostInner', outer_class=Inner)
    MostInner.add_constructor([])
    MostInner.add_method('Do', None, [])

    mod.generate(FileCodeSink(out_file)) 
Example #3
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('e')
    mod.add_include('"e.h"')

    E = mod.add_class('E', memory_policy=cppclass.ReferenceCountingMethodsPolicy(decref_method='Unref', incref_method='Ref'))
    if 1:
        E.add_function_as_constructor("E::CreateWithRef", ReturnValue.new("E*", caller_owns_return=True), [])
    else:
        ## alternative:
        E.add_function_as_constructor("E::CreateWithoutRef", ReturnValue.new("E*", caller_owns_return=False), [])
    E.add_method("Do", None, [])


    mod.generate(FileCodeSink(out_file) ) 
Example #4
Source File: modulegen__gcc_ILP32.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.propagation', cpp_namespace='::ns3')
    return root_module 
Example #5
Source File: modulegen__gcc_LP64.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.topology_read', cpp_namespace='::ns3')
    return root_module 
Example #6
Source File: modulegen__gcc_LP64.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.virtual_net_device', cpp_namespace='::ns3')
    return root_module 
Example #7
Source File: modulegen__gcc_ILP32.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.bridge', cpp_namespace='::ns3')
    return root_module 
Example #8
Source File: modulegen__gcc_LP64.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.propagation', cpp_namespace='::ns3')
    return root_module 
Example #9
Source File: modulegen__gcc_LP64.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.antenna', cpp_namespace='::ns3')
    return root_module 
Example #10
Source File: modulegen__gcc_ILP32.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.config_store', cpp_namespace='::ns3')
    return root_module 
Example #11
Source File: modulegen__gcc_LP64.py    From ns-3-dev-git with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.config_store', cpp_namespace='::ns3')
    return root_module 
Example #12
Source File: modulegen__gcc_ILP32.py    From CRE-NS3 with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.propagation', cpp_namespace='::ns3')
    return root_module 
Example #13
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('c')
    mod.add_include('"c.h"')

    mod.add_function("GetBuffer", BufferReturn("unsigned short int*", "GetBufferLen()"), [])
    mod.add_function("GetBufferLen", ReturnValue.new("int"), [])
    mod.add_function("GetBufferChecksum", ReturnValue.new("unsigned short"), [])

    mod.generate(FileCodeSink(out_file)) 
Example #14
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('d')
    mod.add_include('"d.h"')

    D = mod.add_class('D', memory_policy=cppclass.FreeFunctionPolicy('DDestroy'))
    D.add_instance_attribute('d', ReturnValue.new('bool'))
    D.add_function_as_constructor("DCreate", ReturnValue.new("D*", caller_owns_return=True), [])
    mod.add_function('DDoA', None, [Parameter.new('D*', 'd', transfer_ownership=False)])
    mod.add_function('DDoB', None, [Parameter.new('D&', 'd', direction=Parameter.DIRECTION_IN)])
    mod.add_function('DDoC', None, [Parameter.new('const D&', 'd',
                                                  direction=Parameter.DIRECTION_IN)])


    mod.generate(FileCodeSink(out_file) ) 
Example #15
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('c')
    mod.add_include('"c.h"')

    C = mod.add_class('C')
    C.add_constructor([])
    C.add_constructor([Parameter.new('uint32_t', 'c')])
    C.add_method('DoA', None, [], is_static=True)
    C.add_method('DoB', None, [])
    C.add_method('DoC', None, [Parameter.new('uint32_t', 'c')])
    C.add_method('DoD', ReturnValue.new('uint32_t'), [])
    C.add_method('DoE', None, [], is_virtual=True)

    mod.generate(FileCodeSink(out_file) ) 
Example #16
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):
    mod = Module('f')
    mod.add_include('"f.h"')

    FBase = mod.add_class('FBase', allow_subclassing=True)
    
    FBase.add_constructor([])
    FBase.add_method('DoA', None, [], is_virtual=True, is_pure_virtual=True)
    FBase.add_method('PrivDoB', None, [], is_virtual=True, is_pure_virtual=True, visibility='private')
    FBase.add_method('DoB', None, [])

    mod.generate(FileCodeSink(out_file) ) 
Example #17
Source File: modulegen.py    From royal-chaos with MIT License 5 votes vote down vote up
def my_module_gen(out_file):

    mod = Module('b')
    mod.add_include('"b.h"')

    B = mod.add_class('B')
    B.add_constructor([])
    B.add_copy_constructor()
    B.add_instance_attribute('b_a', ReturnValue.new('uint32_t'))
    B.add_instance_attribute('b_b', ReturnValue.new('uint32_t'))

    mod.add_function('BDoA', None, [Parameter.new('B', 'b')])
    mod.add_function('BDoB', ReturnValue.new('B'), [])

    mod.generate(FileCodeSink(out_file) ) 
Example #18
Source File: modulegen__gcc_ILP32.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.antenna', cpp_namespace='::ns3')
    return root_module 
Example #19
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.antenna', cpp_namespace='::ns3')
    return root_module 
Example #20
Source File: modulegen__gcc_ILP32.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.tools', cpp_namespace='::ns3')
    return root_module 
Example #21
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.tools', cpp_namespace='::ns3')
    return root_module 
Example #22
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.mpi', cpp_namespace='::ns3')
    return root_module 
Example #23
Source File: modulegen__gcc_ILP32.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.config_store', cpp_namespace='::ns3')
    return root_module 
Example #24
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.config_store', cpp_namespace='::ns3')
    return root_module 
Example #25
Source File: modulegen__gcc_ILP32.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.virtual_net_device', cpp_namespace='::ns3')
    return root_module 
Example #26
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.virtual_net_device', cpp_namespace='::ns3')
    return root_module 
Example #27
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.topology_read', cpp_namespace='::ns3')
    return root_module 
Example #28
Source File: modulegen__gcc_ILP32.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.bridge', cpp_namespace='::ns3')
    return root_module 
Example #29
Source File: modulegen__gcc_LP64.py    From ns3-rdma with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.bridge', cpp_namespace='::ns3')
    return root_module 
Example #30
Source File: modulegen__gcc_LP64.py    From ntu-dsi-dcn with GNU General Public License v2.0 5 votes vote down vote up
def module_init():
    root_module = Module('ns.propagation', cpp_namespace='::ns3')
    return root_module