Python: re-scan API; unblock python threads during Simulator::Run; new pybindgen brings improved thread safety for virtual methods.

This commit is contained in:
Gustavo J. A. M. Carneiro
2008-08-05 19:42:53 +01:00
parent 13bdfdf131
commit 2d872a846d
5 changed files with 58 additions and 10 deletions

View File

@@ -13,8 +13,8 @@ def register_types(module):
module.add_class('CsmaChannel', parent=root_module['ns3::Channel'])
## csma-net-device.h: ns3::CsmaNetDevice [class]
module.add_class('CsmaNetDevice', parent=root_module['ns3::NetDevice'])
## csma-net-device.h: ns3::CsmaNetDevice::CsmaEncapsulationMode [enumeration]
module.add_enum('CsmaEncapsulationMode', ['ETHERNET_V1', 'IP_ARP', 'RAW', 'LLC'], outer_class=root_module['ns3::CsmaNetDevice'])
## csma-net-device.h: ns3::CsmaNetDevice::EncapsulationMode [enumeration]
module.add_enum('EncapsulationMode', ['ETHERNET_V1', 'IP_ARP', 'RAW', 'LLC'], outer_class=root_module['ns3::CsmaNetDevice'])
## Register a nested module for the namespace internal
@@ -250,6 +250,32 @@ def register_Ns3CsmaNetDevice_methods(root_module, cls):
cls.add_method('SetAddress',
'void',
[param('ns3::Mac48Address', 'addr')])
## csma-net-device.h: void ns3::CsmaNetDevice::SetMaxPayloadLength(uint16_t maxPayloadLength) [member function]
cls.add_method('SetMaxPayloadLength',
'void',
[param('uint16_t', 'maxPayloadLength')])
## csma-net-device.h: uint16_t ns3::CsmaNetDevice::GetMaxPayloadLength() const [member function]
cls.add_method('GetMaxPayloadLength',
'uint16_t',
[],
is_const=True)
## csma-net-device.h: void ns3::CsmaNetDevice::SetMacMtu(uint16_t mtu) [member function]
cls.add_method('SetMacMtu',
'void',
[param('uint16_t', 'mtu')])
## csma-net-device.h: uint16_t ns3::CsmaNetDevice::GetMacMtu() const [member function]
cls.add_method('GetMacMtu',
'uint16_t',
[],
is_const=True)
## csma-net-device.h: void ns3::CsmaNetDevice::SetEncapsulationMode(ns3::CsmaNetDevice::EncapsulationMode mode) [member function]
cls.add_method('SetEncapsulationMode',
'void',
[param('ns3::CsmaNetDevice::EncapsulationMode', 'mode')])
## csma-net-device.h: ns3::CsmaNetDevice::EncapsulationMode ns3::CsmaNetDevice::GetEncapsulationMode() [member function]
cls.add_method('GetEncapsulationMode',
'ns3::CsmaNetDevice::EncapsulationMode',
[])
## csma-net-device.h: void ns3::CsmaNetDevice::SetName(std::string const name) [member function]
cls.add_method('SetName',
'void',
@@ -275,11 +301,6 @@ def register_Ns3CsmaNetDevice_methods(root_module, cls):
'ns3::Ptr< ns3::Channel >',
[],
is_const=True, is_virtual=True)
## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## csma-net-device.h: bool ns3::CsmaNetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
@@ -290,6 +311,11 @@ def register_Ns3CsmaNetDevice_methods(root_module, cls):
'uint16_t',
[],
is_const=True, is_virtual=True)
## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## csma-net-device.h: bool ns3::CsmaNetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',

View File

@@ -137,6 +137,21 @@ def register_Ns3MobilityHelper_methods(root_module, cls):
cls.add_method('InstallAll',
'void',
[])
## mobility-helper.h: static void ns3::MobilityHelper::EnableAscii(std::ostream & os, uint32_t nodeid) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::ostream&', 'os'), param('uint32_t', 'nodeid')],
is_static=True)
## mobility-helper.h: static void ns3::MobilityHelper::EnableAscii(std::ostream & os, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::ostream&', 'os'), param('ns3::NodeContainer', 'n')],
is_static=True)
## mobility-helper.h: static void ns3::MobilityHelper::EnableAsciiAll(std::ostream & os) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('std::ostream&', 'os')],
is_static=True)
return
def register_Ns3InternetStackHelper_methods(root_module, cls):

View File

@@ -346,7 +346,7 @@ def register_Ns3Simulator_methods(root_module, cls):
cls.add_method('EnableLogTo',
'void',
[param('char *', 'filename', transfer_ownership=False, is_const=True)],
is_static=True)
is_static=True, deprecated=True)
## simulator.h: static void ns3::Simulator::Destroy() [member function]
cls.add_method('Destroy',
'void',
@@ -366,7 +366,7 @@ def register_Ns3Simulator_methods(root_module, cls):
cls.add_method('Run',
'void',
[],
is_static=True)
is_static=True, unblock_threads=True)
## simulator.h: static void ns3::Simulator::Stop() [member function]
cls.add_method('Stop',
'void',

View File

@@ -148,6 +148,13 @@ def pre_scan_hook(dummy_module_parser,
and pygccxml_definition.name.startswith('Schedule'):
global_annotations['ignore'] = None
# unblock python threads for Simulator::Run
if isinstance(pygccxml_definition, member_function_t) \
and pygccxml_definition.parent.name == 'Simulator' \
and pygccxml_definition.name == 'Run':
global_annotations['unblock_threads'] = True
## classes
if isinstance(pygccxml_definition, class_t):
# no need for helper classes to allow subclassing in Python, I think...

View File

@@ -21,7 +21,7 @@ else:
os.environ['PYTHONPATH'] = LOCAL_PYBINDGEN_PATH
## https://launchpad.net/pybindgen/
REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 526)
REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 530)
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)