Debian Codegraph @

examples/import_from_module/bmodulegen.py

raw symbols SCIP
1 #! /usr/bin/env python
2
3 import sys
4
5 import pybindgen
6 from pybindgen import ReturnValue, Parameter, Module, Function, FileCodeSink
7 from pybindgen import CppMethod, CppConstructor, CppClass, Enum
8
9
10 def my_module_gen(out_file):
11 mod = Module('b')
12 mod.add_include('"b.h"')
13
14 # Base
15 Base = mod.add_class("Base", allow_subclassing = True, import_from_module='a')
16 Base.add_constructor([])
17 Base.add_method("do_something", None, [], is_virtual=True)
18
19 # Derived
20 Derived = mod.add_class("Derived", allow_subclassing=True, parent=Base)
21 Derived.add_constructor([])
22 Derived.add_method("do_something", None, [], is_virtual=True)
23
24 mod.generate(FileCodeSink(out_file) )
25
26 if __name__ == '__main__':
27 my_module_gen(sys.stdout)