本文整理汇总了Python中pybindgen.FileCodeSink方法的典型用法代码示例。如果您正苦于以下问题:Python pybindgen.FileCodeSink方法的具体用法?Python pybindgen.FileCodeSink怎么用?Python pybindgen.FileCodeSink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybindgen
的用法示例。
在下文中一共展示了pybindgen.FileCodeSink方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: my_module_gen
# 需要导入模块: import pybindgen [as 别名]
# 或者: from pybindgen import FileCodeSink [as 别名]
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))
示例2: my_module_gen
# 需要导入模块: import pybindgen [as 别名]
# 或者: from pybindgen import FileCodeSink [as 别名]
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))
示例3: __init__
# 需要导入模块: import pybindgen [as 别名]
# 或者: from pybindgen import FileCodeSink [as 别名]
def __init__(self, main_file_name):
super(MyMultiSectionFactory, self).__init__()
self.main_file_name = main_file_name
self.main_sink = FileCodeSink(open(main_file_name, "wt"))
self.header_name = "ns3module.h"
header_file_name = os.path.join(os.path.dirname(self.main_file_name), self.header_name)
#print >> sys.stderr, ">>>>>>>>>>>>>>>>>", header_file_name, main_file_name
self.header_sink = FileCodeSink(open(header_file_name, "wt"))
示例4: __init__
# 需要导入模块: import pybindgen [as 别名]
# 或者: from pybindgen import FileCodeSink [as 别名]
def __init__(self, main_file_name, modules):
super(MyMultiSectionFactory, self).__init__()
self.main_file_name = main_file_name
self.main_sink = FileCodeSink(open(main_file_name, "wt"))
self.header_name = "ns3module.h"
header_file_name = os.path.join(os.path.dirname(self.main_file_name), 'pch', self.header_name)
self.header_sink = FileCodeSink(open(header_file_name, "wt"))
self.section_sinks = {'__main__': self.main_sink}
for module in modules:
section_name = 'ns3_module_%s' % module.replace('-', '_')
file_name = os.path.join(os.path.dirname(self.main_file_name), "%s.cc" % section_name)
sink = FileCodeSink(open(file_name, "wt"))
self.section_sinks[section_name] = sink
示例5: main
# 需要导入模块: import pybindgen [as 别名]
# 或者: from pybindgen import FileCodeSink [as 别名]
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)