本文整理匯總了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)