merge with HEAD
This commit is contained in:
11
bindings/python/callbacks_list.py
Normal file
11
bindings/python/callbacks_list.py
Normal file
@@ -0,0 +1,11 @@
|
||||
callback_classes = [
|
||||
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['bool', 'ns3::Ptr<ns3::Socket>', 'ns3::Address const&', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::Ptr<ns3::Packet>', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
|
||||
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType'],
|
||||
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::empty', 'ns3::empty'],
|
||||
['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType'],
|
||||
]
|
||||
13
bindings/python/my_extra_api_definitions.py
Normal file
13
bindings/python/my_extra_api_definitions.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from pybindgen import Module, FileCodeSink, write_preamble, param, retval
|
||||
|
||||
def register_types(module):
|
||||
module.add_class('MyClass')
|
||||
|
||||
def register_methods(root_module):
|
||||
MyClass = root_module['MyClass']
|
||||
MyClass.add_constructor([], visibility='public')
|
||||
MyClass.add_constructor([param('double', 's'), param('double', 'l'), param('double', 'mean')], visibility='public')
|
||||
|
||||
def register_functions(module):
|
||||
module.add_function('SomeFunction', 'int', [param('int', 'xpto')])
|
||||
|
||||
4
bindings/python/ns3/__init__.py
Normal file
4
bindings/python/ns3/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
from _ns3 import *
|
||||
|
||||
|
||||
267
bindings/python/ns3_module_bridge.py
Normal file
267
bindings/python/ns3_module_bridge.py
Normal file
@@ -0,0 +1,267 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## bridge-channel.h: ns3::BridgeChannel [class]
|
||||
module.add_class('BridgeChannel', parent=root_module['ns3::Channel'])
|
||||
## bridge-net-device.h: ns3::BridgeNetDevice [class]
|
||||
module.add_class('BridgeNetDevice', parent=root_module['ns3::NetDevice'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3BridgeChannel_methods(root_module, root_module['ns3::BridgeChannel'])
|
||||
register_Ns3BridgeNetDevice_methods(root_module, root_module['ns3::BridgeNetDevice'])
|
||||
return
|
||||
|
||||
def register_Ns3BridgeChannel_methods(root_module, cls):
|
||||
## bridge-channel.h: ns3::BridgeChannel::BridgeChannel(ns3::BridgeChannel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::BridgeChannel const &', 'arg0')])
|
||||
## bridge-channel.h: static ns3::TypeId ns3::BridgeChannel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## bridge-channel.h: ns3::BridgeChannel::BridgeChannel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## bridge-channel.h: void ns3::BridgeChannel::AddChannel(ns3::Ptr<ns3::Channel> bridgedChannel) [member function]
|
||||
cls.add_method('AddChannel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Channel >', 'bridgedChannel')])
|
||||
## bridge-channel.h: uint32_t ns3::BridgeChannel::GetNDevices() const [member function]
|
||||
cls.add_method('GetNDevices',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-channel.h: ns3::Ptr<ns3::NetDevice> ns3::BridgeChannel::GetDevice(uint32_t i) const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3BridgeNetDevice_methods(root_module, cls):
|
||||
## bridge-net-device.h: ns3::BridgeNetDevice::BridgeNetDevice(ns3::BridgeNetDevice const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::BridgeNetDevice const &', 'arg0')])
|
||||
## bridge-net-device.h: static ns3::TypeId ns3::BridgeNetDevice::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## bridge-net-device.h: ns3::BridgeNetDevice::BridgeNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::AddBridgePort(ns3::Ptr<ns3::NetDevice> bridgePort) [member function]
|
||||
cls.add_method('AddBridgePort',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'bridgePort')])
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetName(std::string const name) [member function]
|
||||
cls.add_method('SetName',
|
||||
'void',
|
||||
[param('std::string const', 'name')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: std::string ns3::BridgeNetDevice::GetName() const [member function]
|
||||
cls.add_method('GetName',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetIfIndex(uint32_t const index) [member function]
|
||||
cls.add_method('SetIfIndex',
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: uint32_t ns3::BridgeNetDevice::GetIfIndex() const [member function]
|
||||
cls.add_method('GetIfIndex',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Ptr<ns3::Channel> ns3::BridgeNetDevice::GetChannel() const [member function]
|
||||
cls.add_method('GetChannel',
|
||||
'ns3::Ptr< ns3::Channel >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
[param('uint16_t const', 'mtu')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: uint16_t ns3::BridgeNetDevice::GetMtu() const [member function]
|
||||
cls.add_method('GetMtu',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::IsLinkUp() const [member function]
|
||||
cls.add_method('IsLinkUp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::IsBroadcast() const [member function]
|
||||
cls.add_method('IsBroadcast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::GetBroadcast() const [member function]
|
||||
cls.add_method('GetBroadcast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::IsMulticast() const [member function]
|
||||
cls.add_method('IsMulticast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::GetMulticast() const [member function]
|
||||
cls.add_method('GetMulticast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Address ns3::BridgeNetDevice::MakeMulticastAddress(ns3::Ipv4Address multicastGroup) const [member function]
|
||||
cls.add_method('MakeMulticastAddress',
|
||||
'ns3::Address',
|
||||
[param('ns3::Ipv4Address', 'multicastGroup')],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::IsPointToPoint() const [member function]
|
||||
cls.add_method('IsPointToPoint',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('Send',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('SendFrom',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: ns3::Ptr<ns3::Node> ns3::BridgeNetDevice::GetNode() const [member function]
|
||||
cls.add_method('GetNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::NeedsArp() const [member function]
|
||||
cls.add_method('NeedsArp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function]
|
||||
cls.add_method('SetReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty >', 'cb')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function]
|
||||
cls.add_method('SetPromiscReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType >', 'cb')],
|
||||
is_virtual=True)
|
||||
## bridge-net-device.h: bool ns3::BridgeNetDevice::SupportsSendFrom() const [member function]
|
||||
cls.add_method('SupportsSendFrom',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::ReceiveFromDevice(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Address const & source, ns3::Address const & destination, ns3::NetDevice::PacketType packetType) [member function]
|
||||
cls.add_method('ReceiveFromDevice',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'destination'), param('ns3::NetDevice::PacketType', 'packetType')],
|
||||
visibility='protected')
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardUnicast(ns3::Ptr<ns3::NetDevice> incomingPort, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function]
|
||||
cls.add_method('ForwardUnicast',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'incomingPort'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')],
|
||||
visibility='protected')
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::ForwardBroadcast(ns3::Ptr<ns3::NetDevice> incomingPort, ns3::Ptr<const ns3::Packet> packet, uint16_t protocol, ns3::Mac48Address src, ns3::Mac48Address dst) [member function]
|
||||
cls.add_method('ForwardBroadcast',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'incomingPort'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'src'), param('ns3::Mac48Address', 'dst')],
|
||||
visibility='protected')
|
||||
## bridge-net-device.h: void ns3::BridgeNetDevice::Learn(ns3::Mac48Address source, ns3::Ptr<ns3::NetDevice> port) [member function]
|
||||
cls.add_method('Learn',
|
||||
'void',
|
||||
[param('ns3::Mac48Address', 'source'), param('ns3::Ptr< ns3::NetDevice >', 'port')],
|
||||
visibility='protected')
|
||||
## bridge-net-device.h: ns3::Ptr<ns3::NetDevice> ns3::BridgeNetDevice::GetLearnedState(ns3::Mac48Address source) [member function]
|
||||
cls.add_method('GetLearnedState',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[param('ns3::Mac48Address', 'source')],
|
||||
visibility='protected')
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
1138
bindings/python/ns3_module_common.py
Normal file
1138
bindings/python/ns3_module_common.py
Normal file
File diff suppressed because it is too large
Load Diff
260
bindings/python/ns3_module_contrib.py
Normal file
260
bindings/python/ns3_module_contrib.py
Normal file
@@ -0,0 +1,260 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## delay-jitter-estimation.h: ns3::DelayJitterEstimation [class]
|
||||
module.add_class('DelayJitterEstimation')
|
||||
## event-garbage-collector.h: ns3::EventGarbageCollector [class]
|
||||
module.add_class('EventGarbageCollector')
|
||||
## gnuplot.h: ns3::Gnuplot [class]
|
||||
module.add_class('Gnuplot')
|
||||
## gnuplot.h: ns3::GnuplotDataset [class]
|
||||
module.add_class('GnuplotDataset')
|
||||
## gnuplot.h: ns3::GnuplotDataset::Style [enumeration]
|
||||
module.add_enum('Style', ['LINES', 'POINTS', 'LINES_POINTS', 'DOTS', 'IMPULSES', 'STEPS', 'FSTEPS', 'HISTEPS'], outer_class=root_module['ns3::GnuplotDataset'])
|
||||
## gnuplot.h: ns3::GnuplotDataset::ErrorBars [enumeration]
|
||||
module.add_enum('ErrorBars', ['NONE', 'X', 'Y', 'XY'], outer_class=root_module['ns3::GnuplotDataset'])
|
||||
## gtk-config-store.h: ns3::GtkConfigStore [class]
|
||||
module.add_class('GtkConfigStore')
|
||||
## config-store.h: ns3::ConfigStore [class]
|
||||
module.add_class('ConfigStore', parent=root_module['ns3::ObjectBase'])
|
||||
## flow-id-tag.h: ns3::FlowIdTag [class]
|
||||
module.add_class('FlowIdTag', parent=root_module['ns3::Tag'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3DelayJitterEstimation_methods(root_module, root_module['ns3::DelayJitterEstimation'])
|
||||
register_Ns3EventGarbageCollector_methods(root_module, root_module['ns3::EventGarbageCollector'])
|
||||
register_Ns3Gnuplot_methods(root_module, root_module['ns3::Gnuplot'])
|
||||
register_Ns3GnuplotDataset_methods(root_module, root_module['ns3::GnuplotDataset'])
|
||||
register_Ns3GtkConfigStore_methods(root_module, root_module['ns3::GtkConfigStore'])
|
||||
register_Ns3ConfigStore_methods(root_module, root_module['ns3::ConfigStore'])
|
||||
register_Ns3FlowIdTag_methods(root_module, root_module['ns3::FlowIdTag'])
|
||||
return
|
||||
|
||||
def register_Ns3DelayJitterEstimation_methods(root_module, cls):
|
||||
## delay-jitter-estimation.h: ns3::DelayJitterEstimation::DelayJitterEstimation(ns3::DelayJitterEstimation const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::DelayJitterEstimation const &', 'arg0')])
|
||||
## delay-jitter-estimation.h: ns3::DelayJitterEstimation::DelayJitterEstimation() [constructor]
|
||||
cls.add_constructor([])
|
||||
## delay-jitter-estimation.h: static void ns3::DelayJitterEstimation::PrepareTx(ns3::Ptr<const ns3::Packet> packet) [member function]
|
||||
cls.add_method('PrepareTx',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'packet')],
|
||||
is_static=True)
|
||||
## delay-jitter-estimation.h: void ns3::DelayJitterEstimation::RecordRx(ns3::Ptr<const ns3::Packet> packet) [member function]
|
||||
cls.add_method('RecordRx',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
|
||||
## delay-jitter-estimation.h: ns3::Time ns3::DelayJitterEstimation::GetLastDelay() const [member function]
|
||||
cls.add_method('GetLastDelay',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## delay-jitter-estimation.h: ns3::Time ns3::DelayJitterEstimation::GetLastJitter() const [member function]
|
||||
cls.add_method('GetLastJitter',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3EventGarbageCollector_methods(root_module, cls):
|
||||
## event-garbage-collector.h: ns3::EventGarbageCollector::EventGarbageCollector(ns3::EventGarbageCollector const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::EventGarbageCollector const &', 'arg0')])
|
||||
## event-garbage-collector.h: ns3::EventGarbageCollector::EventGarbageCollector() [constructor]
|
||||
cls.add_constructor([])
|
||||
## event-garbage-collector.h: void ns3::EventGarbageCollector::Track(ns3::EventId event) [member function]
|
||||
cls.add_method('Track',
|
||||
'void',
|
||||
[param('ns3::EventId', 'event')])
|
||||
return
|
||||
|
||||
def register_Ns3Gnuplot_methods(root_module, cls):
|
||||
## gnuplot.h: ns3::Gnuplot::Gnuplot(ns3::Gnuplot const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Gnuplot const &', 'arg0')])
|
||||
## gnuplot.h: ns3::Gnuplot::Gnuplot(std::string pngFilename) [constructor]
|
||||
cls.add_constructor([param('std::string', 'pngFilename')])
|
||||
## gnuplot.h: void ns3::Gnuplot::SetLegend(std::string xLegend, std::string yLegend) [member function]
|
||||
cls.add_method('SetLegend',
|
||||
'void',
|
||||
[param('std::string', 'xLegend'), param('std::string', 'yLegend')])
|
||||
## gnuplot.h: void ns3::Gnuplot::AddDataset(ns3::GnuplotDataset const & dataset) [member function]
|
||||
cls.add_method('AddDataset',
|
||||
'void',
|
||||
[param('ns3::GnuplotDataset const &', 'dataset')])
|
||||
## gnuplot.h: void ns3::Gnuplot::GenerateOutput(std::ostream & os) [member function]
|
||||
cls.add_method('GenerateOutput',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')])
|
||||
return
|
||||
|
||||
def register_Ns3GnuplotDataset_methods(root_module, cls):
|
||||
## gnuplot.h: ns3::GnuplotDataset::GnuplotDataset(ns3::GnuplotDataset const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::GnuplotDataset const &', 'arg0')])
|
||||
## gnuplot.h: ns3::GnuplotDataset::GnuplotDataset() [constructor]
|
||||
cls.add_constructor([])
|
||||
## gnuplot.h: ns3::GnuplotDataset::GnuplotDataset(std::string title) [constructor]
|
||||
cls.add_constructor([param('std::string', 'title')])
|
||||
## gnuplot.h: void ns3::GnuplotDataset::SetStyle(ns3::GnuplotDataset::Style style) [member function]
|
||||
cls.add_method('SetStyle',
|
||||
'void',
|
||||
[param('ns3::GnuplotDataset::Style', 'style')])
|
||||
## gnuplot.h: void ns3::GnuplotDataset::SetErrorBars(ns3::GnuplotDataset::ErrorBars errorBars) [member function]
|
||||
cls.add_method('SetErrorBars',
|
||||
'void',
|
||||
[param('ns3::GnuplotDataset::ErrorBars', 'errorBars')])
|
||||
## gnuplot.h: void ns3::GnuplotDataset::Add(double x, double y) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('double', 'x'), param('double', 'y')])
|
||||
## gnuplot.h: void ns3::GnuplotDataset::Add(double x, double y, double errorDelta) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('double', 'x'), param('double', 'y'), param('double', 'errorDelta')])
|
||||
return
|
||||
|
||||
def register_Ns3GtkConfigStore_methods(root_module, cls):
|
||||
## gtk-config-store.h: ns3::GtkConfigStore::GtkConfigStore(ns3::GtkConfigStore const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::GtkConfigStore const &', 'arg0')])
|
||||
## gtk-config-store.h: ns3::GtkConfigStore::GtkConfigStore() [constructor]
|
||||
cls.add_constructor([])
|
||||
## gtk-config-store.h: void ns3::GtkConfigStore::Configure() [member function]
|
||||
cls.add_method('Configure',
|
||||
'void',
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3ConfigStore_methods(root_module, cls):
|
||||
## config-store.h: ns3::ConfigStore::ConfigStore(ns3::ConfigStore const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::ConfigStore const &', 'arg0')])
|
||||
## config-store.h: static ns3::TypeId ns3::ConfigStore::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## config-store.h: ns3::TypeId ns3::ConfigStore::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## config-store.h: ns3::ConfigStore::ConfigStore() [constructor]
|
||||
cls.add_constructor([])
|
||||
## config-store.h: void ns3::ConfigStore::Configure() [member function]
|
||||
cls.add_method('Configure',
|
||||
'void',
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3FlowIdTag_methods(root_module, cls):
|
||||
## flow-id-tag.h: ns3::FlowIdTag::FlowIdTag(ns3::FlowIdTag const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::FlowIdTag const &', 'arg0')])
|
||||
## flow-id-tag.h: static ns3::TypeId ns3::FlowIdTag::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## flow-id-tag.h: ns3::TypeId ns3::FlowIdTag::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## flow-id-tag.h: uint32_t ns3::FlowIdTag::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## flow-id-tag.h: void ns3::FlowIdTag::Serialize(ns3::TagBuffer buf) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::TagBuffer', 'buf')],
|
||||
is_const=True, is_virtual=True)
|
||||
## flow-id-tag.h: void ns3::FlowIdTag::Deserialize(ns3::TagBuffer buf) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'void',
|
||||
[param('ns3::TagBuffer', 'buf')],
|
||||
is_virtual=True)
|
||||
## flow-id-tag.h: void ns3::FlowIdTag::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True, is_virtual=True)
|
||||
## flow-id-tag.h: ns3::FlowIdTag::FlowIdTag() [constructor]
|
||||
cls.add_constructor([])
|
||||
## flow-id-tag.h: ns3::FlowIdTag::FlowIdTag(uint32_t flowId) [constructor]
|
||||
cls.add_constructor([param('uint32_t', 'flowId')])
|
||||
## flow-id-tag.h: void ns3::FlowIdTag::SetFlowId(uint32_t flowId) [member function]
|
||||
cls.add_method('SetFlowId',
|
||||
'void',
|
||||
[param('uint32_t', 'flowId')])
|
||||
## flow-id-tag.h: uint32_t ns3::FlowIdTag::GetFlowId() const [member function]
|
||||
cls.add_method('GetFlowId',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## flow-id-tag.h: static uint32_t ns3::FlowIdTag::AllocateFlowId() [member function]
|
||||
cls.add_method('AllocateFlowId',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
2182
bindings/python/ns3_module_core.py
Normal file
2182
bindings/python/ns3_module_core.py
Normal file
File diff suppressed because it is too large
Load Diff
437
bindings/python/ns3_module_csma.py
Normal file
437
bindings/python/ns3_module_csma.py
Normal file
@@ -0,0 +1,437 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## csma-channel.h: ns3::WireState [enumeration]
|
||||
module.add_enum('WireState', ['IDLE', 'TRANSMITTING', 'PROPAGATING'])
|
||||
## backoff.h: ns3::Backoff [class]
|
||||
module.add_class('Backoff')
|
||||
## csma-channel.h: ns3::CsmaDeviceRec [class]
|
||||
module.add_class('CsmaDeviceRec')
|
||||
## csma-channel.h: ns3::CsmaChannel [class]
|
||||
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::EncapsulationMode [enumeration]
|
||||
module.add_enum('EncapsulationMode', ['ILLEGAL', 'DIX', 'LLC'], outer_class=root_module['ns3::CsmaNetDevice'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3Backoff_methods(root_module, root_module['ns3::Backoff'])
|
||||
register_Ns3CsmaDeviceRec_methods(root_module, root_module['ns3::CsmaDeviceRec'])
|
||||
register_Ns3CsmaChannel_methods(root_module, root_module['ns3::CsmaChannel'])
|
||||
register_Ns3CsmaNetDevice_methods(root_module, root_module['ns3::CsmaNetDevice'])
|
||||
return
|
||||
|
||||
def register_Ns3Backoff_methods(root_module, cls):
|
||||
## backoff.h: ns3::Backoff::m_minSlots [variable]
|
||||
cls.add_instance_attribute('m_minSlots', 'uint32_t', is_const=False)
|
||||
## backoff.h: ns3::Backoff::m_maxSlots [variable]
|
||||
cls.add_instance_attribute('m_maxSlots', 'uint32_t', is_const=False)
|
||||
## backoff.h: ns3::Backoff::m_ceiling [variable]
|
||||
cls.add_instance_attribute('m_ceiling', 'uint32_t', is_const=False)
|
||||
## backoff.h: ns3::Backoff::m_maxRetries [variable]
|
||||
cls.add_instance_attribute('m_maxRetries', 'uint32_t', is_const=False)
|
||||
## backoff.h: ns3::Backoff::m_slotTime [variable]
|
||||
cls.add_instance_attribute('m_slotTime', 'ns3::Time', is_const=False)
|
||||
## backoff.h: ns3::Backoff::Backoff(ns3::Backoff const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Backoff const &', 'arg0')])
|
||||
## backoff.h: ns3::Backoff::Backoff() [constructor]
|
||||
cls.add_constructor([])
|
||||
## backoff.h: ns3::Backoff::Backoff(ns3::Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t ceiling, uint32_t maxRetries) [constructor]
|
||||
cls.add_constructor([param('ns3::Time', 'slotTime'), param('uint32_t', 'minSlots'), param('uint32_t', 'maxSlots'), param('uint32_t', 'ceiling'), param('uint32_t', 'maxRetries')])
|
||||
## backoff.h: ns3::Time ns3::Backoff::GetBackoffTime() [member function]
|
||||
cls.add_method('GetBackoffTime',
|
||||
'ns3::Time',
|
||||
[])
|
||||
## backoff.h: void ns3::Backoff::ResetBackoffTime() [member function]
|
||||
cls.add_method('ResetBackoffTime',
|
||||
'void',
|
||||
[])
|
||||
## backoff.h: bool ns3::Backoff::MaxRetriesReached() [member function]
|
||||
cls.add_method('MaxRetriesReached',
|
||||
'bool',
|
||||
[])
|
||||
## backoff.h: void ns3::Backoff::IncrNumRetries() [member function]
|
||||
cls.add_method('IncrNumRetries',
|
||||
'void',
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3CsmaDeviceRec_methods(root_module, cls):
|
||||
## csma-channel.h: ns3::CsmaDeviceRec::devicePtr [variable]
|
||||
cls.add_instance_attribute('devicePtr', 'ns3::Ptr< ns3::CsmaNetDevice >', is_const=False)
|
||||
## csma-channel.h: ns3::CsmaDeviceRec::active [variable]
|
||||
cls.add_instance_attribute('active', 'bool', is_const=False)
|
||||
## csma-channel.h: ns3::CsmaDeviceRec::CsmaDeviceRec(ns3::CsmaDeviceRec const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::CsmaDeviceRec const &', 'arg0')])
|
||||
## csma-channel.h: ns3::CsmaDeviceRec::CsmaDeviceRec() [constructor]
|
||||
cls.add_constructor([])
|
||||
## csma-channel.h: ns3::CsmaDeviceRec::CsmaDeviceRec(ns3::Ptr<ns3::CsmaNetDevice> device) [constructor]
|
||||
cls.add_constructor([param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
|
||||
## csma-channel.h: bool ns3::CsmaDeviceRec::IsActive() [member function]
|
||||
cls.add_method('IsActive',
|
||||
'bool',
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3CsmaChannel_methods(root_module, cls):
|
||||
## csma-channel.h: ns3::CsmaChannel::CsmaChannel(ns3::CsmaChannel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::CsmaChannel const &', 'arg0')])
|
||||
## csma-channel.h: static ns3::TypeId ns3::CsmaChannel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## csma-channel.h: ns3::CsmaChannel::CsmaChannel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## csma-channel.h: int32_t ns3::CsmaChannel::Attach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
|
||||
cls.add_method('Attach',
|
||||
'int32_t',
|
||||
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::Detach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
|
||||
cls.add_method('Detach',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::Detach(uint32_t deviceId) [member function]
|
||||
cls.add_method('Detach',
|
||||
'bool',
|
||||
[param('uint32_t', 'deviceId')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::Reattach(uint32_t deviceId) [member function]
|
||||
cls.add_method('Reattach',
|
||||
'bool',
|
||||
[param('uint32_t', 'deviceId')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::Reattach(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
|
||||
cls.add_method('Reattach',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::TransmitStart(ns3::Ptr<ns3::Packet> p, uint32_t srcId) [member function]
|
||||
cls.add_method('TransmitStart',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'srcId')])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::TransmitEnd() [member function]
|
||||
cls.add_method('TransmitEnd',
|
||||
'bool',
|
||||
[])
|
||||
## csma-channel.h: void ns3::CsmaChannel::PropagationCompleteEvent() [member function]
|
||||
cls.add_method('PropagationCompleteEvent',
|
||||
'void',
|
||||
[])
|
||||
## csma-channel.h: int32_t ns3::CsmaChannel::GetDeviceNum(ns3::Ptr<ns3::CsmaNetDevice> device) [member function]
|
||||
cls.add_method('GetDeviceNum',
|
||||
'int32_t',
|
||||
[param('ns3::Ptr< ns3::CsmaNetDevice >', 'device')])
|
||||
## csma-channel.h: ns3::WireState ns3::CsmaChannel::GetState() [member function]
|
||||
cls.add_method('GetState',
|
||||
'ns3::WireState',
|
||||
[])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::IsBusy() [member function]
|
||||
cls.add_method('IsBusy',
|
||||
'bool',
|
||||
[])
|
||||
## csma-channel.h: bool ns3::CsmaChannel::IsActive(uint32_t deviceId) [member function]
|
||||
cls.add_method('IsActive',
|
||||
'bool',
|
||||
[param('uint32_t', 'deviceId')])
|
||||
## csma-channel.h: uint32_t ns3::CsmaChannel::GetNumActDevices() [member function]
|
||||
cls.add_method('GetNumActDevices',
|
||||
'uint32_t',
|
||||
[])
|
||||
## csma-channel.h: uint32_t ns3::CsmaChannel::GetNDevices() const [member function]
|
||||
cls.add_method('GetNDevices',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-channel.h: ns3::Ptr<ns3::NetDevice> ns3::CsmaChannel::GetDevice(uint32_t i) const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-channel.h: ns3::Ptr<ns3::CsmaNetDevice> ns3::CsmaChannel::GetCsmaDevice(uint32_t i) const [member function]
|
||||
cls.add_method('GetCsmaDevice',
|
||||
'ns3::Ptr< ns3::CsmaNetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## csma-channel.h: ns3::DataRate ns3::CsmaChannel::GetDataRate() [member function]
|
||||
cls.add_method('GetDataRate',
|
||||
'ns3::DataRate',
|
||||
[],
|
||||
is_virtual=True)
|
||||
## csma-channel.h: ns3::Time ns3::CsmaChannel::GetDelay() [member function]
|
||||
cls.add_method('GetDelay',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3CsmaNetDevice_methods(root_module, cls):
|
||||
## csma-net-device.h: static ns3::TypeId ns3::CsmaNetDevice::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## csma-net-device.h: ns3::CsmaNetDevice::CsmaNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetInterframeGap(ns3::Time t) [member function]
|
||||
cls.add_method('SetInterframeGap',
|
||||
'void',
|
||||
[param('ns3::Time', 't')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetBackoffParams(ns3::Time slotTime, uint32_t minSlots, uint32_t maxSlots, uint32_t maxRetries, uint32_t ceiling) [member function]
|
||||
cls.add_method('SetBackoffParams',
|
||||
'void',
|
||||
[param('ns3::Time', 'slotTime'), param('uint32_t', 'minSlots'), param('uint32_t', 'maxSlots'), param('uint32_t', 'maxRetries'), param('uint32_t', 'ceiling')])
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::Attach(ns3::Ptr<ns3::CsmaChannel> ch) [member function]
|
||||
cls.add_method('Attach',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::CsmaChannel >', 'ch')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetQueue(ns3::Ptr<ns3::Queue> queue) [member function]
|
||||
cls.add_method('SetQueue',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Queue >', 'queue')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function]
|
||||
cls.add_method('SetReceiveErrorModel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::ErrorModel >', 'em')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::Receive(ns3::Ptr<ns3::Packet> p, ns3::Ptr<ns3::CsmaNetDevice> sender) [member function]
|
||||
cls.add_method('Receive',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ptr< ns3::CsmaNetDevice >', 'sender')])
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::IsSendEnabled() [member function]
|
||||
cls.add_method('IsSendEnabled',
|
||||
'bool',
|
||||
[])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetSendEnable(bool enable) [member function]
|
||||
cls.add_method('SetSendEnable',
|
||||
'void',
|
||||
[param('bool', 'enable')])
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::IsReceiveEnabled() [member function]
|
||||
cls.add_method('IsReceiveEnabled',
|
||||
'bool',
|
||||
[])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetReceiveEnable(bool enable) [member function]
|
||||
cls.add_method('SetReceiveEnable',
|
||||
'void',
|
||||
[param('bool', 'enable')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetAddress(ns3::Mac48Address addr) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
[param('ns3::Mac48Address', 'addr')])
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetFrameSize(uint16_t frameSize) [member function]
|
||||
cls.add_method('SetFrameSize',
|
||||
'void',
|
||||
[param('uint16_t', 'frameSize')])
|
||||
## csma-net-device.h: uint16_t ns3::CsmaNetDevice::GetFrameSize() const [member function]
|
||||
cls.add_method('GetFrameSize',
|
||||
'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',
|
||||
[param('std::string const', 'name')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: std::string ns3::CsmaNetDevice::GetName() const [member function]
|
||||
cls.add_method('GetName',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetIfIndex(uint32_t const index) [member function]
|
||||
cls.add_method('SetIfIndex',
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: uint32_t ns3::CsmaNetDevice::GetIfIndex() const [member function]
|
||||
cls.add_method('GetIfIndex',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: ns3::Ptr<ns3::Channel> ns3::CsmaNetDevice::GetChannel() const [member function]
|
||||
cls.add_method('GetChannel',
|
||||
'ns3::Ptr< ns3::Channel >',
|
||||
[],
|
||||
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',
|
||||
[param('uint16_t const', 'mtu')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: uint16_t ns3::CsmaNetDevice::GetMtu() const [member function]
|
||||
cls.add_method('GetMtu',
|
||||
'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',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::IsBroadcast() const [member function]
|
||||
cls.add_method('IsBroadcast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::GetBroadcast() const [member function]
|
||||
cls.add_method('GetBroadcast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::IsMulticast() const [member function]
|
||||
cls.add_method('IsMulticast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::GetMulticast() const [member function]
|
||||
cls.add_method('GetMulticast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: ns3::Address ns3::CsmaNetDevice::MakeMulticastAddress(ns3::Ipv4Address multicastGroup) const [member function]
|
||||
cls.add_method('MakeMulticastAddress',
|
||||
'ns3::Address',
|
||||
[param('ns3::Ipv4Address', 'multicastGroup')],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::IsPointToPoint() const [member function]
|
||||
cls.add_method('IsPointToPoint',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('Send',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('SendFrom',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: ns3::Ptr<ns3::Node> ns3::CsmaNetDevice::GetNode() const [member function]
|
||||
cls.add_method('GetNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::NeedsArp() const [member function]
|
||||
cls.add_method('NeedsArp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function]
|
||||
cls.add_method('SetReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty >', 'cb')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function]
|
||||
cls.add_method('SetPromiscReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType >', 'cb')],
|
||||
is_virtual=True)
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::SupportsSendFrom() const [member function]
|
||||
cls.add_method('SupportsSendFrom',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## csma-net-device.h: ns3::Ptr<ns3::Queue> ns3::CsmaNetDevice::GetQueue() const [member function]
|
||||
cls.add_method('GetQueue',
|
||||
'ns3::Ptr< ns3::Queue >',
|
||||
[],
|
||||
is_const=True, visibility='protected')
|
||||
## csma-net-device.h: void ns3::CsmaNetDevice::AddHeader(ns3::Ptr<ns3::Packet> p, ns3::Mac48Address source, ns3::Mac48Address dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('AddHeader',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Mac48Address', 'source'), param('ns3::Mac48Address', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
visibility='protected')
|
||||
## csma-net-device.h: bool ns3::CsmaNetDevice::ProcessHeader(ns3::Ptr<ns3::Packet> p, uint16_t & param) [member function]
|
||||
cls.add_method('ProcessHeader',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t &', 'param')],
|
||||
visibility='protected')
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
280
bindings/python/ns3_module_global_routing.py
Normal file
280
bindings/python/ns3_module_global_routing.py
Normal file
@@ -0,0 +1,280 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## global-route-manager.h: ns3::GlobalRouteManager [class]
|
||||
module.add_class('GlobalRouteManager')
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA [class]
|
||||
module.add_class('GlobalRoutingLSA')
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::LSType [enumeration]
|
||||
module.add_enum('LSType', ['Unknown', 'RouterLSA', 'NetworkLSA', 'SummaryLSA', 'SummaryLSA_ASBR', 'ASExternalLSAs'], outer_class=root_module['ns3::GlobalRoutingLSA'])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::SPFStatus [enumeration]
|
||||
module.add_enum('SPFStatus', ['LSA_SPF_NOT_EXPLORED', 'LSA_SPF_CANDIDATE', 'LSA_SPF_IN_SPFTREE'], outer_class=root_module['ns3::GlobalRoutingLSA'])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord [class]
|
||||
module.add_class('GlobalRoutingLinkRecord')
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord::LinkType [enumeration]
|
||||
module.add_enum('LinkType', ['Unknown', 'PointToPoint', 'TransitNetwork', 'StubNetwork', 'VirtualLink'], outer_class=root_module['ns3::GlobalRoutingLinkRecord'])
|
||||
## global-router-interface.h: ns3::GlobalRouter [class]
|
||||
module.add_class('GlobalRouter', is_singleton=True, parent=root_module['ns3::Object'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3GlobalRouteManager_methods(root_module, root_module['ns3::GlobalRouteManager'])
|
||||
register_Ns3GlobalRoutingLSA_methods(root_module, root_module['ns3::GlobalRoutingLSA'])
|
||||
register_Ns3GlobalRoutingLinkRecord_methods(root_module, root_module['ns3::GlobalRoutingLinkRecord'])
|
||||
register_Ns3GlobalRouter_methods(root_module, root_module['ns3::GlobalRouter'])
|
||||
return
|
||||
|
||||
def register_Ns3GlobalRouteManager_methods(root_module, cls):
|
||||
## global-route-manager.h: static void ns3::GlobalRouteManager::PopulateRoutingTables() [member function]
|
||||
cls.add_method('PopulateRoutingTables',
|
||||
'void',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-route-manager.h: static uint32_t ns3::GlobalRouteManager::AllocateRouterId() [member function]
|
||||
cls.add_method('AllocateRouterId',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3GlobalRoutingLSA_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::GlobalRoutingLSA() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::GlobalRoutingLSA(ns3::GlobalRoutingLSA::SPFStatus status, ns3::Ipv4Address linkStateId, ns3::Ipv4Address advertisingRtr) [constructor]
|
||||
cls.add_constructor([param('ns3::GlobalRoutingLSA::SPFStatus', 'status'), param('ns3::Ipv4Address', 'linkStateId'), param('ns3::Ipv4Address', 'advertisingRtr')])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::GlobalRoutingLSA(ns3::GlobalRoutingLSA & lsa) [constructor]
|
||||
cls.add_constructor([param('ns3::GlobalRoutingLSA &', 'lsa')])
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRoutingLSA::AddAttachedRouter(ns3::Ipv4Address addr) [member function]
|
||||
cls.add_method('AddAttachedRouter',
|
||||
'uint32_t',
|
||||
[param('ns3::Ipv4Address', 'addr')])
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRoutingLSA::AddLinkRecord(ns3::GlobalRoutingLinkRecord * lr) [member function]
|
||||
cls.add_method('AddLinkRecord',
|
||||
'uint32_t',
|
||||
[param('ns3::GlobalRoutingLinkRecord *', 'lr')])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::ClearLinkRecords() [member function]
|
||||
cls.add_method('ClearLinkRecords',
|
||||
'void',
|
||||
[])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::CopyLinkRecords(ns3::GlobalRoutingLSA const & lsa) [member function]
|
||||
cls.add_method('CopyLinkRecords',
|
||||
'void',
|
||||
[param('ns3::GlobalRoutingLSA const &', 'lsa')])
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRoutingLSA::GetAdvertisingRouter() const [member function]
|
||||
cls.add_method('GetAdvertisingRouter',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRoutingLSA::GetAttachedRouter(uint32_t n) const [member function]
|
||||
cls.add_method('GetAttachedRouter',
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint32_t', 'n')],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::LSType ns3::GlobalRoutingLSA::GetLSType() const [member function]
|
||||
cls.add_method('GetLSType',
|
||||
'ns3::GlobalRoutingLSA::LSType',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord * ns3::GlobalRoutingLSA::GetLinkRecord(uint32_t n) const [member function]
|
||||
cls.add_method('GetLinkRecord',
|
||||
'ns3::GlobalRoutingLinkRecord *',
|
||||
[param('uint32_t', 'n')],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRoutingLSA::GetLinkStateId() const [member function]
|
||||
cls.add_method('GetLinkStateId',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRoutingLSA::GetNAttachedRouters() const [member function]
|
||||
cls.add_method('GetNAttachedRouters',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRoutingLSA::GetNLinkRecords() const [member function]
|
||||
cls.add_method('GetNLinkRecords',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::Ipv4Mask ns3::GlobalRoutingLSA::GetNetworkLSANetworkMask() const [member function]
|
||||
cls.add_method('GetNetworkLSANetworkMask',
|
||||
'ns3::Ipv4Mask',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: ns3::GlobalRoutingLSA::SPFStatus ns3::GlobalRoutingLSA::GetStatus() const [member function]
|
||||
cls.add_method('GetStatus',
|
||||
'ns3::GlobalRoutingLSA::SPFStatus',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: bool ns3::GlobalRoutingLSA::IsEmpty() const [member function]
|
||||
cls.add_method('IsEmpty',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::SetAdvertisingRouter(ns3::Ipv4Address rtr) [member function]
|
||||
cls.add_method('SetAdvertisingRouter',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'rtr')])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::SetLSType(ns3::GlobalRoutingLSA::LSType typ) [member function]
|
||||
cls.add_method('SetLSType',
|
||||
'void',
|
||||
[param('ns3::GlobalRoutingLSA::LSType', 'typ')])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::SetLinkStateId(ns3::Ipv4Address addr) [member function]
|
||||
cls.add_method('SetLinkStateId',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'addr')])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::SetNetworkLSANetworkMask(ns3::Ipv4Mask mask) [member function]
|
||||
cls.add_method('SetNetworkLSANetworkMask',
|
||||
'void',
|
||||
[param('ns3::Ipv4Mask', 'mask')])
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLSA::SetStatus(ns3::GlobalRoutingLSA::SPFStatus status) [member function]
|
||||
cls.add_method('SetStatus',
|
||||
'void',
|
||||
[param('ns3::GlobalRoutingLSA::SPFStatus', 'status')])
|
||||
return
|
||||
|
||||
def register_Ns3GlobalRoutingLinkRecord_methods(root_module, cls):
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord::GlobalRoutingLinkRecord(ns3::GlobalRoutingLinkRecord const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::GlobalRoutingLinkRecord const &', 'arg0')])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord::GlobalRoutingLinkRecord() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord::GlobalRoutingLinkRecord(ns3::GlobalRoutingLinkRecord::LinkType linkType, ns3::Ipv4Address linkId, ns3::Ipv4Address linkData, uint16_t metric) [constructor]
|
||||
cls.add_constructor([param('ns3::GlobalRoutingLinkRecord::LinkType', 'linkType'), param('ns3::Ipv4Address', 'linkId'), param('ns3::Ipv4Address', 'linkData'), param('uint16_t', 'metric')])
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRoutingLinkRecord::GetLinkId() const [member function]
|
||||
cls.add_method('GetLinkId',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLinkRecord::SetLinkId(ns3::Ipv4Address addr) [member function]
|
||||
cls.add_method('SetLinkId',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'addr')])
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRoutingLinkRecord::GetLinkData() const [member function]
|
||||
cls.add_method('GetLinkData',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLinkRecord::SetLinkData(ns3::Ipv4Address addr) [member function]
|
||||
cls.add_method('SetLinkData',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'addr')])
|
||||
## global-router-interface.h: ns3::GlobalRoutingLinkRecord::LinkType ns3::GlobalRoutingLinkRecord::GetLinkType() const [member function]
|
||||
cls.add_method('GetLinkType',
|
||||
'ns3::GlobalRoutingLinkRecord::LinkType',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLinkRecord::SetLinkType(ns3::GlobalRoutingLinkRecord::LinkType linkType) [member function]
|
||||
cls.add_method('SetLinkType',
|
||||
'void',
|
||||
[param('ns3::GlobalRoutingLinkRecord::LinkType', 'linkType')])
|
||||
## global-router-interface.h: uint16_t ns3::GlobalRoutingLinkRecord::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRoutingLinkRecord::SetMetric(uint16_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint16_t', 'metric')])
|
||||
return
|
||||
|
||||
def register_Ns3GlobalRouter_methods(root_module, cls):
|
||||
## global-router-interface.h: static ns3::TypeId ns3::GlobalRouter::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## global-router-interface.h: ns3::GlobalRouter::GlobalRouter() [constructor]
|
||||
cls.add_constructor([])
|
||||
## global-router-interface.h: ns3::Ipv4Address ns3::GlobalRouter::GetRouterId() const [member function]
|
||||
cls.add_method('GetRouterId',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRouter::DiscoverLSAs() [member function]
|
||||
cls.add_method('DiscoverLSAs',
|
||||
'uint32_t',
|
||||
[])
|
||||
## global-router-interface.h: uint32_t ns3::GlobalRouter::GetNumLSAs() const [member function]
|
||||
cls.add_method('GetNumLSAs',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## global-router-interface.h: bool ns3::GlobalRouter::GetLSA(uint32_t n, ns3::GlobalRoutingLSA & lsa) const [member function]
|
||||
cls.add_method('GetLSA',
|
||||
'bool',
|
||||
[param('uint32_t', 'n'), param('ns3::GlobalRoutingLSA &', 'lsa')],
|
||||
is_const=True)
|
||||
## global-router-interface.h: void ns3::GlobalRouter::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
758
bindings/python/ns3_module_helper.py
Normal file
758
bindings/python/ns3_module_helper.py
Normal file
@@ -0,0 +1,758 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## application-container.h: ns3::ApplicationContainer [class]
|
||||
module.add_class('ApplicationContainer')
|
||||
## bridge-helper.h: ns3::BridgeHelper [class]
|
||||
module.add_class('BridgeHelper', allow_subclassing=False)
|
||||
## csma-helper.h: ns3::CsmaHelper [class]
|
||||
module.add_class('CsmaHelper', allow_subclassing=False)
|
||||
## internet-stack-helper.h: ns3::InternetStackHelper [class]
|
||||
module.add_class('InternetStackHelper', allow_subclassing=False)
|
||||
## ipv4-address-helper.h: ns3::Ipv4AddressHelper [class]
|
||||
module.add_class('Ipv4AddressHelper', allow_subclassing=False)
|
||||
## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer [class]
|
||||
module.add_class('Ipv4InterfaceContainer')
|
||||
## mobility-helper.h: ns3::MobilityHelper [class]
|
||||
module.add_class('MobilityHelper', allow_subclassing=False)
|
||||
## net-device-container.h: ns3::NetDeviceContainer [class]
|
||||
module.add_class('NetDeviceContainer')
|
||||
## node-container.h: ns3::NodeContainer [class]
|
||||
module.add_class('NodeContainer')
|
||||
## ns2-mobility-helper.h: ns3::Ns2MobilityHelper [class]
|
||||
module.add_class('Ns2MobilityHelper', allow_subclassing=False)
|
||||
## olsr-helper.h: ns3::OlsrHelper [class]
|
||||
module.add_class('OlsrHelper', allow_subclassing=False)
|
||||
## on-off-helper.h: ns3::OnOffHelper [class]
|
||||
module.add_class('OnOffHelper', allow_subclassing=False)
|
||||
## packet-sink-helper.h: ns3::PacketSinkHelper [class]
|
||||
module.add_class('PacketSinkHelper', allow_subclassing=False)
|
||||
## packet-socket-helper.h: ns3::PacketSocketHelper [class]
|
||||
module.add_class('PacketSocketHelper', allow_subclassing=False)
|
||||
## point-to-point-helper.h: ns3::PointToPointHelper [class]
|
||||
module.add_class('PointToPointHelper', allow_subclassing=False)
|
||||
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper [class]
|
||||
module.add_class('StaticMulticastRouteHelper', allow_subclassing=False)
|
||||
## udp-echo-helper.h: ns3::UdpEchoClientHelper [class]
|
||||
module.add_class('UdpEchoClientHelper', allow_subclassing=False)
|
||||
## udp-echo-helper.h: ns3::UdpEchoServerHelper [class]
|
||||
module.add_class('UdpEchoServerHelper', allow_subclassing=False)
|
||||
## wifi-helper.h: ns3::WifiHelper [class]
|
||||
module.add_class('WifiHelper', allow_subclassing=False)
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
|
||||
register_Ns3BridgeHelper_methods(root_module, root_module['ns3::BridgeHelper'])
|
||||
register_Ns3CsmaHelper_methods(root_module, root_module['ns3::CsmaHelper'])
|
||||
register_Ns3InternetStackHelper_methods(root_module, root_module['ns3::InternetStackHelper'])
|
||||
register_Ns3Ipv4AddressHelper_methods(root_module, root_module['ns3::Ipv4AddressHelper'])
|
||||
register_Ns3Ipv4InterfaceContainer_methods(root_module, root_module['ns3::Ipv4InterfaceContainer'])
|
||||
register_Ns3MobilityHelper_methods(root_module, root_module['ns3::MobilityHelper'])
|
||||
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
|
||||
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
|
||||
register_Ns3Ns2MobilityHelper_methods(root_module, root_module['ns3::Ns2MobilityHelper'])
|
||||
register_Ns3OlsrHelper_methods(root_module, root_module['ns3::OlsrHelper'])
|
||||
register_Ns3OnOffHelper_methods(root_module, root_module['ns3::OnOffHelper'])
|
||||
register_Ns3PacketSinkHelper_methods(root_module, root_module['ns3::PacketSinkHelper'])
|
||||
register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper'])
|
||||
register_Ns3PointToPointHelper_methods(root_module, root_module['ns3::PointToPointHelper'])
|
||||
register_Ns3StaticMulticastRouteHelper_methods(root_module, root_module['ns3::StaticMulticastRouteHelper'])
|
||||
register_Ns3UdpEchoClientHelper_methods(root_module, root_module['ns3::UdpEchoClientHelper'])
|
||||
register_Ns3UdpEchoServerHelper_methods(root_module, root_module['ns3::UdpEchoServerHelper'])
|
||||
register_Ns3WifiHelper_methods(root_module, root_module['ns3::WifiHelper'])
|
||||
return
|
||||
|
||||
def register_Ns3ApplicationContainer_methods(root_module, cls):
|
||||
## application-container.h: ns3::ApplicationContainer::ApplicationContainer(ns3::ApplicationContainer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::ApplicationContainer const &', 'arg0')])
|
||||
## application-container.h: ns3::ApplicationContainer::ApplicationContainer() [constructor]
|
||||
cls.add_constructor([])
|
||||
## application-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::Begin() const [member function]
|
||||
cls.add_method('Begin',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## application-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Application>*,std::vector<ns3::Ptr<ns3::Application>, std::allocator<ns3::Ptr<ns3::Application> > > > ns3::ApplicationContainer::End() const [member function]
|
||||
cls.add_method('End',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Application > const, std::vector< ns3::Ptr< ns3::Application > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## application-container.h: uint32_t ns3::ApplicationContainer::GetN() const [member function]
|
||||
cls.add_method('GetN',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## application-container.h: ns3::Ptr<ns3::Application> ns3::ApplicationContainer::Get(uint32_t i) const [member function]
|
||||
cls.add_method('Get',
|
||||
'ns3::Ptr< ns3::Application >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## application-container.h: void ns3::ApplicationContainer::Add(ns3::ApplicationContainer other) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::ApplicationContainer', 'other')])
|
||||
## application-container.h: void ns3::ApplicationContainer::Add(ns3::Ptr<ns3::Application> application) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Application >', 'application')])
|
||||
## application-container.h: void ns3::ApplicationContainer::Start(ns3::Time start) [member function]
|
||||
cls.add_method('Start',
|
||||
'void',
|
||||
[param('ns3::Time', 'start')])
|
||||
## application-container.h: void ns3::ApplicationContainer::Stop(ns3::Time stop) [member function]
|
||||
cls.add_method('Stop',
|
||||
'void',
|
||||
[param('ns3::Time', 'stop')])
|
||||
return
|
||||
|
||||
def register_Ns3BridgeHelper_methods(root_module, cls):
|
||||
## bridge-helper.h: ns3::BridgeHelper::BridgeHelper(ns3::BridgeHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::BridgeHelper const &', 'arg0')])
|
||||
## bridge-helper.h: ns3::BridgeHelper::BridgeHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## bridge-helper.h: void ns3::BridgeHelper::SetDeviceAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
|
||||
cls.add_method('SetDeviceAttribute',
|
||||
'void',
|
||||
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
|
||||
## bridge-helper.h: ns3::NetDeviceContainer ns3::BridgeHelper::Install(ns3::Ptr<ns3::Node> node, ns3::NetDeviceContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::NetDeviceContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3CsmaHelper_methods(root_module, cls):
|
||||
## csma-helper.h: ns3::CsmaHelper::CsmaHelper(ns3::CsmaHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::CsmaHelper const &', 'arg0')])
|
||||
## csma-helper.h: ns3::CsmaHelper::CsmaHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## csma-helper.h: void ns3::CsmaHelper::SetQueue(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetQueue',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
|
||||
## csma-helper.h: void ns3::CsmaHelper::SetDeviceAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
|
||||
cls.add_method('SetDeviceAttribute',
|
||||
'void',
|
||||
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
|
||||
## csma-helper.h: void ns3::CsmaHelper::SetChannelAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
|
||||
cls.add_method('SetChannelAttribute',
|
||||
'void',
|
||||
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
|
||||
## csma-helper.h: void ns3::CsmaHelper::SetDeviceParameter(std::string n1, ns3::AttributeValue const & v1) [member function]
|
||||
cls.add_method('SetDeviceParameter',
|
||||
'void',
|
||||
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')],
|
||||
deprecated=True)
|
||||
## csma-helper.h: void ns3::CsmaHelper::SetChannelParameter(std::string n1, ns3::AttributeValue const & v1) [member function]
|
||||
cls.add_method('SetChannelParameter',
|
||||
'void',
|
||||
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')],
|
||||
deprecated=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnablePcap(std::string filename, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnablePcap(std::string filename, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnablePcap(std::string filename, ns3::NodeContainer n) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnablePcapAll(std::string filename) [member function]
|
||||
cls.add_method('EnablePcapAll',
|
||||
'void',
|
||||
[param('std::string', 'filename')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::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)
|
||||
## csma-helper.h: static void ns3::CsmaHelper::EnableAsciiAll(std::ostream & os) [member function]
|
||||
cls.add_method('EnableAsciiAll',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_static=True)
|
||||
## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::NodeContainer const &', 'c')])
|
||||
## csma-helper.h: ns3::NetDeviceContainer ns3::CsmaHelper::Install(ns3::NodeContainer const & c, ns3::Ptr<ns3::CsmaChannel> channel) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::CsmaChannel >', 'channel')])
|
||||
## csma-helper.h: void ns3::CsmaHelper::InstallStar(ns3::Ptr<ns3::Node> hub, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function]
|
||||
cls.add_method('InstallStar',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'hub'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')])
|
||||
return
|
||||
|
||||
def register_Ns3InternetStackHelper_methods(root_module, cls):
|
||||
## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper(ns3::InternetStackHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::InternetStackHelper const &', 'arg0')])
|
||||
## internet-stack-helper.h: ns3::InternetStackHelper::InternetStackHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## internet-stack-helper.h: void ns3::InternetStackHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
## internet-stack-helper.h: void ns3::InternetStackHelper::SetNscStack(std::string soname) [member function]
|
||||
cls.add_method('SetNscStack',
|
||||
'void',
|
||||
[param('std::string', 'soname')])
|
||||
## internet-stack-helper.h: static void ns3::InternetStackHelper::EnablePcapAll(std::string filename) [member function]
|
||||
cls.add_method('EnablePcapAll',
|
||||
'void',
|
||||
[param('std::string', 'filename')],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4AddressHelper_methods(root_module, cls):
|
||||
## ipv4-address-helper.h: ns3::Ipv4AddressHelper::Ipv4AddressHelper(ns3::Ipv4AddressHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4AddressHelper const &', 'arg0')])
|
||||
## ipv4-address-helper.h: ns3::Ipv4AddressHelper::Ipv4AddressHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-address-helper.h: void ns3::Ipv4AddressHelper::SetBase(ns3::Ipv4Address network, ns3::Ipv4Mask mask, ns3::Ipv4Address base="0.0.0.1") [member function]
|
||||
cls.add_method('SetBase',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'mask'), param('ns3::Ipv4Address', 'base', default_value='"0.0.0.1"')])
|
||||
## ipv4-address-helper.h: ns3::Ipv4Address ns3::Ipv4AddressHelper::NewNetwork() [member function]
|
||||
cls.add_method('NewNetwork',
|
||||
'ns3::Ipv4Address',
|
||||
[])
|
||||
## ipv4-address-helper.h: ns3::Ipv4Address ns3::Ipv4AddressHelper::NewAddress() [member function]
|
||||
cls.add_method('NewAddress',
|
||||
'ns3::Ipv4Address',
|
||||
[])
|
||||
## ipv4-address-helper.h: ns3::Ipv4InterfaceContainer ns3::Ipv4AddressHelper::Assign(ns3::NetDeviceContainer const & c) [member function]
|
||||
cls.add_method('Assign',
|
||||
'ns3::Ipv4InterfaceContainer',
|
||||
[param('ns3::NetDeviceContainer const &', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4InterfaceContainer_methods(root_module, cls):
|
||||
## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer(ns3::Ipv4InterfaceContainer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4InterfaceContainer const &', 'arg0')])
|
||||
## ipv4-interface-container.h: ns3::Ipv4InterfaceContainer::Ipv4InterfaceContainer() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-interface-container.h: void ns3::Ipv4InterfaceContainer::Add(ns3::Ipv4InterfaceContainer other) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Ipv4InterfaceContainer', 'other')])
|
||||
## ipv4-interface-container.h: uint32_t ns3::Ipv4InterfaceContainer::GetN() const [member function]
|
||||
cls.add_method('GetN',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface-container.h: ns3::Ipv4Address ns3::Ipv4InterfaceContainer::GetAddress(uint32_t i) const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-interface-container.h: void ns3::Ipv4InterfaceContainer::SetMetric(uint32_t i, uint16_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'i'), param('uint16_t', 'metric')])
|
||||
## ipv4-interface-container.h: void ns3::Ipv4InterfaceContainer::Add(ns3::Ptr<ns3::Ipv4> ipv4, uint32_t interface) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4 >', 'ipv4'), param('uint32_t', 'interface')])
|
||||
return
|
||||
|
||||
def register_Ns3MobilityHelper_methods(root_module, cls):
|
||||
## mobility-helper.h: ns3::MobilityHelper::MobilityHelper(ns3::MobilityHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::MobilityHelper const &', 'arg0')])
|
||||
## mobility-helper.h: ns3::MobilityHelper::MobilityHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::SetPositionAllocator(ns3::Ptr<ns3::PositionAllocator> allocator) [member function]
|
||||
cls.add_method('SetPositionAllocator',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::PositionAllocator >', 'allocator')])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::SetPositionAllocator(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue(), std::string n8="", ns3::AttributeValue const & v8=ns3::EmptyAttributeValue(), std::string n9="", ns3::AttributeValue const & v9=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetPositionAllocator',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n8', default_value='""'), param('ns3::AttributeValue const &', 'v8', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n9', default_value='""'), param('ns3::AttributeValue const &', 'v9', default_value='ns3::EmptyAttributeValue()')])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::SetMobilityModel(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue(), std::string n8="", ns3::AttributeValue const & v8=ns3::EmptyAttributeValue(), std::string n9="", ns3::AttributeValue const & v9=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetMobilityModel',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n8', default_value='""'), param('ns3::AttributeValue const &', 'v8', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n9', default_value='""'), param('ns3::AttributeValue const &', 'v9', default_value='ns3::EmptyAttributeValue()')])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::PushReferenceMobilityModel(ns3::Ptr<ns3::Object> reference) [member function]
|
||||
cls.add_method('PushReferenceMobilityModel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Object >', 'reference')])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::PopReferenceMobilityModel() [member function]
|
||||
cls.add_method('PopReferenceMobilityModel',
|
||||
'void',
|
||||
[])
|
||||
## mobility-helper.h: std::string ns3::MobilityHelper::GetMobilityModelType() const [member function]
|
||||
cls.add_method('GetMobilityModelType',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## mobility-helper.h: void ns3::MobilityHelper::Install(ns3::NodeContainer container) [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[param('ns3::NodeContainer', 'container')])
|
||||
## mobility-helper.h: void ns3::MobilityHelper::InstallAll() [member function]
|
||||
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_Ns3NetDeviceContainer_methods(root_module, cls):
|
||||
## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')])
|
||||
## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer() [constructor]
|
||||
cls.add_constructor([])
|
||||
## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr<ns3::NetDevice> dev) [constructor]
|
||||
cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')])
|
||||
## net-device-container.h: ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor]
|
||||
cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')])
|
||||
## net-device-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::Begin() const [member function]
|
||||
cls.add_method('Begin',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## net-device-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::NetDevice>*,std::vector<ns3::Ptr<ns3::NetDevice>, std::allocator<ns3::Ptr<ns3::NetDevice> > > > ns3::NetDeviceContainer::End() const [member function]
|
||||
cls.add_method('End',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## net-device-container.h: uint32_t ns3::NetDeviceContainer::GetN() const [member function]
|
||||
cls.add_method('GetN',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## net-device-container.h: ns3::Ptr<ns3::NetDevice> ns3::NetDeviceContainer::Get(uint32_t i) const [member function]
|
||||
cls.add_method('Get',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## net-device-container.h: void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::NetDeviceContainer', 'other')])
|
||||
## net-device-container.h: void ns3::NetDeviceContainer::Add(ns3::Ptr<ns3::NetDevice> device) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
|
||||
return
|
||||
|
||||
def register_Ns3NodeContainer_methods(root_module, cls):
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')])
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer() [constructor]
|
||||
cls.add_constructor([])
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer(ns3::Ptr<ns3::Node> node) [constructor]
|
||||
cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor]
|
||||
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')])
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor]
|
||||
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')])
|
||||
## node-container.h: ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor]
|
||||
cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')])
|
||||
## node-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::Begin() const [member function]
|
||||
cls.add_method('Begin',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## node-container.h: __gnu_cxx::__normal_iterator<const ns3::Ptr<ns3::Node>*,std::vector<ns3::Ptr<ns3::Node>, std::allocator<ns3::Ptr<ns3::Node> > > > ns3::NodeContainer::End() const [member function]
|
||||
cls.add_method('End',
|
||||
'__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >',
|
||||
[],
|
||||
is_const=True)
|
||||
## node-container.h: uint32_t ns3::NodeContainer::GetN() const [member function]
|
||||
cls.add_method('GetN',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## node-container.h: ns3::Ptr<ns3::Node> ns3::NodeContainer::Get(uint32_t i) const [member function]
|
||||
cls.add_method('Get',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## node-container.h: void ns3::NodeContainer::Create(uint32_t n) [member function]
|
||||
cls.add_method('Create',
|
||||
'void',
|
||||
[param('uint32_t', 'n')])
|
||||
## node-container.h: void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::NodeContainer', 'other')])
|
||||
## node-container.h: void ns3::NodeContainer::Add(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## node-container.h: static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function]
|
||||
cls.add_method('GetGlobal',
|
||||
'ns3::NodeContainer',
|
||||
[],
|
||||
is_static=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ns2MobilityHelper_methods(root_module, cls):
|
||||
## ns2-mobility-helper.h: ns3::Ns2MobilityHelper::Ns2MobilityHelper(ns3::Ns2MobilityHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ns2MobilityHelper const &', 'arg0')])
|
||||
## ns2-mobility-helper.h: ns3::Ns2MobilityHelper::Ns2MobilityHelper(std::string filename) [constructor]
|
||||
cls.add_constructor([param('std::string', 'filename')])
|
||||
## ns2-mobility-helper.h: void ns3::Ns2MobilityHelper::Install() const [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrHelper_methods(root_module, cls):
|
||||
## olsr-helper.h: ns3::OlsrHelper::OlsrHelper(ns3::OlsrHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::OlsrHelper const &', 'arg0')])
|
||||
## olsr-helper.h: ns3::OlsrHelper::OlsrHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-helper.h: void ns3::OlsrHelper::SetAgent(std::string tid, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetAgent',
|
||||
'void',
|
||||
[param('std::string', 'tid'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
|
||||
## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::NodeContainer container) [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[param('ns3::NodeContainer', 'container')])
|
||||
## olsr-helper.h: void ns3::OlsrHelper::Install(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## olsr-helper.h: void ns3::OlsrHelper::InstallAll() [member function]
|
||||
cls.add_method('InstallAll',
|
||||
'void',
|
||||
[])
|
||||
return
|
||||
|
||||
def register_Ns3OnOffHelper_methods(root_module, cls):
|
||||
## on-off-helper.h: ns3::OnOffHelper::OnOffHelper(ns3::OnOffHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::OnOffHelper const &', 'arg0')])
|
||||
## on-off-helper.h: ns3::OnOffHelper::OnOffHelper(std::string protocol, ns3::Address address) [constructor]
|
||||
cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
|
||||
## on-off-helper.h: void ns3::OnOffHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## on-off-helper.h: ns3::ApplicationContainer ns3::OnOffHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::ApplicationContainer',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3PacketSinkHelper_methods(root_module, cls):
|
||||
## packet-sink-helper.h: ns3::PacketSinkHelper::PacketSinkHelper(ns3::PacketSinkHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PacketSinkHelper const &', 'arg0')])
|
||||
## packet-sink-helper.h: ns3::PacketSinkHelper::PacketSinkHelper(std::string protocol, ns3::Address address) [constructor]
|
||||
cls.add_constructor([param('std::string', 'protocol'), param('ns3::Address', 'address')])
|
||||
## packet-sink-helper.h: void ns3::PacketSinkHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## packet-sink-helper.h: ns3::ApplicationContainer ns3::PacketSinkHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::ApplicationContainer',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3PacketSocketHelper_methods(root_module, cls):
|
||||
## packet-socket-helper.h: ns3::PacketSocketHelper::PacketSocketHelper(ns3::PacketSocketHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PacketSocketHelper const &', 'arg0')])
|
||||
## packet-socket-helper.h: ns3::PacketSocketHelper::PacketSocketHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## packet-socket-helper.h: void ns3::PacketSocketHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'void',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3PointToPointHelper_methods(root_module, cls):
|
||||
## point-to-point-helper.h: ns3::PointToPointHelper::PointToPointHelper(ns3::PointToPointHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PointToPointHelper const &', 'arg0')])
|
||||
## point-to-point-helper.h: ns3::PointToPointHelper::PointToPointHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::SetQueue(std::string type, std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetQueue',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()')])
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::SetDeviceAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetDeviceAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::SetChannelAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetChannelAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::SetDeviceParameter(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetDeviceParameter',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
|
||||
deprecated=True)
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::SetChannelParameter(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetChannelParameter',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')],
|
||||
deprecated=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnablePcap(std::string filename, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnablePcap(std::string filename, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnablePcap(std::string filename, ns3::NodeContainer n) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnablePcapAll(std::string filename) [member function]
|
||||
cls.add_method('EnablePcapAll',
|
||||
'void',
|
||||
[param('std::string', 'filename')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::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)
|
||||
## point-to-point-helper.h: static void ns3::PointToPointHelper::EnableAsciiAll(std::ostream & os) [member function]
|
||||
cls.add_method('EnableAsciiAll',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_static=True)
|
||||
## point-to-point-helper.h: ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
## point-to-point-helper.h: ns3::NetDeviceContainer ns3::PointToPointHelper::Install(ns3::Ptr<ns3::Node> a, ns3::Ptr<ns3::Node> b) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::Ptr< ns3::Node >', 'a'), param('ns3::Ptr< ns3::Node >', 'b')])
|
||||
## point-to-point-helper.h: void ns3::PointToPointHelper::InstallStar(ns3::Ptr<ns3::Node> hub, ns3::NodeContainer spokes, ns3::NetDeviceContainer & hubDevices, ns3::NetDeviceContainer & spokeDevices) [member function]
|
||||
cls.add_method('InstallStar',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'hub'), param('ns3::NodeContainer', 'spokes'), param('ns3::NetDeviceContainer &', 'hubDevices'), param('ns3::NetDeviceContainer &', 'spokeDevices')])
|
||||
return
|
||||
|
||||
def register_Ns3StaticMulticastRouteHelper_methods(root_module, cls):
|
||||
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper::StaticMulticastRouteHelper(ns3::StaticMulticastRouteHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::StaticMulticastRouteHelper const &', 'arg0')])
|
||||
## static-multicast-route-helper.h: ns3::StaticMulticastRouteHelper::StaticMulticastRouteHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::AddMulticastRoute(ns3::Ptr<ns3::Node> arg0, ns3::Ipv4Address source, ns3::Ipv4Address group, ns3::Ptr<ns3::NetDevice> input, ns3::NetDeviceContainer output) [member function]
|
||||
cls.add_method('AddMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'arg0'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group'), param('ns3::Ptr< ns3::NetDevice >', 'input'), param('ns3::NetDeviceContainer', 'output')])
|
||||
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::SetDefaultMulticastRoute(ns3::Ptr<ns3::Node> n, ns3::Ptr<ns3::NetDevice> nd) [member function]
|
||||
cls.add_method('SetDefaultMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
|
||||
## static-multicast-route-helper.h: void ns3::StaticMulticastRouteHelper::JoinMulticastGroup(ns3::Ptr<ns3::Node> n, ns3::Ipv4Address source, ns3::Ipv4Address group) [member function]
|
||||
cls.add_method('JoinMulticastGroup',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'n'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'group')])
|
||||
return
|
||||
|
||||
def register_Ns3UdpEchoClientHelper_methods(root_module, cls):
|
||||
## udp-echo-helper.h: ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::UdpEchoClientHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::UdpEchoClientHelper const &', 'arg0')])
|
||||
## udp-echo-helper.h: ns3::UdpEchoClientHelper::UdpEchoClientHelper(ns3::Ipv4Address ip, uint16_t port) [constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
|
||||
## udp-echo-helper.h: void ns3::UdpEchoClientHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoClientHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::ApplicationContainer',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3UdpEchoServerHelper_methods(root_module, cls):
|
||||
## udp-echo-helper.h: ns3::UdpEchoServerHelper::UdpEchoServerHelper(ns3::UdpEchoServerHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::UdpEchoServerHelper const &', 'arg0')])
|
||||
## udp-echo-helper.h: ns3::UdpEchoServerHelper::UdpEchoServerHelper(uint16_t port) [constructor]
|
||||
cls.add_constructor([param('uint16_t', 'port')])
|
||||
## udp-echo-helper.h: void ns3::UdpEchoServerHelper::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function]
|
||||
cls.add_method('SetAttribute',
|
||||
'void',
|
||||
[param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')])
|
||||
## udp-echo-helper.h: ns3::ApplicationContainer ns3::UdpEchoServerHelper::Install(ns3::NodeContainer c) [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::ApplicationContainer',
|
||||
[param('ns3::NodeContainer', 'c')])
|
||||
return
|
||||
|
||||
def register_Ns3WifiHelper_methods(root_module, cls):
|
||||
## wifi-helper.h: ns3::WifiHelper::WifiHelper(ns3::WifiHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::WifiHelper const &', 'arg0')])
|
||||
## wifi-helper.h: ns3::WifiHelper::WifiHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## wifi-helper.h: void ns3::WifiHelper::SetRemoteStationManager(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetRemoteStationManager',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
|
||||
## wifi-helper.h: void ns3::WifiHelper::SetMac(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function]
|
||||
cls.add_method('SetMac',
|
||||
'void',
|
||||
[param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')])
|
||||
## wifi-helper.h: void ns3::WifiHelper::SetPhyAttribute(std::string n0, ns3::AttributeValue const & v0) [member function]
|
||||
cls.add_method('SetPhyAttribute',
|
||||
'void',
|
||||
[param('std::string', 'n0'), param('ns3::AttributeValue const &', 'v0')])
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnablePcap(std::string filename, ns3::NodeContainer n) [member function]
|
||||
cls.add_method('EnablePcap',
|
||||
'void',
|
||||
[param('std::string', 'filename'), param('ns3::NodeContainer', 'n')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnablePcapAll(std::string filename) [member function]
|
||||
cls.add_method('EnablePcapAll',
|
||||
'void',
|
||||
[param('std::string', 'filename')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function]
|
||||
cls.add_method('EnableAscii',
|
||||
'void',
|
||||
[param('std::ostream &', 'os'), param('ns3::NetDeviceContainer', 'd')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::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)
|
||||
## wifi-helper.h: static void ns3::WifiHelper::EnableAsciiAll(std::ostream & os) [member function]
|
||||
cls.add_method('EnableAsciiAll',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_static=True)
|
||||
## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::NodeContainer c) const [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::NodeContainer', 'c')],
|
||||
is_const=True)
|
||||
## wifi-helper.h: ns3::NetDeviceContainer ns3::WifiHelper::Install(ns3::NodeContainer c, ns3::Ptr<ns3::WifiChannel> channel) const [member function]
|
||||
cls.add_method('Install',
|
||||
'ns3::NetDeviceContainer',
|
||||
[param('ns3::NodeContainer', 'c'), param('ns3::Ptr< ns3::WifiChannel >', 'channel')],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
662
bindings/python/ns3_module_internet_stack.py
Normal file
662
bindings/python/ns3_module_internet_stack.py
Normal file
@@ -0,0 +1,662 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## tcp-header.h: ns3::TcpHeader [class]
|
||||
module.add_class('TcpHeader', parent=root_module['ns3::Header'])
|
||||
## tcp-header.h: ns3::TcpHeader::Flags_t [enumeration]
|
||||
module.add_enum('Flags_t', ['NONE', 'FIN', 'SYN', 'RST', 'PSH', 'ACK', 'URG'], outer_class=root_module['ns3::TcpHeader'])
|
||||
## udp-header.h: ns3::UdpHeader [class]
|
||||
module.add_class('UdpHeader', parent=root_module['ns3::Header'])
|
||||
## ipv4-interface.h: ns3::Ipv4Interface [class]
|
||||
module.add_class('Ipv4Interface', parent=root_module['ns3::Object'])
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol [class]
|
||||
module.add_class('Ipv4L3Protocol', parent=root_module['ns3::Object'])
|
||||
## ipv4-static-routing.h: ns3::Ipv4StaticRouting [class]
|
||||
module.add_class('Ipv4StaticRouting', parent=root_module['ns3::Ipv4RoutingProtocol'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3TcpHeader_methods(root_module, root_module['ns3::TcpHeader'])
|
||||
register_Ns3UdpHeader_methods(root_module, root_module['ns3::UdpHeader'])
|
||||
register_Ns3Ipv4Interface_methods(root_module, root_module['ns3::Ipv4Interface'])
|
||||
register_Ns3Ipv4L3Protocol_methods(root_module, root_module['ns3::Ipv4L3Protocol'])
|
||||
register_Ns3Ipv4StaticRouting_methods(root_module, root_module['ns3::Ipv4StaticRouting'])
|
||||
return
|
||||
|
||||
def register_Ns3TcpHeader_methods(root_module, cls):
|
||||
## tcp-header.h: ns3::TcpHeader::TcpHeader(ns3::TcpHeader const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TcpHeader const &', 'arg0')])
|
||||
## tcp-header.h: ns3::TcpHeader::TcpHeader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## tcp-header.h: void ns3::TcpHeader::EnableChecksums() [member function]
|
||||
cls.add_method('EnableChecksums',
|
||||
'void',
|
||||
[])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetSourcePort(uint16_t port) [member function]
|
||||
cls.add_method('SetSourcePort',
|
||||
'void',
|
||||
[param('uint16_t', 'port')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetDestinationPort(uint16_t port) [member function]
|
||||
cls.add_method('SetDestinationPort',
|
||||
'void',
|
||||
[param('uint16_t', 'port')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetSequenceNumber(SequenceNumber sequenceNumber) [member function]
|
||||
cls.add_method('SetSequenceNumber',
|
||||
'void',
|
||||
[param('SequenceNumber', 'sequenceNumber')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetAckNumber(SequenceNumber ackNumber) [member function]
|
||||
cls.add_method('SetAckNumber',
|
||||
'void',
|
||||
[param('SequenceNumber', 'ackNumber')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetLength(uint8_t length) [member function]
|
||||
cls.add_method('SetLength',
|
||||
'void',
|
||||
[param('uint8_t', 'length')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetFlags(uint8_t flags) [member function]
|
||||
cls.add_method('SetFlags',
|
||||
'void',
|
||||
[param('uint8_t', 'flags')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetWindowSize(uint16_t windowSize) [member function]
|
||||
cls.add_method('SetWindowSize',
|
||||
'void',
|
||||
[param('uint16_t', 'windowSize')])
|
||||
## tcp-header.h: void ns3::TcpHeader::SetUrgentPointer(uint16_t urgentPointer) [member function]
|
||||
cls.add_method('SetUrgentPointer',
|
||||
'void',
|
||||
[param('uint16_t', 'urgentPointer')])
|
||||
## tcp-header.h: uint16_t ns3::TcpHeader::GetSourcePort() const [member function]
|
||||
cls.add_method('GetSourcePort',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: uint16_t ns3::TcpHeader::GetDestinationPort() const [member function]
|
||||
cls.add_method('GetDestinationPort',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: SequenceNumber ns3::TcpHeader::GetSequenceNumber() const [member function]
|
||||
cls.add_method('GetSequenceNumber',
|
||||
'SequenceNumber',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: SequenceNumber ns3::TcpHeader::GetAckNumber() const [member function]
|
||||
cls.add_method('GetAckNumber',
|
||||
'SequenceNumber',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: uint8_t ns3::TcpHeader::GetLength() const [member function]
|
||||
cls.add_method('GetLength',
|
||||
'uint8_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: uint8_t ns3::TcpHeader::GetFlags() const [member function]
|
||||
cls.add_method('GetFlags',
|
||||
'uint8_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: uint16_t ns3::TcpHeader::GetWindowSize() const [member function]
|
||||
cls.add_method('GetWindowSize',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: uint16_t ns3::TcpHeader::GetUrgentPointer() const [member function]
|
||||
cls.add_method('GetUrgentPointer',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## tcp-header.h: void ns3::TcpHeader::InitializeChecksum(ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol) [member function]
|
||||
cls.add_method('InitializeChecksum',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol')])
|
||||
## tcp-header.h: static ns3::TypeId ns3::TcpHeader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## tcp-header.h: ns3::TypeId ns3::TcpHeader::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## tcp-header.h: void ns3::TcpHeader::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True, is_virtual=True)
|
||||
## tcp-header.h: uint32_t ns3::TcpHeader::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## tcp-header.h: void ns3::TcpHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True, is_virtual=True)
|
||||
## tcp-header.h: uint32_t ns3::TcpHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_virtual=True)
|
||||
## tcp-header.h: bool ns3::TcpHeader::IsChecksumOk() const [member function]
|
||||
cls.add_method('IsChecksumOk',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3UdpHeader_methods(root_module, cls):
|
||||
## udp-header.h: ns3::UdpHeader::UdpHeader(ns3::UdpHeader const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::UdpHeader const &', 'arg0')])
|
||||
## udp-header.h: ns3::UdpHeader::UdpHeader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## udp-header.h: void ns3::UdpHeader::EnableChecksums() [member function]
|
||||
cls.add_method('EnableChecksums',
|
||||
'void',
|
||||
[])
|
||||
## udp-header.h: void ns3::UdpHeader::SetDestinationPort(uint16_t port) [member function]
|
||||
cls.add_method('SetDestinationPort',
|
||||
'void',
|
||||
[param('uint16_t', 'port')])
|
||||
## udp-header.h: void ns3::UdpHeader::SetSourcePort(uint16_t port) [member function]
|
||||
cls.add_method('SetSourcePort',
|
||||
'void',
|
||||
[param('uint16_t', 'port')])
|
||||
## udp-header.h: uint16_t ns3::UdpHeader::GetSourcePort() const [member function]
|
||||
cls.add_method('GetSourcePort',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## udp-header.h: uint16_t ns3::UdpHeader::GetDestinationPort() const [member function]
|
||||
cls.add_method('GetDestinationPort',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## udp-header.h: void ns3::UdpHeader::InitializeChecksum(ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol) [member function]
|
||||
cls.add_method('InitializeChecksum',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol')])
|
||||
## udp-header.h: static ns3::TypeId ns3::UdpHeader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## udp-header.h: ns3::TypeId ns3::UdpHeader::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## udp-header.h: void ns3::UdpHeader::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True, is_virtual=True)
|
||||
## udp-header.h: uint32_t ns3::UdpHeader::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## udp-header.h: void ns3::UdpHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True, is_virtual=True)
|
||||
## udp-header.h: uint32_t ns3::UdpHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_virtual=True)
|
||||
## udp-header.h: bool ns3::UdpHeader::IsChecksumOk() const [member function]
|
||||
cls.add_method('IsChecksumOk',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4Interface_methods(root_module, cls):
|
||||
## ipv4-interface.h: ns3::Ipv4Interface::Ipv4Interface(ns3::Ipv4Interface const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4Interface const &', 'arg0')])
|
||||
## ipv4-interface.h: static ns3::TypeId ns3::Ipv4Interface::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-interface.h: ns3::Ipv4Interface::Ipv4Interface() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-interface.h: ns3::Ptr<ns3::NetDevice> ns3::Ipv4Interface::GetDevice() const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SetAddress(ns3::Ipv4Address a) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'a')])
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SetNetworkMask(ns3::Ipv4Mask mask) [member function]
|
||||
cls.add_method('SetNetworkMask',
|
||||
'void',
|
||||
[param('ns3::Ipv4Mask', 'mask')])
|
||||
## ipv4-interface.h: ns3::Ipv4Address ns3::Ipv4Interface::GetBroadcast() const [member function]
|
||||
cls.add_method('GetBroadcast',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: ns3::Ipv4Mask ns3::Ipv4Interface::GetNetworkMask() const [member function]
|
||||
cls.add_method('GetNetworkMask',
|
||||
'ns3::Ipv4Mask',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SetMetric(uint16_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint16_t', 'metric')])
|
||||
## ipv4-interface.h: uint16_t ns3::Ipv4Interface::GetMetric() const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: ns3::Ipv4Address ns3::Ipv4Interface::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: uint16_t ns3::Ipv4Interface::GetMtu() const [member function]
|
||||
cls.add_method('GetMtu',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: bool ns3::Ipv4Interface::IsUp() const [member function]
|
||||
cls.add_method('IsUp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: bool ns3::Ipv4Interface::IsDown() const [member function]
|
||||
cls.add_method('IsDown',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SetUp() [member function]
|
||||
cls.add_method('SetUp',
|
||||
'void',
|
||||
[])
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SetDown() [member function]
|
||||
cls.add_method('SetDown',
|
||||
'void',
|
||||
[])
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::Send(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
|
||||
cls.add_method('Send',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')])
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## ipv4-interface.h: void ns3::Ipv4Interface::SendTo(ns3::Ptr<ns3::Packet> p, ns3::Ipv4Address dest) [member function]
|
||||
cls.add_method('SendTo',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ipv4Address', 'dest')],
|
||||
is_pure_virtual=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4L3Protocol_methods(root_module, cls):
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::PROT_NUMBER [variable]
|
||||
cls.add_static_attribute('PROT_NUMBER', 'uint16_t const', is_const=True)
|
||||
## ipv4-l3-protocol.h: static ns3::TypeId ns3::Ipv4L3Protocol::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4L3Protocol::Ipv4L3Protocol() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Insert(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
|
||||
cls.add_method('Insert',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
|
||||
## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4L4Protocol> ns3::Ipv4L3Protocol::GetProtocol(int protocolNumber) const [member function]
|
||||
cls.add_method('GetProtocol',
|
||||
'ns3::Ptr< ns3::Ipv4L4Protocol >',
|
||||
[param('int', 'protocolNumber')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Remove(ns3::Ptr<ns3::Ipv4L4Protocol> protocol) [member function]
|
||||
cls.add_method('Remove',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4L4Protocol >', 'protocol')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultTtl(uint8_t ttl) [member function]
|
||||
cls.add_method('SetDefaultTtl',
|
||||
'void',
|
||||
[param('uint8_t', 'ttl')])
|
||||
## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4Interface> ns3::Ipv4L3Protocol::FindInterfaceForDevice(ns3::Ptr<const ns3::NetDevice> device) [member function]
|
||||
cls.add_method('FindInterfaceForDevice',
|
||||
'ns3::Ptr< ns3::Ipv4Interface >',
|
||||
[param('ns3::Ptr< ns3::NetDevice const >', 'device')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Receive(ns3::Ptr<ns3::NetDevice> device, ns3::Ptr<const ns3::Packet> p, uint16_t protocol, ns3::Address const & from, ns3::Address const & to, ns3::NetDevice::PacketType packetType) [member function]
|
||||
cls.add_method('Receive',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::Packet const >', 'p'), param('uint16_t', 'protocol'), param('ns3::Address const &', 'from'), param('ns3::Address const &', 'to'), param('ns3::NetDevice::PacketType', 'packetType')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Send(ns3::Ptr<ns3::Packet> packet, ns3::Ipv4Address source, ns3::Ipv4Address destination, uint8_t protocol) [member function]
|
||||
cls.add_method('Send',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Ipv4Address', 'source'), param('ns3::Ipv4Address', 'destination'), param('uint8_t', 'protocol')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('SetDefaultRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::Lookup(ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty> routeReply) [member function]
|
||||
cls.add_method('Lookup',
|
||||
'void',
|
||||
[param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty >', 'routeReply')])
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNRoutes() [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4Route * ns3::Ipv4L3Protocol::GetRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4Route *',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
|
||||
cls.add_method('AddMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDefaultMulticastRoute(uint32_t onputInterface) [member function]
|
||||
cls.add_method('SetDefaultMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'onputInterface')])
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNMulticastRoutes() const [member function]
|
||||
cls.add_method('GetNMulticastRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4MulticastRoute * ns3::Ipv4L3Protocol::GetMulticastRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetMulticastRoute',
|
||||
'ns3::Ipv4MulticastRoute *',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
|
||||
cls.add_method('RemoveMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::RemoveMulticastRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::AddInterface(ns3::Ptr<ns3::NetDevice> device) [member function]
|
||||
cls.add_method('AddInterface',
|
||||
'uint32_t',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
|
||||
## ipv4-l3-protocol.h: ns3::Ptr<ns3::Ipv4Interface> ns3::Ipv4L3Protocol::GetInterface(uint32_t i) const [member function]
|
||||
cls.add_method('GetInterface',
|
||||
'ns3::Ptr< ns3::Ipv4Interface >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::GetNInterfaces() const [member function]
|
||||
cls.add_method('GetNInterfaces',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::FindInterfaceForAddr(ns3::Ipv4Address addr) const [member function]
|
||||
cls.add_method('FindInterfaceForAddr',
|
||||
'uint32_t',
|
||||
[param('ns3::Ipv4Address', 'addr')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: uint32_t ns3::Ipv4L3Protocol::FindInterfaceForAddr(ns3::Ipv4Address addr, ns3::Ipv4Mask mask) const [member function]
|
||||
cls.add_method('FindInterfaceForAddr',
|
||||
'uint32_t',
|
||||
[param('ns3::Ipv4Address', 'addr'), param('ns3::Ipv4Mask', 'mask')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: int32_t ns3::Ipv4L3Protocol::FindInterfaceIndexForDevice(ns3::Ptr<ns3::NetDevice> device) const [member function]
|
||||
cls.add_method('FindInterfaceIndexForDevice',
|
||||
'int32_t',
|
||||
[param('ns3::Ptr< ns3::NetDevice >', 'device')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::JoinMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
|
||||
cls.add_method('JoinMulticastGroup',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::LeaveMulticastGroup(ns3::Ipv4Address origin, ns3::Ipv4Address group) [member function]
|
||||
cls.add_method('LeaveMulticastGroup',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetAddress(uint32_t i, ns3::Ipv4Address address) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
[param('uint32_t', 'i'), param('ns3::Ipv4Address', 'address')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetNetworkMask(uint32_t i, ns3::Ipv4Mask mask) [member function]
|
||||
cls.add_method('SetNetworkMask',
|
||||
'void',
|
||||
[param('uint32_t', 'i'), param('ns3::Ipv4Mask', 'mask')])
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4Mask ns3::Ipv4L3Protocol::GetNetworkMask(uint32_t t) const [member function]
|
||||
cls.add_method('GetNetworkMask',
|
||||
'ns3::Ipv4Mask',
|
||||
[param('uint32_t', 't')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: ns3::Ipv4Address ns3::Ipv4L3Protocol::GetAddress(uint32_t i) const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Ipv4Address',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetMetric(uint32_t i, uint16_t metric) [member function]
|
||||
cls.add_method('SetMetric',
|
||||
'void',
|
||||
[param('uint32_t', 'i'), param('uint16_t', 'metric')])
|
||||
## ipv4-l3-protocol.h: uint16_t ns3::Ipv4L3Protocol::GetMetric(uint32_t i) const [member function]
|
||||
cls.add_method('GetMetric',
|
||||
'uint16_t',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: bool ns3::Ipv4L3Protocol::GetIfIndexForDestination(ns3::Ipv4Address destination, uint32_t & ifIndex) const [member function]
|
||||
cls.add_method('GetIfIndexForDestination',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'ifIndex')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: uint16_t ns3::Ipv4L3Protocol::GetMtu(uint32_t i) const [member function]
|
||||
cls.add_method('GetMtu',
|
||||
'uint16_t',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: bool ns3::Ipv4L3Protocol::IsUp(uint32_t i) const [member function]
|
||||
cls.add_method('IsUp',
|
||||
'bool',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetUp(uint32_t i) [member function]
|
||||
cls.add_method('SetUp',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::SetDown(uint32_t i) [member function]
|
||||
cls.add_method('SetDown',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::AddRoutingProtocol(ns3::Ptr<ns3::Ipv4RoutingProtocol> routingProtocol, int priority) [member function]
|
||||
cls.add_method('AddRoutingProtocol',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Ipv4RoutingProtocol >', 'routingProtocol'), param('int', 'priority')])
|
||||
## ipv4-l3-protocol.h: void ns3::Ipv4L3Protocol::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3Ipv4StaticRouting_methods(root_module, cls):
|
||||
## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting(ns3::Ipv4StaticRouting const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Ipv4StaticRouting const &', 'arg0')])
|
||||
## ipv4-static-routing.h: ns3::Ipv4StaticRouting::Ipv4StaticRouting() [constructor]
|
||||
cls.add_constructor([])
|
||||
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RequestRoute(uint32_t ifIndex, ns3::Ipv4Header const & ipHeader, ns3::Ptr<ns3::Packet> packet, ns3::Callback<void,bool,const ns3::Ipv4Route&,ns3::Ptr<ns3::Packet>,const ns3::Ipv4Header&,ns3::empty,ns3::empty> routeReply) [member function]
|
||||
cls.add_method('RequestRoute',
|
||||
'bool',
|
||||
[param('uint32_t', 'ifIndex'), param('ns3::Ipv4Header const &', 'ipHeader'), param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Callback< void, bool, ns3::Ipv4Route const &, ns3::Ptr< ns3::Packet >, ns3::Ipv4Header const &, ns3::empty, ns3::empty >', 'routeReply')],
|
||||
is_virtual=True)
|
||||
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RequestIfIndex(ns3::Ipv4Address destination, uint32_t & ifIndex) [member function]
|
||||
cls.add_method('RequestIfIndex',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'destination'), param('uint32_t &', 'ifIndex')],
|
||||
is_virtual=True)
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddHostRouteTo(ns3::Ipv4Address dest, uint32_t interface) [member function]
|
||||
cls.add_method('AddHostRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'dest'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddNetworkRouteTo(ns3::Ipv4Address network, ns3::Ipv4Mask networkMask, uint32_t interface) [member function]
|
||||
cls.add_method('AddNetworkRouteTo',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'network'), param('ns3::Ipv4Mask', 'networkMask'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultRoute(ns3::Ipv4Address nextHop, uint32_t interface) [member function]
|
||||
cls.add_method('SetDefaultRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'nextHop'), param('uint32_t', 'interface')])
|
||||
## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNRoutes() [member function]
|
||||
cls.add_method('GetNRoutes',
|
||||
'uint32_t',
|
||||
[])
|
||||
## ipv4-static-routing.h: ns3::Ipv4Route * ns3::Ipv4StaticRouting::GetDefaultRoute() [member function]
|
||||
cls.add_method('GetDefaultRoute',
|
||||
'ns3::Ipv4Route *',
|
||||
[])
|
||||
## ipv4-static-routing.h: ns3::Ipv4Route * ns3::Ipv4StaticRouting::GetRoute(uint32_t i) [member function]
|
||||
cls.add_method('GetRoute',
|
||||
'ns3::Ipv4Route *',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveRoute(uint32_t i) [member function]
|
||||
cls.add_method('RemoveRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'i')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::AddMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface, std::vector<unsigned int, std::allocator<unsigned int> > outputInterfaces) [member function]
|
||||
cls.add_method('AddMulticastRoute',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface'), param('std::vector< unsigned int >', 'outputInterfaces')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface) [member function]
|
||||
cls.add_method('SetDefaultMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'outputInterface')])
|
||||
## ipv4-static-routing.h: uint32_t ns3::Ipv4StaticRouting::GetNMulticastRoutes() const [member function]
|
||||
cls.add_method('GetNMulticastRoutes',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-static-routing.h: ns3::Ipv4MulticastRoute * ns3::Ipv4StaticRouting::GetMulticastRoute(uint32_t i) const [member function]
|
||||
cls.add_method('GetMulticastRoute',
|
||||
'ns3::Ipv4MulticastRoute *',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## ipv4-static-routing.h: ns3::Ipv4MulticastRoute * ns3::Ipv4StaticRouting::GetDefaultMulticastRoute() const [member function]
|
||||
cls.add_method('GetDefaultMulticastRoute',
|
||||
'ns3::Ipv4MulticastRoute *',
|
||||
[],
|
||||
is_const=True)
|
||||
## ipv4-static-routing.h: bool ns3::Ipv4StaticRouting::RemoveMulticastRoute(ns3::Ipv4Address origin, ns3::Ipv4Address group, uint32_t inputInterface) [member function]
|
||||
cls.add_method('RemoveMulticastRoute',
|
||||
'bool',
|
||||
[param('ns3::Ipv4Address', 'origin'), param('ns3::Ipv4Address', 'group'), param('uint32_t', 'inputInterface')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::RemoveMulticastRoute(uint32_t index) [member function]
|
||||
cls.add_method('RemoveMulticastRoute',
|
||||
'void',
|
||||
[param('uint32_t', 'index')])
|
||||
## ipv4-static-routing.h: void ns3::Ipv4StaticRouting::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
## internet-stack.h: extern void ns3::AddInternetStack(ns3::Ptr<ns3::Node> node) [free function]
|
||||
module.add_function('AddInternetStack',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')])
|
||||
## internet-stack.h: extern void ns3::AddNscInternetStack(ns3::Ptr<ns3::Node> node, std::string const & soname) [free function]
|
||||
module.add_function('AddNscInternetStack',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node'), param('std::string const &', 'soname')])
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
724
bindings/python/ns3_module_mobility.py
Normal file
724
bindings/python/ns3_module_mobility.py
Normal file
@@ -0,0 +1,724 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## rectangle.h: ns3::Rectangle [class]
|
||||
module.add_class('Rectangle')
|
||||
## rectangle.h: ns3::Rectangle::Side [enumeration]
|
||||
module.add_enum('Side', ['RIGHT', 'LEFT', 'TOP', 'BOTTOM'], outer_class=root_module['ns3::Rectangle'])
|
||||
## static-speed-helper.h: ns3::StaticSpeedHelper [class]
|
||||
module.add_class('StaticSpeedHelper', allow_subclassing=False)
|
||||
## vector.h: ns3::Vector [class]
|
||||
module.add_class('Vector')
|
||||
## position-allocator.h: ns3::PositionAllocator [class]
|
||||
module.add_class('PositionAllocator', parent=root_module['ns3::Object'])
|
||||
## position-allocator.h: ns3::RandomDiscPositionAllocator [class]
|
||||
module.add_class('RandomDiscPositionAllocator', parent=root_module['ns3::PositionAllocator'])
|
||||
## position-allocator.h: ns3::RandomRectanglePositionAllocator [class]
|
||||
module.add_class('RandomRectanglePositionAllocator', parent=root_module['ns3::PositionAllocator'])
|
||||
## rectangle.h: ns3::RectangleChecker [class]
|
||||
module.add_class('RectangleChecker', parent=root_module['ns3::AttributeChecker'])
|
||||
## rectangle.h: ns3::RectangleValue [class]
|
||||
module.add_class('RectangleValue', parent=root_module['ns3::AttributeValue'])
|
||||
## vector.h: ns3::VectorChecker [class]
|
||||
module.add_class('VectorChecker', parent=root_module['ns3::AttributeChecker'])
|
||||
## vector.h: ns3::VectorValue [class]
|
||||
module.add_class('VectorValue', parent=root_module['ns3::AttributeValue'])
|
||||
## position-allocator.h: ns3::GridPositionAllocator [class]
|
||||
module.add_class('GridPositionAllocator', parent=root_module['ns3::PositionAllocator'])
|
||||
## position-allocator.h: ns3::GridPositionAllocator::LayoutType [enumeration]
|
||||
module.add_enum('LayoutType', ['ROW_FIRST', 'COLUMN_FIRST'], outer_class=root_module['ns3::GridPositionAllocator'])
|
||||
## position-allocator.h: ns3::ListPositionAllocator [class]
|
||||
module.add_class('ListPositionAllocator', parent=root_module['ns3::PositionAllocator'])
|
||||
## mobility-model.h: ns3::MobilityModel [class]
|
||||
module.add_class('MobilityModel', parent=root_module['ns3::Object'])
|
||||
## random-direction-2d-mobility-model.h: ns3::RandomDirection2dMobilityModel [class]
|
||||
module.add_class('RandomDirection2dMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## random-walk-2d-mobility-model.h: ns3::RandomWalk2dMobilityModel [class]
|
||||
module.add_class('RandomWalk2dMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## random-walk-2d-mobility-model.h: ns3::RandomWalk2dMobilityModel::Mode [enumeration]
|
||||
module.add_enum('Mode', ['MODE_DISTANCE', 'MODE_TIME'], outer_class=root_module['ns3::RandomWalk2dMobilityModel'])
|
||||
## random-waypoint-mobility-model.h: ns3::RandomWaypointMobilityModel [class]
|
||||
module.add_class('RandomWaypointMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## static-mobility-model.h: ns3::StaticMobilityModel [class]
|
||||
module.add_class('StaticMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## static-speed-mobility-model.h: ns3::StaticSpeedMobilityModel [class]
|
||||
module.add_class('StaticSpeedMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
## hierarchical-mobility-model.h: ns3::HierarchicalMobilityModel [class]
|
||||
module.add_class('HierarchicalMobilityModel', parent=root_module['ns3::MobilityModel'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3Rectangle_methods(root_module, root_module['ns3::Rectangle'])
|
||||
register_Ns3StaticSpeedHelper_methods(root_module, root_module['ns3::StaticSpeedHelper'])
|
||||
register_Ns3Vector_methods(root_module, root_module['ns3::Vector'])
|
||||
register_Ns3PositionAllocator_methods(root_module, root_module['ns3::PositionAllocator'])
|
||||
register_Ns3RandomDiscPositionAllocator_methods(root_module, root_module['ns3::RandomDiscPositionAllocator'])
|
||||
register_Ns3RandomRectanglePositionAllocator_methods(root_module, root_module['ns3::RandomRectanglePositionAllocator'])
|
||||
register_Ns3RectangleChecker_methods(root_module, root_module['ns3::RectangleChecker'])
|
||||
register_Ns3RectangleValue_methods(root_module, root_module['ns3::RectangleValue'])
|
||||
register_Ns3VectorChecker_methods(root_module, root_module['ns3::VectorChecker'])
|
||||
register_Ns3VectorValue_methods(root_module, root_module['ns3::VectorValue'])
|
||||
register_Ns3GridPositionAllocator_methods(root_module, root_module['ns3::GridPositionAllocator'])
|
||||
register_Ns3ListPositionAllocator_methods(root_module, root_module['ns3::ListPositionAllocator'])
|
||||
register_Ns3MobilityModel_methods(root_module, root_module['ns3::MobilityModel'])
|
||||
register_Ns3RandomDirection2dMobilityModel_methods(root_module, root_module['ns3::RandomDirection2dMobilityModel'])
|
||||
register_Ns3RandomWalk2dMobilityModel_methods(root_module, root_module['ns3::RandomWalk2dMobilityModel'])
|
||||
register_Ns3RandomWaypointMobilityModel_methods(root_module, root_module['ns3::RandomWaypointMobilityModel'])
|
||||
register_Ns3StaticMobilityModel_methods(root_module, root_module['ns3::StaticMobilityModel'])
|
||||
register_Ns3StaticSpeedMobilityModel_methods(root_module, root_module['ns3::StaticSpeedMobilityModel'])
|
||||
register_Ns3HierarchicalMobilityModel_methods(root_module, root_module['ns3::HierarchicalMobilityModel'])
|
||||
return
|
||||
|
||||
def register_Ns3Rectangle_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## rectangle.h: ns3::Rectangle::Rectangle(ns3::Rectangle const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Rectangle const &', 'arg0')])
|
||||
## rectangle.h: ns3::Rectangle::Rectangle(double _xMin, double _xMax, double _yMin, double _yMax) [constructor]
|
||||
cls.add_constructor([param('double', '_xMin'), param('double', '_xMax'), param('double', '_yMin'), param('double', '_yMax')])
|
||||
## rectangle.h: ns3::Rectangle::Rectangle() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rectangle.h: ns3::Vector ns3::Rectangle::CalculateIntersection(ns3::Vector const & current, ns3::Vector const & speed) const [member function]
|
||||
cls.add_method('CalculateIntersection',
|
||||
'ns3::Vector',
|
||||
[param('ns3::Vector const &', 'current'), param('ns3::Vector const &', 'speed')],
|
||||
is_const=True)
|
||||
## rectangle.h: ns3::Rectangle::Side ns3::Rectangle::GetClosestSide(ns3::Vector const & position) const [member function]
|
||||
cls.add_method('GetClosestSide',
|
||||
'ns3::Rectangle::Side',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
is_const=True)
|
||||
## rectangle.h: bool ns3::Rectangle::IsInside(ns3::Vector const & position) const [member function]
|
||||
cls.add_method('IsInside',
|
||||
'bool',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
is_const=True)
|
||||
## rectangle.h: ns3::Rectangle::xMax [variable]
|
||||
cls.add_instance_attribute('xMax', 'double', is_const=False)
|
||||
## rectangle.h: ns3::Rectangle::xMin [variable]
|
||||
cls.add_instance_attribute('xMin', 'double', is_const=False)
|
||||
## rectangle.h: ns3::Rectangle::yMax [variable]
|
||||
cls.add_instance_attribute('yMax', 'double', is_const=False)
|
||||
## rectangle.h: ns3::Rectangle::yMin [variable]
|
||||
cls.add_instance_attribute('yMin', 'double', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3StaticSpeedHelper_methods(root_module, cls):
|
||||
## static-speed-helper.h: ns3::StaticSpeedHelper::StaticSpeedHelper(ns3::StaticSpeedHelper const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::StaticSpeedHelper const &', 'arg0')])
|
||||
## static-speed-helper.h: ns3::StaticSpeedHelper::StaticSpeedHelper() [constructor]
|
||||
cls.add_constructor([])
|
||||
## static-speed-helper.h: ns3::StaticSpeedHelper::StaticSpeedHelper(ns3::Vector const & position) [constructor]
|
||||
cls.add_constructor([param('ns3::Vector const &', 'position')])
|
||||
## static-speed-helper.h: ns3::StaticSpeedHelper::StaticSpeedHelper(ns3::Vector const & position, ns3::Vector const & vel) [constructor]
|
||||
cls.add_constructor([param('ns3::Vector const &', 'position'), param('ns3::Vector const &', 'vel')])
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::SetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('SetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')])
|
||||
## static-speed-helper.h: ns3::Vector ns3::StaticSpeedHelper::GetCurrentPosition() const [member function]
|
||||
cls.add_method('GetCurrentPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True)
|
||||
## static-speed-helper.h: ns3::Vector ns3::StaticSpeedHelper::GetVelocity() const [member function]
|
||||
cls.add_method('GetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True)
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::SetVelocity(ns3::Vector const & vel) [member function]
|
||||
cls.add_method('SetVelocity',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'vel')])
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::Pause() [member function]
|
||||
cls.add_method('Pause',
|
||||
'void',
|
||||
[])
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::Unpause() [member function]
|
||||
cls.add_method('Unpause',
|
||||
'void',
|
||||
[])
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::UpdateWithBounds(ns3::Rectangle const & rectangle) const [member function]
|
||||
cls.add_method('UpdateWithBounds',
|
||||
'void',
|
||||
[param('ns3::Rectangle const &', 'rectangle')],
|
||||
is_const=True)
|
||||
## static-speed-helper.h: void ns3::StaticSpeedHelper::Update() const [member function]
|
||||
cls.add_method('Update',
|
||||
'void',
|
||||
[],
|
||||
is_const=True)
|
||||
return
|
||||
|
||||
def register_Ns3Vector_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## vector.h: ns3::Vector::Vector(ns3::Vector const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::Vector const &', 'arg0')])
|
||||
## vector.h: ns3::Vector::Vector(double _x, double _y, double _z) [constructor]
|
||||
cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')])
|
||||
## vector.h: ns3::Vector::Vector() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h: ns3::Vector::x [variable]
|
||||
cls.add_instance_attribute('x', 'double', is_const=False)
|
||||
## vector.h: ns3::Vector::y [variable]
|
||||
cls.add_instance_attribute('y', 'double', is_const=False)
|
||||
## vector.h: ns3::Vector::z [variable]
|
||||
cls.add_instance_attribute('z', 'double', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3PositionAllocator_methods(root_module, cls):
|
||||
## position-allocator.h: ns3::PositionAllocator::PositionAllocator(ns3::PositionAllocator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PositionAllocator const &', 'arg0')])
|
||||
## position-allocator.h: static ns3::TypeId ns3::PositionAllocator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## position-allocator.h: ns3::PositionAllocator::PositionAllocator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## position-allocator.h: ns3::Vector ns3::PositionAllocator::GetNext() const [member function]
|
||||
cls.add_method('GetNext',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RandomDiscPositionAllocator_methods(root_module, cls):
|
||||
## position-allocator.h: ns3::RandomDiscPositionAllocator::RandomDiscPositionAllocator(ns3::RandomDiscPositionAllocator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RandomDiscPositionAllocator const &', 'arg0')])
|
||||
## position-allocator.h: static ns3::TypeId ns3::RandomDiscPositionAllocator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## position-allocator.h: ns3::RandomDiscPositionAllocator::RandomDiscPositionAllocator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## position-allocator.h: void ns3::RandomDiscPositionAllocator::SetTheta(ns3::RandomVariable theta) [member function]
|
||||
cls.add_method('SetTheta',
|
||||
'void',
|
||||
[param('ns3::RandomVariable', 'theta')])
|
||||
## position-allocator.h: void ns3::RandomDiscPositionAllocator::SetRho(ns3::RandomVariable rho) [member function]
|
||||
cls.add_method('SetRho',
|
||||
'void',
|
||||
[param('ns3::RandomVariable', 'rho')])
|
||||
## position-allocator.h: void ns3::RandomDiscPositionAllocator::SetX(double x) [member function]
|
||||
cls.add_method('SetX',
|
||||
'void',
|
||||
[param('double', 'x')])
|
||||
## position-allocator.h: void ns3::RandomDiscPositionAllocator::SetY(double y) [member function]
|
||||
cls.add_method('SetY',
|
||||
'void',
|
||||
[param('double', 'y')])
|
||||
## position-allocator.h: ns3::Vector ns3::RandomDiscPositionAllocator::GetNext() const [member function]
|
||||
cls.add_method('GetNext',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RandomRectanglePositionAllocator_methods(root_module, cls):
|
||||
## position-allocator.h: ns3::RandomRectanglePositionAllocator::RandomRectanglePositionAllocator(ns3::RandomRectanglePositionAllocator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RandomRectanglePositionAllocator const &', 'arg0')])
|
||||
## position-allocator.h: static ns3::TypeId ns3::RandomRectanglePositionAllocator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## position-allocator.h: ns3::RandomRectanglePositionAllocator::RandomRectanglePositionAllocator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## position-allocator.h: void ns3::RandomRectanglePositionAllocator::SetX(ns3::RandomVariable x) [member function]
|
||||
cls.add_method('SetX',
|
||||
'void',
|
||||
[param('ns3::RandomVariable', 'x')])
|
||||
## position-allocator.h: void ns3::RandomRectanglePositionAllocator::SetY(ns3::RandomVariable y) [member function]
|
||||
cls.add_method('SetY',
|
||||
'void',
|
||||
[param('ns3::RandomVariable', 'y')])
|
||||
## position-allocator.h: ns3::Vector ns3::RandomRectanglePositionAllocator::GetNext() const [member function]
|
||||
cls.add_method('GetNext',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RectangleChecker_methods(root_module, cls):
|
||||
## rectangle.h: ns3::RectangleChecker::RectangleChecker(ns3::RectangleChecker const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RectangleChecker const &', 'arg0')])
|
||||
## rectangle.h: ns3::RectangleChecker::RectangleChecker() [constructor]
|
||||
cls.add_constructor([])
|
||||
return
|
||||
|
||||
def register_Ns3RectangleValue_methods(root_module, cls):
|
||||
## rectangle.h: ns3::RectangleValue::RectangleValue(ns3::RectangleValue const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RectangleValue const &', 'arg0')])
|
||||
## rectangle.h: ns3::RectangleValue::RectangleValue() [constructor]
|
||||
cls.add_constructor([])
|
||||
## rectangle.h: ns3::RectangleValue::RectangleValue(ns3::Rectangle const & value) [constructor]
|
||||
cls.add_constructor([param('ns3::Rectangle const &', 'value')])
|
||||
## rectangle.h: void ns3::RectangleValue::Set(ns3::Rectangle const & value) [member function]
|
||||
cls.add_method('Set',
|
||||
'void',
|
||||
[param('ns3::Rectangle const &', 'value')])
|
||||
## rectangle.h: ns3::Rectangle ns3::RectangleValue::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'ns3::Rectangle',
|
||||
[],
|
||||
is_const=True)
|
||||
## rectangle.h: ns3::Ptr<ns3::AttributeValue> ns3::RectangleValue::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::AttributeValue >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## rectangle.h: std::string ns3::RectangleValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
|
||||
cls.add_method('SerializeToString',
|
||||
'std::string',
|
||||
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
|
||||
is_const=True, is_virtual=True)
|
||||
## rectangle.h: bool ns3::RectangleValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
|
||||
cls.add_method('DeserializeFromString',
|
||||
'bool',
|
||||
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3VectorChecker_methods(root_module, cls):
|
||||
## vector.h: ns3::VectorChecker::VectorChecker(ns3::VectorChecker const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::VectorChecker const &', 'arg0')])
|
||||
## vector.h: ns3::VectorChecker::VectorChecker() [constructor]
|
||||
cls.add_constructor([])
|
||||
return
|
||||
|
||||
def register_Ns3VectorValue_methods(root_module, cls):
|
||||
## vector.h: ns3::VectorValue::VectorValue(ns3::VectorValue const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::VectorValue const &', 'arg0')])
|
||||
## vector.h: ns3::VectorValue::VectorValue() [constructor]
|
||||
cls.add_constructor([])
|
||||
## vector.h: ns3::VectorValue::VectorValue(ns3::Vector const & value) [constructor]
|
||||
cls.add_constructor([param('ns3::Vector const &', 'value')])
|
||||
## vector.h: void ns3::VectorValue::Set(ns3::Vector const & value) [member function]
|
||||
cls.add_method('Set',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'value')])
|
||||
## vector.h: ns3::Vector ns3::VectorValue::Get() const [member function]
|
||||
cls.add_method('Get',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True)
|
||||
## vector.h: ns3::Ptr<ns3::AttributeValue> ns3::VectorValue::Copy() const [member function]
|
||||
cls.add_method('Copy',
|
||||
'ns3::Ptr< ns3::AttributeValue >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## vector.h: std::string ns3::VectorValue::SerializeToString(ns3::Ptr<ns3::AttributeChecker const> checker) const [member function]
|
||||
cls.add_method('SerializeToString',
|
||||
'std::string',
|
||||
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
|
||||
is_const=True, is_virtual=True)
|
||||
## vector.h: bool ns3::VectorValue::DeserializeFromString(std::string value, ns3::Ptr<ns3::AttributeChecker const> checker) [member function]
|
||||
cls.add_method('DeserializeFromString',
|
||||
'bool',
|
||||
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
|
||||
is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3GridPositionAllocator_methods(root_module, cls):
|
||||
## position-allocator.h: ns3::GridPositionAllocator::GridPositionAllocator(ns3::GridPositionAllocator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::GridPositionAllocator const &', 'arg0')])
|
||||
## position-allocator.h: static ns3::TypeId ns3::GridPositionAllocator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## position-allocator.h: ns3::GridPositionAllocator::GridPositionAllocator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetMinX(double xMin) [member function]
|
||||
cls.add_method('SetMinX',
|
||||
'void',
|
||||
[param('double', 'xMin')])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetMinY(double yMin) [member function]
|
||||
cls.add_method('SetMinY',
|
||||
'void',
|
||||
[param('double', 'yMin')])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetDeltaX(double deltaX) [member function]
|
||||
cls.add_method('SetDeltaX',
|
||||
'void',
|
||||
[param('double', 'deltaX')])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetDeltaY(double deltaY) [member function]
|
||||
cls.add_method('SetDeltaY',
|
||||
'void',
|
||||
[param('double', 'deltaY')])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetN(uint32_t n) [member function]
|
||||
cls.add_method('SetN',
|
||||
'void',
|
||||
[param('uint32_t', 'n')])
|
||||
## position-allocator.h: void ns3::GridPositionAllocator::SetLayoutType(ns3::GridPositionAllocator::LayoutType layoutType) [member function]
|
||||
cls.add_method('SetLayoutType',
|
||||
'void',
|
||||
[param('ns3::GridPositionAllocator::LayoutType', 'layoutType')])
|
||||
## position-allocator.h: double ns3::GridPositionAllocator::GetMinX() const [member function]
|
||||
cls.add_method('GetMinX',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: double ns3::GridPositionAllocator::GetMinY() const [member function]
|
||||
cls.add_method('GetMinY',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: double ns3::GridPositionAllocator::GetDeltaX() const [member function]
|
||||
cls.add_method('GetDeltaX',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: double ns3::GridPositionAllocator::GetDeltaY() const [member function]
|
||||
cls.add_method('GetDeltaY',
|
||||
'double',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: uint32_t ns3::GridPositionAllocator::GetN() const [member function]
|
||||
cls.add_method('GetN',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: ns3::GridPositionAllocator::LayoutType ns3::GridPositionAllocator::GetLayoutType() const [member function]
|
||||
cls.add_method('GetLayoutType',
|
||||
'ns3::GridPositionAllocator::LayoutType',
|
||||
[],
|
||||
is_const=True)
|
||||
## position-allocator.h: ns3::Vector ns3::GridPositionAllocator::GetNext() const [member function]
|
||||
cls.add_method('GetNext',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3ListPositionAllocator_methods(root_module, cls):
|
||||
## position-allocator.h: ns3::ListPositionAllocator::ListPositionAllocator(ns3::ListPositionAllocator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::ListPositionAllocator const &', 'arg0')])
|
||||
## position-allocator.h: static ns3::TypeId ns3::ListPositionAllocator::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## position-allocator.h: ns3::ListPositionAllocator::ListPositionAllocator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## position-allocator.h: void ns3::ListPositionAllocator::Add(ns3::Vector v) [member function]
|
||||
cls.add_method('Add',
|
||||
'void',
|
||||
[param('ns3::Vector', 'v')])
|
||||
## position-allocator.h: ns3::Vector ns3::ListPositionAllocator::GetNext() const [member function]
|
||||
cls.add_method('GetNext',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3MobilityModel_methods(root_module, cls):
|
||||
## mobility-model.h: ns3::MobilityModel::MobilityModel(ns3::MobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::MobilityModel const &', 'arg0')])
|
||||
## mobility-model.h: static ns3::TypeId ns3::MobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## mobility-model.h: ns3::MobilityModel::MobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## mobility-model.h: ns3::Vector ns3::MobilityModel::GetPosition() const [member function]
|
||||
cls.add_method('GetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True)
|
||||
## mobility-model.h: void ns3::MobilityModel::SetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('SetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')])
|
||||
## mobility-model.h: ns3::Vector ns3::MobilityModel::GetVelocity() const [member function]
|
||||
cls.add_method('GetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True)
|
||||
## mobility-model.h: double ns3::MobilityModel::GetDistanceFrom(ns3::Ptr<const ns3::MobilityModel> position) const [member function]
|
||||
cls.add_method('GetDistanceFrom',
|
||||
'double',
|
||||
[param('ns3::Ptr< ns3::MobilityModel const >', 'position')],
|
||||
is_const=True)
|
||||
## mobility-model.h: void ns3::MobilityModel::NotifyCourseChange() const [member function]
|
||||
cls.add_method('NotifyCourseChange',
|
||||
'void',
|
||||
[],
|
||||
is_const=True, visibility='protected')
|
||||
## mobility-model.h: ns3::Vector ns3::MobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
|
||||
## mobility-model.h: void ns3::MobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
is_pure_virtual=True, visibility='private', is_virtual=True)
|
||||
## mobility-model.h: ns3::Vector ns3::MobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RandomDirection2dMobilityModel_methods(root_module, cls):
|
||||
## random-direction-2d-mobility-model.h: ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel(ns3::RandomDirection2dMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RandomDirection2dMobilityModel const &', 'arg0')])
|
||||
## random-direction-2d-mobility-model.h: static ns3::TypeId ns3::RandomDirection2dMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-direction-2d-mobility-model.h: ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-direction-2d-mobility-model.h: void ns3::RandomDirection2dMobilityModel::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## random-direction-2d-mobility-model.h: ns3::Vector ns3::RandomDirection2dMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## random-direction-2d-mobility-model.h: void ns3::RandomDirection2dMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## random-direction-2d-mobility-model.h: ns3::Vector ns3::RandomDirection2dMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RandomWalk2dMobilityModel_methods(root_module, cls):
|
||||
## random-walk-2d-mobility-model.h: ns3::RandomWalk2dMobilityModel::RandomWalk2dMobilityModel(ns3::RandomWalk2dMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RandomWalk2dMobilityModel const &', 'arg0')])
|
||||
## random-walk-2d-mobility-model.h: static ns3::TypeId ns3::RandomWalk2dMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-walk-2d-mobility-model.h: ns3::RandomWalk2dMobilityModel::RandomWalk2dMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-walk-2d-mobility-model.h: void ns3::RandomWalk2dMobilityModel::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## random-walk-2d-mobility-model.h: ns3::Vector ns3::RandomWalk2dMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## random-walk-2d-mobility-model.h: void ns3::RandomWalk2dMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## random-walk-2d-mobility-model.h: ns3::Vector ns3::RandomWalk2dMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3RandomWaypointMobilityModel_methods(root_module, cls):
|
||||
## random-waypoint-mobility-model.h: ns3::RandomWaypointMobilityModel::RandomWaypointMobilityModel(ns3::RandomWaypointMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::RandomWaypointMobilityModel const &', 'arg0')])
|
||||
## random-waypoint-mobility-model.h: static ns3::TypeId ns3::RandomWaypointMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## random-waypoint-mobility-model.h: ns3::RandomWaypointMobilityModel::RandomWaypointMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## random-waypoint-mobility-model.h: ns3::Vector ns3::RandomWaypointMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## random-waypoint-mobility-model.h: void ns3::RandomWaypointMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## random-waypoint-mobility-model.h: ns3::Vector ns3::RandomWaypointMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3StaticMobilityModel_methods(root_module, cls):
|
||||
## static-mobility-model.h: ns3::StaticMobilityModel::StaticMobilityModel(ns3::StaticMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::StaticMobilityModel const &', 'arg0')])
|
||||
## static-mobility-model.h: static ns3::TypeId ns3::StaticMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## static-mobility-model.h: ns3::StaticMobilityModel::StaticMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## static-mobility-model.h: ns3::Vector ns3::StaticMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## static-mobility-model.h: void ns3::StaticMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## static-mobility-model.h: ns3::Vector ns3::StaticMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3StaticSpeedMobilityModel_methods(root_module, cls):
|
||||
## static-speed-mobility-model.h: ns3::StaticSpeedMobilityModel::StaticSpeedMobilityModel(ns3::StaticSpeedMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::StaticSpeedMobilityModel const &', 'arg0')])
|
||||
## static-speed-mobility-model.h: static ns3::TypeId ns3::StaticSpeedMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## static-speed-mobility-model.h: ns3::StaticSpeedMobilityModel::StaticSpeedMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## static-speed-mobility-model.h: void ns3::StaticSpeedMobilityModel::SetVelocity(ns3::Vector const & speed) [member function]
|
||||
cls.add_method('SetVelocity',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'speed')])
|
||||
## static-speed-mobility-model.h: ns3::Vector ns3::StaticSpeedMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## static-speed-mobility-model.h: void ns3::StaticSpeedMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## static-speed-mobility-model.h: ns3::Vector ns3::StaticSpeedMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3HierarchicalMobilityModel_methods(root_module, cls):
|
||||
## hierarchical-mobility-model.h: ns3::HierarchicalMobilityModel::HierarchicalMobilityModel(ns3::HierarchicalMobilityModel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::HierarchicalMobilityModel const &', 'arg0')])
|
||||
## hierarchical-mobility-model.h: static ns3::TypeId ns3::HierarchicalMobilityModel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## hierarchical-mobility-model.h: ns3::HierarchicalMobilityModel::HierarchicalMobilityModel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## hierarchical-mobility-model.h: ns3::Ptr<ns3::MobilityModel> ns3::HierarchicalMobilityModel::GetChild() const [member function]
|
||||
cls.add_method('GetChild',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[],
|
||||
is_const=True)
|
||||
## hierarchical-mobility-model.h: ns3::Ptr<ns3::MobilityModel> ns3::HierarchicalMobilityModel::GetParent() const [member function]
|
||||
cls.add_method('GetParent',
|
||||
'ns3::Ptr< ns3::MobilityModel >',
|
||||
[],
|
||||
is_const=True)
|
||||
## hierarchical-mobility-model.h: ns3::Vector ns3::HierarchicalMobilityModel::DoGetPosition() const [member function]
|
||||
cls.add_method('DoGetPosition',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
## hierarchical-mobility-model.h: void ns3::HierarchicalMobilityModel::DoSetPosition(ns3::Vector const & position) [member function]
|
||||
cls.add_method('DoSetPosition',
|
||||
'void',
|
||||
[param('ns3::Vector const &', 'position')],
|
||||
visibility='private', is_virtual=True)
|
||||
## hierarchical-mobility-model.h: ns3::Vector ns3::HierarchicalMobilityModel::DoGetVelocity() const [member function]
|
||||
cls.add_method('DoGetVelocity',
|
||||
'ns3::Vector',
|
||||
[],
|
||||
is_const=True, visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
## rectangle.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeRectangleChecker() [free function]
|
||||
module.add_function('MakeRectangleChecker',
|
||||
'ns3::Ptr< ns3::AttributeChecker const >',
|
||||
[])
|
||||
## vector.h: extern double ns3::CalculateDistance(ns3::Vector const & a, ns3::Vector const & b) [free function]
|
||||
module.add_function('CalculateDistance',
|
||||
'double',
|
||||
[param('ns3::Vector const &', 'a'), param('ns3::Vector const &', 'b')])
|
||||
## vector.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeVectorChecker() [free function]
|
||||
module.add_function('MakeVectorChecker',
|
||||
'ns3::Ptr< ns3::AttributeChecker const >',
|
||||
[])
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
2646
bindings/python/ns3_module_node.py
Normal file
2646
bindings/python/ns3_module_node.py
Normal file
File diff suppressed because it is too large
Load Diff
468
bindings/python/ns3_module_olsr.py
Normal file
468
bindings/python/ns3_module_olsr.py
Normal file
@@ -0,0 +1,468 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## olsr-agent.h: ns3::olsr::Agent [class]
|
||||
module.add_class('Agent', parent=root_module['ns3::Object'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader [class]
|
||||
module.add_class('MessageHeader', parent=root_module['ns3::Header'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::MessageType [enumeration]
|
||||
module.add_enum('MessageType', ['HELLO_MESSAGE', 'TC_MESSAGE', 'MID_MESSAGE', 'HNA_MESSAGE'], outer_class=root_module['ns3::olsr::MessageHeader'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello [struct]
|
||||
module.add_class('Hello', outer_class=root_module['ns3::olsr::MessageHeader'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::LinkMessage [struct]
|
||||
module.add_class('LinkMessage', outer_class=root_module['ns3::olsr::MessageHeader::Hello'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna [struct]
|
||||
module.add_class('Hna', outer_class=root_module['ns3::olsr::MessageHeader'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Association [struct]
|
||||
module.add_class('Association', outer_class=root_module['ns3::olsr::MessageHeader::Hna'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid [struct]
|
||||
module.add_class('Mid', outer_class=root_module['ns3::olsr::MessageHeader'])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc [struct]
|
||||
module.add_class('Tc', outer_class=root_module['ns3::olsr::MessageHeader'])
|
||||
## olsr-header.h: ns3::olsr::PacketHeader [class]
|
||||
module.add_class('PacketHeader', parent=root_module['ns3::Header'])
|
||||
module.add_container('std::vector< ns3::olsr::MessageHeader::Hello::LinkMessage >', 'ns3::olsr::MessageHeader::Hello::LinkMessage', container_type='vector')
|
||||
module.add_container('std::vector< ns3::olsr::MessageHeader::Hna::Association >', 'ns3::olsr::MessageHeader::Hna::Association', container_type='vector')
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3OlsrAgent_methods(root_module, root_module['ns3::olsr::Agent'])
|
||||
register_Ns3OlsrMessageHeader_methods(root_module, root_module['ns3::olsr::MessageHeader'])
|
||||
register_Ns3OlsrMessageHeaderHello_methods(root_module, root_module['ns3::olsr::MessageHeader::Hello'])
|
||||
register_Ns3OlsrMessageHeaderHelloLinkMessage_methods(root_module, root_module['ns3::olsr::MessageHeader::Hello::LinkMessage'])
|
||||
register_Ns3OlsrMessageHeaderHna_methods(root_module, root_module['ns3::olsr::MessageHeader::Hna'])
|
||||
register_Ns3OlsrMessageHeaderHnaAssociation_methods(root_module, root_module['ns3::olsr::MessageHeader::Hna::Association'])
|
||||
register_Ns3OlsrMessageHeaderMid_methods(root_module, root_module['ns3::olsr::MessageHeader::Mid'])
|
||||
register_Ns3OlsrMessageHeaderTc_methods(root_module, root_module['ns3::olsr::MessageHeader::Tc'])
|
||||
register_Ns3OlsrPacketHeader_methods(root_module, root_module['ns3::olsr::PacketHeader'])
|
||||
return
|
||||
|
||||
def register_Ns3OlsrAgent_methods(root_module, cls):
|
||||
## olsr-agent.h: ns3::olsr::Agent::Agent(ns3::olsr::Agent const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::Agent const &', 'arg0')])
|
||||
## olsr-agent.h: ns3::olsr::Agent::Agent() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-agent.h: static ns3::TypeId ns3::olsr::Agent::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## olsr-agent.h: void ns3::olsr::Agent::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## olsr-agent.h: void ns3::olsr::Agent::SetMainInterface(uint32_t interface) [member function]
|
||||
cls.add_method('SetMainInterface',
|
||||
'void',
|
||||
[param('uint32_t', 'interface')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## olsr-agent.h: void ns3::olsr::Agent::Start() [member function]
|
||||
cls.add_method('Start',
|
||||
'void',
|
||||
[],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeader_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::MessageHeader(ns3::olsr::MessageHeader const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader const &', 'arg0')])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::MessageHeader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_virtual=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello & ns3::olsr::MessageHeader::GetHello() [member function]
|
||||
cls.add_method('GetHello',
|
||||
'ns3::olsr::MessageHeader::Hello &',
|
||||
[])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello const & ns3::olsr::MessageHeader::GetHello() const [member function]
|
||||
cls.add_method('GetHello',
|
||||
'ns3::olsr::MessageHeader::Hello const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna & ns3::olsr::MessageHeader::GetHna() [member function]
|
||||
cls.add_method('GetHna',
|
||||
'ns3::olsr::MessageHeader::Hna &',
|
||||
[])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna const & ns3::olsr::MessageHeader::GetHna() const [member function]
|
||||
cls.add_method('GetHna',
|
||||
'ns3::olsr::MessageHeader::Hna const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint8_t ns3::olsr::MessageHeader::GetHopCount() const [member function]
|
||||
cls.add_method('GetHopCount',
|
||||
'uint8_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::TypeId ns3::olsr::MessageHeader::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: uint16_t ns3::olsr::MessageHeader::GetMessageSequenceNumber() const [member function]
|
||||
cls.add_method('GetMessageSequenceNumber',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::MessageType ns3::olsr::MessageHeader::GetMessageType() const [member function]
|
||||
cls.add_method('GetMessageType',
|
||||
'ns3::olsr::MessageHeader::MessageType',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid & ns3::olsr::MessageHeader::GetMid() [member function]
|
||||
cls.add_method('GetMid',
|
||||
'ns3::olsr::MessageHeader::Mid &',
|
||||
[])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid const & ns3::olsr::MessageHeader::GetMid() const [member function]
|
||||
cls.add_method('GetMid',
|
||||
'ns3::olsr::MessageHeader::Mid const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::Ipv4Address ns3::olsr::MessageHeader::GetOriginatorAddress() const [member function]
|
||||
cls.add_method('GetOriginatorAddress',
|
||||
'ns3::Ipv4Address',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc & ns3::olsr::MessageHeader::GetTc() [member function]
|
||||
cls.add_method('GetTc',
|
||||
'ns3::olsr::MessageHeader::Tc &',
|
||||
[])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc const & ns3::olsr::MessageHeader::GetTc() const [member function]
|
||||
cls.add_method('GetTc',
|
||||
'ns3::olsr::MessageHeader::Tc const &',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint8_t ns3::olsr::MessageHeader::GetTimeToLive() const [member function]
|
||||
cls.add_method('GetTimeToLive',
|
||||
'uint8_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: static ns3::TypeId ns3::olsr::MessageHeader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## olsr-header.h: ns3::Time ns3::olsr::MessageHeader::GetVTime() const [member function]
|
||||
cls.add_method('GetVTime',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetHopCount(uint8_t hopCount) [member function]
|
||||
cls.add_method('SetHopCount',
|
||||
'void',
|
||||
[param('uint8_t', 'hopCount')])
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetMessageSequenceNumber(uint16_t messageSequenceNumber) [member function]
|
||||
cls.add_method('SetMessageSequenceNumber',
|
||||
'void',
|
||||
[param('uint16_t', 'messageSequenceNumber')])
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetMessageType(ns3::olsr::MessageHeader::MessageType messageType) [member function]
|
||||
cls.add_method('SetMessageType',
|
||||
'void',
|
||||
[param('ns3::olsr::MessageHeader::MessageType', 'messageType')])
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetOriginatorAddress(ns3::Ipv4Address originatorAddress) [member function]
|
||||
cls.add_method('SetOriginatorAddress',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'originatorAddress')])
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetTimeToLive(uint8_t timeToLive) [member function]
|
||||
cls.add_method('SetTimeToLive',
|
||||
'void',
|
||||
[param('uint8_t', 'timeToLive')])
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::SetVTime(ns3::Time time) [member function]
|
||||
cls.add_method('SetVTime',
|
||||
'void',
|
||||
[param('ns3::Time', 'time')])
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderHello_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::Hello() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::Hello(ns3::olsr::MessageHeader::Hello const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Hello const &', 'arg0')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Hello::Deserialize(ns3::Buffer::Iterator start, uint32_t messageSize) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'messageSize')])
|
||||
## olsr-header.h: ns3::Time ns3::olsr::MessageHeader::Hello::GetHTime() const [member function]
|
||||
cls.add_method('GetHTime',
|
||||
'ns3::Time',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Hello::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Hello::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Hello::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Hello::SetHTime(ns3::Time time) [member function]
|
||||
cls.add_method('SetHTime',
|
||||
'void',
|
||||
[param('ns3::Time', 'time')])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::hTime [variable]
|
||||
cls.add_instance_attribute('hTime', 'uint8_t', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::linkMessages [variable]
|
||||
cls.add_instance_attribute('linkMessages', 'std::vector< ns3::olsr::MessageHeader::Hello::LinkMessage >', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::willingness [variable]
|
||||
cls.add_instance_attribute('willingness', 'uint8_t', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderHelloLinkMessage_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::LinkMessage::linkCode [variable]
|
||||
cls.add_instance_attribute('linkCode', 'uint8_t', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::LinkMessage::neighborInterfaceAddresses [variable]
|
||||
cls.add_instance_attribute('neighborInterfaceAddresses', 'std::vector< ns3::Ipv4Address >', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::LinkMessage::LinkMessage(ns3::olsr::MessageHeader::Hello::LinkMessage const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Hello::LinkMessage const &', 'arg0')])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hello::LinkMessage::LinkMessage() [constructor]
|
||||
cls.add_constructor([])
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderHna_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Hna() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Hna(ns3::olsr::MessageHeader::Hna const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Hna const &', 'arg0')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Hna::Deserialize(ns3::Buffer::Iterator start, uint32_t messageSize) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'messageSize')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Hna::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Hna::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Hna::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::associations [variable]
|
||||
cls.add_instance_attribute('associations', 'std::vector< ns3::olsr::MessageHeader::Hna::Association >', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderHnaAssociation_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Association::address [variable]
|
||||
cls.add_instance_attribute('address', 'ns3::Ipv4Address', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Association::mask [variable]
|
||||
cls.add_instance_attribute('mask', 'ns3::Ipv4Mask', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Association::Association(ns3::olsr::MessageHeader::Hna::Association const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Hna::Association const &', 'arg0')])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Hna::Association::Association() [constructor]
|
||||
cls.add_constructor([])
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderMid_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid::Mid() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid::Mid(ns3::olsr::MessageHeader::Mid const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Mid const &', 'arg0')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Mid::Deserialize(ns3::Buffer::Iterator start, uint32_t messageSize) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'messageSize')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Mid::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Mid::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Mid::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Mid::interfaceAddresses [variable]
|
||||
cls.add_instance_attribute('interfaceAddresses', 'std::vector< ns3::Ipv4Address >', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrMessageHeaderTc_methods(root_module, cls):
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc::Tc() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc::Tc(ns3::olsr::MessageHeader::Tc const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::MessageHeader::Tc const &', 'arg0')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Tc::Deserialize(ns3::Buffer::Iterator start, uint32_t messageSize) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'messageSize')])
|
||||
## olsr-header.h: uint32_t ns3::olsr::MessageHeader::Tc::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Tc::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True)
|
||||
## olsr-header.h: void ns3::olsr::MessageHeader::Tc::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc::ansn [variable]
|
||||
cls.add_instance_attribute('ansn', 'uint16_t', is_const=False)
|
||||
## olsr-header.h: ns3::olsr::MessageHeader::Tc::neighborAddresses [variable]
|
||||
cls.add_instance_attribute('neighborAddresses', 'std::vector< ns3::Ipv4Address >', is_const=False)
|
||||
return
|
||||
|
||||
def register_Ns3OlsrPacketHeader_methods(root_module, cls):
|
||||
cls.add_output_stream_operator()
|
||||
## olsr-header.h: ns3::olsr::PacketHeader::PacketHeader(ns3::olsr::PacketHeader const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::olsr::PacketHeader const &', 'arg0')])
|
||||
## olsr-header.h: ns3::olsr::PacketHeader::PacketHeader() [constructor]
|
||||
cls.add_constructor([])
|
||||
## olsr-header.h: uint32_t ns3::olsr::PacketHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
|
||||
cls.add_method('Deserialize',
|
||||
'uint32_t',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_virtual=True)
|
||||
## olsr-header.h: ns3::TypeId ns3::olsr::PacketHeader::GetInstanceTypeId() const [member function]
|
||||
cls.add_method('GetInstanceTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: uint16_t ns3::olsr::PacketHeader::GetPacketLength() const [member function]
|
||||
cls.add_method('GetPacketLength',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint16_t ns3::olsr::PacketHeader::GetPacketSequenceNumber() const [member function]
|
||||
cls.add_method('GetPacketSequenceNumber',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## olsr-header.h: uint32_t ns3::olsr::PacketHeader::GetSerializedSize() const [member function]
|
||||
cls.add_method('GetSerializedSize',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: static ns3::TypeId ns3::olsr::PacketHeader::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## olsr-header.h: void ns3::olsr::PacketHeader::Print(std::ostream & os) const [member function]
|
||||
cls.add_method('Print',
|
||||
'void',
|
||||
[param('std::ostream &', 'os')],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: void ns3::olsr::PacketHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
|
||||
cls.add_method('Serialize',
|
||||
'void',
|
||||
[param('ns3::Buffer::Iterator', 'start')],
|
||||
is_const=True, is_virtual=True)
|
||||
## olsr-header.h: void ns3::olsr::PacketHeader::SetPacketLength(uint16_t length) [member function]
|
||||
cls.add_method('SetPacketLength',
|
||||
'void',
|
||||
[param('uint16_t', 'length')])
|
||||
## olsr-header.h: void ns3::olsr::PacketHeader::SetPacketSequenceNumber(uint16_t seqnum) [member function]
|
||||
cls.add_method('SetPacketSequenceNumber',
|
||||
'void',
|
||||
[param('uint16_t', 'seqnum')])
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
## olsr-header.h: extern double ns3::olsr::EmfToSeconds(uint8_t emf) [free function]
|
||||
module.add_function('EmfToSeconds',
|
||||
'double',
|
||||
[param('uint8_t', 'emf')])
|
||||
## olsr-header.h: extern uint8_t ns3::olsr::SecondsToEmf(double seconds) [free function]
|
||||
module.add_function('SecondsToEmf',
|
||||
'uint8_t',
|
||||
[param('double', 'seconds')])
|
||||
return
|
||||
|
||||
103
bindings/python/ns3_module_onoff.py
Normal file
103
bindings/python/ns3_module_onoff.py
Normal file
@@ -0,0 +1,103 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## onoff-application.h: ns3::OnOffApplication [class]
|
||||
module.add_class('OnOffApplication', parent=root_module['ns3::Application'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3OnOffApplication_methods(root_module, root_module['ns3::OnOffApplication'])
|
||||
return
|
||||
|
||||
def register_Ns3OnOffApplication_methods(root_module, cls):
|
||||
## onoff-application.h: ns3::OnOffApplication::OnOffApplication(ns3::OnOffApplication const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::OnOffApplication const &', 'arg0')])
|
||||
## onoff-application.h: static ns3::TypeId ns3::OnOffApplication::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## onoff-application.h: ns3::OnOffApplication::OnOffApplication() [constructor]
|
||||
cls.add_constructor([])
|
||||
## onoff-application.h: void ns3::OnOffApplication::SetMaxBytes(uint32_t maxBytes) [member function]
|
||||
cls.add_method('SetMaxBytes',
|
||||
'void',
|
||||
[param('uint32_t', 'maxBytes')])
|
||||
## onoff-application.h: void ns3::OnOffApplication::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## onoff-application.h: void ns3::OnOffApplication::StartApplication() [member function]
|
||||
cls.add_method('StartApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## onoff-application.h: void ns3::OnOffApplication::StopApplication() [member function]
|
||||
cls.add_method('StopApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
99
bindings/python/ns3_module_packet_sink.py
Normal file
99
bindings/python/ns3_module_packet_sink.py
Normal file
@@ -0,0 +1,99 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## packet-sink.h: ns3::PacketSink [class]
|
||||
module.add_class('PacketSink', parent=root_module['ns3::Application'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3PacketSink_methods(root_module, root_module['ns3::PacketSink'])
|
||||
return
|
||||
|
||||
def register_Ns3PacketSink_methods(root_module, cls):
|
||||
## packet-sink.h: ns3::PacketSink::PacketSink(ns3::PacketSink const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PacketSink const &', 'arg0')])
|
||||
## packet-sink.h: static ns3::TypeId ns3::PacketSink::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## packet-sink.h: ns3::PacketSink::PacketSink() [constructor]
|
||||
cls.add_constructor([])
|
||||
## packet-sink.h: void ns3::PacketSink::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## packet-sink.h: void ns3::PacketSink::StartApplication() [member function]
|
||||
cls.add_method('StartApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## packet-sink.h: void ns3::PacketSink::StopApplication() [member function]
|
||||
cls.add_method('StopApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
284
bindings/python/ns3_module_point_to_point.py
Normal file
284
bindings/python/ns3_module_point_to_point.py
Normal file
@@ -0,0 +1,284 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## point-to-point-channel.h: ns3::PointToPointChannel [class]
|
||||
module.add_class('PointToPointChannel', parent=root_module['ns3::Channel'])
|
||||
## point-to-point-net-device.h: ns3::PointToPointNetDevice [class]
|
||||
module.add_class('PointToPointNetDevice', parent=root_module['ns3::NetDevice'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3PointToPointChannel_methods(root_module, root_module['ns3::PointToPointChannel'])
|
||||
register_Ns3PointToPointNetDevice_methods(root_module, root_module['ns3::PointToPointNetDevice'])
|
||||
return
|
||||
|
||||
def register_Ns3PointToPointChannel_methods(root_module, cls):
|
||||
## point-to-point-channel.h: ns3::PointToPointChannel::PointToPointChannel(ns3::PointToPointChannel const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PointToPointChannel const &', 'arg0')])
|
||||
## point-to-point-channel.h: static ns3::TypeId ns3::PointToPointChannel::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## point-to-point-channel.h: ns3::PointToPointChannel::PointToPointChannel() [constructor]
|
||||
cls.add_constructor([])
|
||||
## point-to-point-channel.h: void ns3::PointToPointChannel::Attach(ns3::Ptr<ns3::PointToPointNetDevice> device) [member function]
|
||||
cls.add_method('Attach',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::PointToPointNetDevice >', 'device')])
|
||||
## point-to-point-channel.h: bool ns3::PointToPointChannel::TransmitStart(ns3::Ptr<ns3::Packet> p, ns3::Ptr<ns3::PointToPointNetDevice> src, ns3::Time txTime) [member function]
|
||||
cls.add_method('TransmitStart',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Ptr< ns3::PointToPointNetDevice >', 'src'), param('ns3::Time', 'txTime')])
|
||||
## point-to-point-channel.h: uint32_t ns3::PointToPointChannel::GetNDevices() const [member function]
|
||||
cls.add_method('GetNDevices',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-channel.h: ns3::Ptr<ns3::PointToPointNetDevice> ns3::PointToPointChannel::GetPointToPointDevice(uint32_t i) const [member function]
|
||||
cls.add_method('GetPointToPointDevice',
|
||||
'ns3::Ptr< ns3::PointToPointNetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True)
|
||||
## point-to-point-channel.h: ns3::Ptr<ns3::NetDevice> ns3::PointToPointChannel::GetDevice(uint32_t i) const [member function]
|
||||
cls.add_method('GetDevice',
|
||||
'ns3::Ptr< ns3::NetDevice >',
|
||||
[param('uint32_t', 'i')],
|
||||
is_const=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3PointToPointNetDevice_methods(root_module, cls):
|
||||
## point-to-point-net-device.h: ns3::PointToPointNetDevice::PointToPointNetDevice(ns3::PointToPointNetDevice const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PointToPointNetDevice const &', 'arg0')])
|
||||
## point-to-point-net-device.h: static ns3::TypeId ns3::PointToPointNetDevice::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## point-to-point-net-device.h: ns3::PointToPointNetDevice::PointToPointNetDevice() [constructor]
|
||||
cls.add_constructor([])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetDataRate(ns3::DataRate bps) [member function]
|
||||
cls.add_method('SetDataRate',
|
||||
'void',
|
||||
[param('ns3::DataRate', 'bps')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetInterframeGap(ns3::Time t) [member function]
|
||||
cls.add_method('SetInterframeGap',
|
||||
'void',
|
||||
[param('ns3::Time', 't')])
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::Attach(ns3::Ptr<ns3::PointToPointChannel> ch) [member function]
|
||||
cls.add_method('Attach',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::PointToPointChannel >', 'ch')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetQueue(ns3::Ptr<ns3::Queue> queue) [member function]
|
||||
cls.add_method('SetQueue',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Queue >', 'queue')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function]
|
||||
cls.add_method('SetReceiveErrorModel',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::ErrorModel >', 'em')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::Receive(ns3::Ptr<ns3::Packet> p) [member function]
|
||||
cls.add_method('Receive',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'p')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetAddress(ns3::Mac48Address addr) [member function]
|
||||
cls.add_method('SetAddress',
|
||||
'void',
|
||||
[param('ns3::Mac48Address', 'addr')])
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetFrameSize(uint16_t frameSize) [member function]
|
||||
cls.add_method('SetFrameSize',
|
||||
'void',
|
||||
[param('uint16_t', 'frameSize')])
|
||||
## point-to-point-net-device.h: uint16_t ns3::PointToPointNetDevice::GetFrameSize() const [member function]
|
||||
cls.add_method('GetFrameSize',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetName(std::string const name) [member function]
|
||||
cls.add_method('SetName',
|
||||
'void',
|
||||
[param('std::string const', 'name')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: std::string ns3::PointToPointNetDevice::GetName() const [member function]
|
||||
cls.add_method('GetName',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetIfIndex(uint32_t const index) [member function]
|
||||
cls.add_method('SetIfIndex',
|
||||
'void',
|
||||
[param('uint32_t const', 'index')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: uint32_t ns3::PointToPointNetDevice::GetIfIndex() const [member function]
|
||||
cls.add_method('GetIfIndex',
|
||||
'uint32_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Ptr<ns3::Channel> ns3::PointToPointNetDevice::GetChannel() const [member function]
|
||||
cls.add_method('GetChannel',
|
||||
'ns3::Ptr< ns3::Channel >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Address ns3::PointToPointNetDevice::GetAddress() const [member function]
|
||||
cls.add_method('GetAddress',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::SetMtu(uint16_t const mtu) [member function]
|
||||
cls.add_method('SetMtu',
|
||||
'bool',
|
||||
[param('uint16_t const', 'mtu')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: uint16_t ns3::PointToPointNetDevice::GetMtu() const [member function]
|
||||
cls.add_method('GetMtu',
|
||||
'uint16_t',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::IsLinkUp() const [member function]
|
||||
cls.add_method('IsLinkUp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
|
||||
cls.add_method('SetLinkChangeCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::IsBroadcast() const [member function]
|
||||
cls.add_method('IsBroadcast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Address ns3::PointToPointNetDevice::GetBroadcast() const [member function]
|
||||
cls.add_method('GetBroadcast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::IsMulticast() const [member function]
|
||||
cls.add_method('IsMulticast',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Address ns3::PointToPointNetDevice::GetMulticast() const [member function]
|
||||
cls.add_method('GetMulticast',
|
||||
'ns3::Address',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Address ns3::PointToPointNetDevice::MakeMulticastAddress(ns3::Ipv4Address multicastGroup) const [member function]
|
||||
cls.add_method('MakeMulticastAddress',
|
||||
'ns3::Address',
|
||||
[param('ns3::Ipv4Address', 'multicastGroup')],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::IsPointToPoint() const [member function]
|
||||
cls.add_method('IsPointToPoint',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('Send',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
|
||||
cls.add_method('SendFrom',
|
||||
'bool',
|
||||
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: ns3::Ptr<ns3::Node> ns3::PointToPointNetDevice::GetNode() const [member function]
|
||||
cls.add_method('GetNode',
|
||||
'ns3::Ptr< ns3::Node >',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
|
||||
cls.add_method('SetNode',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::Node >', 'node')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::NeedsArp() const [member function]
|
||||
cls.add_method('NeedsArp',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::empty, ns3::empty> cb) [member function]
|
||||
cls.add_method('SetReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty >', 'cb')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::SetPromiscReceiveCallback(ns3::Callback<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<ns3::Packet const>, unsigned short, ns3::Address const&, ns3::Address const&, ns3::NetDevice::PacketType> cb) [member function]
|
||||
cls.add_method('SetPromiscReceiveCallback',
|
||||
'void',
|
||||
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType >', 'cb')],
|
||||
is_virtual=True)
|
||||
## point-to-point-net-device.h: bool ns3::PointToPointNetDevice::SupportsSendFrom() const [member function]
|
||||
cls.add_method('SupportsSendFrom',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True, is_virtual=True)
|
||||
## point-to-point-net-device.h: void ns3::PointToPointNetDevice::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
1484
bindings/python/ns3_module_simulator.py
Normal file
1484
bindings/python/ns3_module_simulator.py
Normal file
File diff suppressed because it is too large
Load Diff
437
bindings/python/ns3_module_stats.py
Normal file
437
bindings/python/ns3_module_stats.py
Normal file
@@ -0,0 +1,437 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## data-output-interface.h: ns3::DataOutputCallback [class]
|
||||
module.add_class('DataOutputCallback', allow_subclassing=True)
|
||||
## data-calculator.h: ns3::DataCalculator [class]
|
||||
module.add_class('DataCalculator', parent=root_module['ns3::Object'])
|
||||
## data-collector.h: ns3::DataCollector [class]
|
||||
module.add_class('DataCollector', parent=root_module['ns3::Object'])
|
||||
## data-output-interface.h: ns3::DataOutputInterface [class]
|
||||
module.add_class('DataOutputInterface', parent=root_module['ns3::Object'])
|
||||
## basic-data-calculators.h: ns3::MinMaxAvgTotalCalculator<unsigned int> [class]
|
||||
module.add_class('MinMaxAvgTotalCalculator', template_parameters=['unsigned int'], parent=root_module['ns3::DataCalculator'])
|
||||
## omnet-data-output.h: ns3::OmnetDataOutput [class]
|
||||
module.add_class('OmnetDataOutput', parent=root_module['ns3::DataOutputInterface'])
|
||||
## packet-data-calculators.h: ns3::PacketSizeMinMaxAvgTotalCalculator [class]
|
||||
module.add_class('PacketSizeMinMaxAvgTotalCalculator', parent=root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
|
||||
## sqlite-data-output.h: ns3::SqliteDataOutput [class]
|
||||
module.add_class('SqliteDataOutput', parent=root_module['ns3::DataOutputInterface'])
|
||||
## time-data-calculators.h: ns3::TimeMinMaxAvgTotalCalculator [class]
|
||||
module.add_class('TimeMinMaxAvgTotalCalculator', parent=root_module['ns3::DataCalculator'])
|
||||
## basic-data-calculators.h: ns3::CounterCalculator<unsigned int> [class]
|
||||
module.add_class('CounterCalculator', template_parameters=['unsigned int'], parent=root_module['ns3::DataCalculator'])
|
||||
## packet-data-calculators.h: ns3::PacketCounterCalculator [class]
|
||||
module.add_class('PacketCounterCalculator', parent=root_module['ns3::CounterCalculator< unsigned int >'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
|
||||
register_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
|
||||
register_Ns3DataCollector_methods(root_module, root_module['ns3::DataCollector'])
|
||||
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
|
||||
register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
|
||||
register_Ns3OmnetDataOutput_methods(root_module, root_module['ns3::OmnetDataOutput'])
|
||||
register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::PacketSizeMinMaxAvgTotalCalculator'])
|
||||
register_Ns3SqliteDataOutput_methods(root_module, root_module['ns3::SqliteDataOutput'])
|
||||
register_Ns3TimeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::TimeMinMaxAvgTotalCalculator'])
|
||||
register_Ns3CounterCalculator__Unsigned_int_methods(root_module, root_module['ns3::CounterCalculator< unsigned int >'])
|
||||
register_Ns3PacketCounterCalculator_methods(root_module, root_module['ns3::PacketCounterCalculator'])
|
||||
return
|
||||
|
||||
def register_Ns3DataOutputCallback_methods(root_module, cls):
|
||||
## data-output-interface.h: ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
|
||||
## data-output-interface.h: ns3::DataOutputCallback::DataOutputCallback() [constructor]
|
||||
cls.add_constructor([])
|
||||
## data-output-interface.h: void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
|
||||
cls.add_method('OutputSingleton',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## data-output-interface.h: void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
|
||||
cls.add_method('OutputSingleton',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## data-output-interface.h: void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
|
||||
cls.add_method('OutputSingleton',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## data-output-interface.h: void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
|
||||
cls.add_method('OutputSingleton',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## data-output-interface.h: void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
|
||||
cls.add_method('OutputSingleton',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3DataCalculator_methods(root_module, cls):
|
||||
## data-calculator.h: ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
|
||||
## data-calculator.h: ns3::DataCalculator::DataCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## data-calculator.h: bool ns3::DataCalculator::GetEnabled() const [member function]
|
||||
cls.add_method('GetEnabled',
|
||||
'bool',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-calculator.h: void ns3::DataCalculator::Enable() [member function]
|
||||
cls.add_method('Enable',
|
||||
'void',
|
||||
[])
|
||||
## data-calculator.h: void ns3::DataCalculator::Disable() [member function]
|
||||
cls.add_method('Disable',
|
||||
'void',
|
||||
[])
|
||||
## data-calculator.h: void ns3::DataCalculator::SetKey(std::string const key) [member function]
|
||||
cls.add_method('SetKey',
|
||||
'void',
|
||||
[param('std::string const', 'key')])
|
||||
## data-calculator.h: std::string ns3::DataCalculator::GetKey() const [member function]
|
||||
cls.add_method('GetKey',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-calculator.h: void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
|
||||
cls.add_method('Start',
|
||||
'void',
|
||||
[param('ns3::Time const &', 'startTime')],
|
||||
is_virtual=True)
|
||||
## data-calculator.h: void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
|
||||
cls.add_method('Stop',
|
||||
'void',
|
||||
[param('ns3::Time const &', 'stopTime')],
|
||||
is_virtual=True)
|
||||
## data-calculator.h: void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataOutputCallback &', 'callback')],
|
||||
is_pure_virtual=True, is_const=True, is_virtual=True)
|
||||
## data-calculator.h: void ns3::DataCalculator::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3DataCollector_methods(root_module, cls):
|
||||
## data-collector.h: ns3::DataCollector::DataCollector(ns3::DataCollector const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::DataCollector const &', 'arg0')])
|
||||
## data-collector.h: ns3::DataCollector::DataCollector() [constructor]
|
||||
cls.add_constructor([])
|
||||
## data-collector.h: void ns3::DataCollector::DescribeRun(std::string experiment, std::string strategy, std::string input, std::string runID, std::string description="") [member function]
|
||||
cls.add_method('DescribeRun',
|
||||
'void',
|
||||
[param('std::string', 'experiment'), param('std::string', 'strategy'), param('std::string', 'input'), param('std::string', 'runID'), param('std::string', 'description', default_value='""')])
|
||||
## data-collector.h: std::string ns3::DataCollector::GetExperimentLabel() const [member function]
|
||||
cls.add_method('GetExperimentLabel',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-collector.h: std::string ns3::DataCollector::GetStrategyLabel() const [member function]
|
||||
cls.add_method('GetStrategyLabel',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-collector.h: std::string ns3::DataCollector::GetInputLabel() const [member function]
|
||||
cls.add_method('GetInputLabel',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-collector.h: std::string ns3::DataCollector::GetRunLabel() const [member function]
|
||||
cls.add_method('GetRunLabel',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-collector.h: std::string ns3::DataCollector::GetDescription() const [member function]
|
||||
cls.add_method('GetDescription',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## data-collector.h: void ns3::DataCollector::AddMetadata(std::string key, std::string value) [member function]
|
||||
cls.add_method('AddMetadata',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('std::string', 'value')])
|
||||
## data-collector.h: void ns3::DataCollector::AddMetadata(std::string key, double value) [member function]
|
||||
cls.add_method('AddMetadata',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('double', 'value')])
|
||||
## data-collector.h: void ns3::DataCollector::AddMetadata(std::string key, uint32_t value) [member function]
|
||||
cls.add_method('AddMetadata',
|
||||
'void',
|
||||
[param('std::string', 'key'), param('uint32_t', 'value')])
|
||||
## data-collector.h: std::_List_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::DataCollector::MetadataBegin() [member function]
|
||||
cls.add_method('MetadataBegin',
|
||||
'std::_List_iterator< std::pair< std::basic_string< char, std::char_traits< char >, std::allocator< char > >, std::basic_string< char, std::char_traits< char >, std::allocator< char > > > >',
|
||||
[])
|
||||
## data-collector.h: std::_List_iterator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > ns3::DataCollector::MetadataEnd() [member function]
|
||||
cls.add_method('MetadataEnd',
|
||||
'std::_List_iterator< std::pair< std::basic_string< char, std::char_traits< char >, std::allocator< char > >, std::basic_string< char, std::char_traits< char >, std::allocator< char > > > >',
|
||||
[])
|
||||
## data-collector.h: void ns3::DataCollector::AddDataCalculator(ns3::Ptr<ns3::DataCalculator> datac) [member function]
|
||||
cls.add_method('AddDataCalculator',
|
||||
'void',
|
||||
[param('ns3::Ptr< ns3::DataCalculator >', 'datac')])
|
||||
## data-collector.h: std::_List_iterator<ns3::Ptr<ns3::DataCalculator> > ns3::DataCollector::DataCalculatorBegin() [member function]
|
||||
cls.add_method('DataCalculatorBegin',
|
||||
'std::_List_iterator< ns3::Ptr< ns3::DataCalculator > >',
|
||||
[])
|
||||
## data-collector.h: std::_List_iterator<ns3::Ptr<ns3::DataCalculator> > ns3::DataCollector::DataCalculatorEnd() [member function]
|
||||
cls.add_method('DataCalculatorEnd',
|
||||
'std::_List_iterator< ns3::Ptr< ns3::DataCalculator > >',
|
||||
[])
|
||||
## data-collector.h: void ns3::DataCollector::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3DataOutputInterface_methods(root_module, cls):
|
||||
## data-output-interface.h: ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
|
||||
## data-output-interface.h: ns3::DataOutputInterface::DataOutputInterface() [constructor]
|
||||
cls.add_constructor([])
|
||||
## data-output-interface.h: void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataCollector &', 'dc')],
|
||||
is_pure_virtual=True, is_virtual=True)
|
||||
## data-output-interface.h: void ns3::DataOutputInterface::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, cls):
|
||||
## basic-data-calculators.h: ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<unsigned int> const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< unsigned int > const &', 'arg0')])
|
||||
## basic-data-calculators.h: ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## basic-data-calculators.h: void ns3::MinMaxAvgTotalCalculator<unsigned int>::Update(unsigned int const i) [member function]
|
||||
cls.add_method('Update',
|
||||
'void',
|
||||
[param('unsigned int const', 'i')])
|
||||
## basic-data-calculators.h: void ns3::MinMaxAvgTotalCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataOutputCallback &', 'callback')],
|
||||
is_const=True, is_virtual=True)
|
||||
## basic-data-calculators.h: void ns3::MinMaxAvgTotalCalculator<unsigned int>::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3OmnetDataOutput_methods(root_module, cls):
|
||||
## omnet-data-output.h: ns3::OmnetDataOutput::OmnetDataOutput(ns3::OmnetDataOutput const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::OmnetDataOutput const &', 'arg0')])
|
||||
## omnet-data-output.h: ns3::OmnetDataOutput::OmnetDataOutput() [constructor]
|
||||
cls.add_constructor([])
|
||||
## omnet-data-output.h: void ns3::OmnetDataOutput::Output(ns3::DataCollector & dc) [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataCollector &', 'dc')],
|
||||
is_virtual=True)
|
||||
## omnet-data-output.h: void ns3::OmnetDataOutput::SetFilePrefix(std::string const prefix) [member function]
|
||||
cls.add_method('SetFilePrefix',
|
||||
'void',
|
||||
[param('std::string const', 'prefix')])
|
||||
## omnet-data-output.h: std::string ns3::OmnetDataOutput::GetFilePrefix() const [member function]
|
||||
cls.add_method('GetFilePrefix',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## omnet-data-output.h: void ns3::OmnetDataOutput::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls):
|
||||
## packet-data-calculators.h: ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator(ns3::PacketSizeMinMaxAvgTotalCalculator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PacketSizeMinMaxAvgTotalCalculator const &', 'arg0')])
|
||||
## packet-data-calculators.h: ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet) [member function]
|
||||
cls.add_method('PacketUpdate',
|
||||
'void',
|
||||
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
|
||||
## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet, ns3::Mac48Address realto) [member function]
|
||||
cls.add_method('FrameUpdate',
|
||||
'void',
|
||||
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
|
||||
## packet-data-calculators.h: void ns3::PacketSizeMinMaxAvgTotalCalculator::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3SqliteDataOutput_methods(root_module, cls):
|
||||
## sqlite-data-output.h: ns3::SqliteDataOutput::SqliteDataOutput(ns3::SqliteDataOutput const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::SqliteDataOutput const &', 'arg0')])
|
||||
## sqlite-data-output.h: ns3::SqliteDataOutput::SqliteDataOutput() [constructor]
|
||||
cls.add_constructor([])
|
||||
## sqlite-data-output.h: void ns3::SqliteDataOutput::Output(ns3::DataCollector & dc) [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataCollector &', 'dc')],
|
||||
is_virtual=True)
|
||||
## sqlite-data-output.h: void ns3::SqliteDataOutput::SetDBFile(std::string const file) [member function]
|
||||
cls.add_method('SetDBFile',
|
||||
'void',
|
||||
[param('std::string const', 'file')])
|
||||
## sqlite-data-output.h: std::string ns3::SqliteDataOutput::GetDBFile() const [member function]
|
||||
cls.add_method('GetDBFile',
|
||||
'std::string',
|
||||
[],
|
||||
is_const=True)
|
||||
## sqlite-data-output.h: void ns3::SqliteDataOutput::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3TimeMinMaxAvgTotalCalculator_methods(root_module, cls):
|
||||
## time-data-calculators.h: ns3::TimeMinMaxAvgTotalCalculator::TimeMinMaxAvgTotalCalculator(ns3::TimeMinMaxAvgTotalCalculator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::TimeMinMaxAvgTotalCalculator const &', 'arg0')])
|
||||
## time-data-calculators.h: ns3::TimeMinMaxAvgTotalCalculator::TimeMinMaxAvgTotalCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## time-data-calculators.h: void ns3::TimeMinMaxAvgTotalCalculator::Update(ns3::Time const i) [member function]
|
||||
cls.add_method('Update',
|
||||
'void',
|
||||
[param('ns3::Time const', 'i')])
|
||||
## time-data-calculators.h: void ns3::TimeMinMaxAvgTotalCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataOutputCallback &', 'callback')],
|
||||
is_const=True, is_virtual=True)
|
||||
## time-data-calculators.h: void ns3::TimeMinMaxAvgTotalCalculator::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3CounterCalculator__Unsigned_int_methods(root_module, cls):
|
||||
## basic-data-calculators.h: ns3::CounterCalculator<unsigned int>::CounterCalculator(ns3::CounterCalculator<unsigned int> const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::CounterCalculator< unsigned int > const &', 'arg0')])
|
||||
## basic-data-calculators.h: ns3::CounterCalculator<unsigned int>::CounterCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## basic-data-calculators.h: void ns3::CounterCalculator<unsigned int>::Update() [member function]
|
||||
cls.add_method('Update',
|
||||
'void',
|
||||
[])
|
||||
## basic-data-calculators.h: void ns3::CounterCalculator<unsigned int>::Update(unsigned int const i) [member function]
|
||||
cls.add_method('Update',
|
||||
'void',
|
||||
[param('unsigned int const', 'i')])
|
||||
## basic-data-calculators.h: unsigned int ns3::CounterCalculator<unsigned int>::GetCount() const [member function]
|
||||
cls.add_method('GetCount',
|
||||
'unsigned int',
|
||||
[],
|
||||
is_const=True)
|
||||
## basic-data-calculators.h: void ns3::CounterCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
|
||||
cls.add_method('Output',
|
||||
'void',
|
||||
[param('ns3::DataOutputCallback &', 'callback')],
|
||||
is_const=True, is_virtual=True)
|
||||
## basic-data-calculators.h: void ns3::CounterCalculator<unsigned int>::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3PacketCounterCalculator_methods(root_module, cls):
|
||||
## packet-data-calculators.h: ns3::PacketCounterCalculator::PacketCounterCalculator(ns3::PacketCounterCalculator const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::PacketCounterCalculator const &', 'arg0')])
|
||||
## packet-data-calculators.h: ns3::PacketCounterCalculator::PacketCounterCalculator() [constructor]
|
||||
cls.add_constructor([])
|
||||
## packet-data-calculators.h: void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet) [member function]
|
||||
cls.add_method('PacketUpdate',
|
||||
'void',
|
||||
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
|
||||
## packet-data-calculators.h: void ns3::PacketCounterCalculator::FrameUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet, ns3::Mac48Address realto) [member function]
|
||||
cls.add_method('FrameUpdate',
|
||||
'void',
|
||||
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
|
||||
## packet-data-calculators.h: void ns3::PacketCounterCalculator::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
133
bindings/python/ns3_module_udp_echo.py
Normal file
133
bindings/python/ns3_module_udp_echo.py
Normal file
@@ -0,0 +1,133 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
## udp-echo-client.h: ns3::UdpEchoClient [class]
|
||||
module.add_class('UdpEchoClient', parent=root_module['ns3::Application'])
|
||||
## udp-echo-server.h: ns3::UdpEchoServer [class]
|
||||
module.add_class('UdpEchoServer', parent=root_module['ns3::Application'])
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
register_Ns3UdpEchoClient_methods(root_module, root_module['ns3::UdpEchoClient'])
|
||||
register_Ns3UdpEchoServer_methods(root_module, root_module['ns3::UdpEchoServer'])
|
||||
return
|
||||
|
||||
def register_Ns3UdpEchoClient_methods(root_module, cls):
|
||||
## udp-echo-client.h: ns3::UdpEchoClient::UdpEchoClient(ns3::UdpEchoClient const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::UdpEchoClient const &', 'arg0')])
|
||||
## udp-echo-client.h: static ns3::TypeId ns3::UdpEchoClient::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## udp-echo-client.h: ns3::UdpEchoClient::UdpEchoClient() [constructor]
|
||||
cls.add_constructor([])
|
||||
## udp-echo-client.h: void ns3::UdpEchoClient::SetRemote(ns3::Ipv4Address ip, uint16_t port) [member function]
|
||||
cls.add_method('SetRemote',
|
||||
'void',
|
||||
[param('ns3::Ipv4Address', 'ip'), param('uint16_t', 'port')])
|
||||
## udp-echo-client.h: void ns3::UdpEchoClient::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## udp-echo-client.h: void ns3::UdpEchoClient::StartApplication() [member function]
|
||||
cls.add_method('StartApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## udp-echo-client.h: void ns3::UdpEchoClient::StopApplication() [member function]
|
||||
cls.add_method('StopApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_Ns3UdpEchoServer_methods(root_module, cls):
|
||||
## udp-echo-server.h: ns3::UdpEchoServer::UdpEchoServer(ns3::UdpEchoServer const & arg0) [copy constructor]
|
||||
cls.add_constructor([param('ns3::UdpEchoServer const &', 'arg0')])
|
||||
## udp-echo-server.h: static ns3::TypeId ns3::UdpEchoServer::GetTypeId() [member function]
|
||||
cls.add_method('GetTypeId',
|
||||
'ns3::TypeId',
|
||||
[],
|
||||
is_static=True)
|
||||
## udp-echo-server.h: ns3::UdpEchoServer::UdpEchoServer() [constructor]
|
||||
cls.add_constructor([])
|
||||
## udp-echo-server.h: void ns3::UdpEchoServer::DoDispose() [member function]
|
||||
cls.add_method('DoDispose',
|
||||
'void',
|
||||
[],
|
||||
visibility='protected', is_virtual=True)
|
||||
## udp-echo-server.h: void ns3::UdpEchoServer::StartApplication() [member function]
|
||||
cls.add_method('StartApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
## udp-echo-server.h: void ns3::UdpEchoServer::StopApplication() [member function]
|
||||
cls.add_method('StopApplication',
|
||||
'void',
|
||||
[],
|
||||
visibility='private', is_virtual=True)
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
2819
bindings/python/ns3_module_wifi.py
Normal file
2819
bindings/python/ns3_module_wifi.py
Normal file
File diff suppressed because it is too large
Load Diff
222
bindings/python/ns3module_helpers.cc
Normal file
222
bindings/python/ns3module_helpers.cc
Normal file
@@ -0,0 +1,222 @@
|
||||
#include "ns3module.h"
|
||||
|
||||
|
||||
namespace ns3{
|
||||
|
||||
void PythonCompleteConstruct (Ptr<Object> object, TypeId typeId, const AttributeList &attributes)
|
||||
{
|
||||
object->SetTypeId (typeId);
|
||||
object->Object::Construct (attributes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class PythonEventImpl : public ns3::EventImpl
|
||||
{
|
||||
private:
|
||||
PyObject *m_callback;
|
||||
PyObject *m_args;
|
||||
public:
|
||||
PythonEventImpl (PyObject *callback, PyObject *args)
|
||||
{
|
||||
m_callback = callback;
|
||||
Py_INCREF(m_callback);
|
||||
m_args = args;
|
||||
Py_INCREF(m_args);
|
||||
}
|
||||
virtual ~PythonEventImpl ()
|
||||
{
|
||||
PyGILState_STATE __py_gil_state;
|
||||
__py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
|
||||
|
||||
Py_DECREF(m_callback);
|
||||
Py_DECREF(m_args);
|
||||
|
||||
if (PyEval_ThreadsInitialized())
|
||||
PyGILState_Release(__py_gil_state);
|
||||
}
|
||||
virtual void Notify ()
|
||||
{
|
||||
PyGILState_STATE __py_gil_state;
|
||||
__py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
|
||||
|
||||
PyObject *retval = PyObject_CallObject(m_callback, m_args);
|
||||
if (retval) {
|
||||
if (retval != Py_None) {
|
||||
PyErr_SetString(PyExc_TypeError, "event callback should return None");
|
||||
PyErr_Print();
|
||||
}
|
||||
Py_DECREF(retval);
|
||||
} else {
|
||||
PyErr_Print();
|
||||
}
|
||||
|
||||
if (PyEval_ThreadsInitialized())
|
||||
PyGILState_Release(__py_gil_state);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PyObject *
|
||||
_wrap_Simulator_Schedule(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs,
|
||||
PyObject **return_exception)
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyObject *py_time;
|
||||
PyObject *py_callback;
|
||||
PyObject *user_args;
|
||||
ns3::Ptr<PythonEventImpl> py_event_impl;
|
||||
PyNs3EventId *py_EventId;
|
||||
|
||||
if (kwargs && PyObject_Length(kwargs) > 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "keyword arguments not supported");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (PyTuple_GET_SIZE(args) < 2) {
|
||||
PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 2 arguments");
|
||||
goto error;
|
||||
}
|
||||
py_time = PyTuple_GET_ITEM(args, 0);
|
||||
py_callback = PyTuple_GET_ITEM(args, 1);
|
||||
|
||||
if (!PyObject_IsInstance(py_time, (PyObject*) &PyNs3Time_Type)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Parameter 1 should be a ns3.Time instance");
|
||||
goto error;
|
||||
}
|
||||
if (!PyCallable_Check(py_callback)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable");
|
||||
goto error;
|
||||
}
|
||||
user_args = PyTuple_GetSlice(args, 2, PyTuple_GET_SIZE(args));
|
||||
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
|
||||
Py_DECREF(user_args);
|
||||
|
||||
py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type);
|
||||
py_EventId->obj = new ns3::EventId(
|
||||
ns3::Simulator::Schedule(*((PyNs3Time *) py_time)->obj, py_event_impl));
|
||||
return (PyObject *) py_EventId;
|
||||
|
||||
error:
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
_wrap_Simulator_ScheduleNow(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs,
|
||||
PyObject **return_exception)
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyObject *py_callback;
|
||||
PyObject *user_args;
|
||||
ns3::Ptr<PythonEventImpl> py_event_impl;
|
||||
PyNs3EventId *py_EventId;
|
||||
|
||||
if (kwargs && PyObject_Length(kwargs) > 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "keyword arguments not supported");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (PyTuple_GET_SIZE(args) < 1) {
|
||||
PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument");
|
||||
goto error;
|
||||
}
|
||||
py_callback = PyTuple_GET_ITEM(args, 0);
|
||||
|
||||
if (!PyCallable_Check(py_callback)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable");
|
||||
goto error;
|
||||
}
|
||||
user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
|
||||
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
|
||||
Py_DECREF(user_args);
|
||||
|
||||
py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type);
|
||||
py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleNow(py_event_impl));
|
||||
return (PyObject *) py_EventId;
|
||||
|
||||
error:
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
_wrap_Simulator_ScheduleDestroy(PyNs3Simulator *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs,
|
||||
PyObject **return_exception)
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyObject *py_callback;
|
||||
PyObject *user_args;
|
||||
ns3::Ptr<PythonEventImpl> py_event_impl;
|
||||
PyNs3EventId *py_EventId;
|
||||
|
||||
if (kwargs && PyObject_Length(kwargs) > 0) {
|
||||
PyErr_SetString(PyExc_TypeError, "keyword arguments not supported");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (PyTuple_GET_SIZE(args) < 1) {
|
||||
PyErr_SetString(PyExc_TypeError, "ns3.Simulator.Schedule needs at least 1 argument");
|
||||
goto error;
|
||||
}
|
||||
py_callback = PyTuple_GET_ITEM(args, 0);
|
||||
|
||||
if (!PyCallable_Check(py_callback)) {
|
||||
PyErr_SetString(PyExc_TypeError, "Parameter 2 should be callable");
|
||||
goto error;
|
||||
}
|
||||
user_args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args));
|
||||
py_event_impl = ns3::Create<PythonEventImpl>(py_callback, user_args);
|
||||
Py_DECREF(user_args);
|
||||
|
||||
py_EventId = PyObject_New(PyNs3EventId, &PyNs3EventId_Type);
|
||||
py_EventId->obj = new ns3::EventId(ns3::Simulator::ScheduleDestroy(py_event_impl));
|
||||
return (PyObject *) py_EventId;
|
||||
|
||||
error:
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PyObject *
|
||||
_wrap_TypeId_LookupByNameFailSafe(PyNs3TypeId *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs,
|
||||
PyObject **return_exception)
|
||||
{
|
||||
bool ok;
|
||||
const char *name;
|
||||
Py_ssize_t name_len;
|
||||
ns3::TypeId tid;
|
||||
PyNs3TypeId *py_tid;
|
||||
const char *keywords[] = {"name", NULL};
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &name, &name_len)) {
|
||||
PyObject *exc_type, *traceback;
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
return NULL;
|
||||
}
|
||||
ok = ns3::TypeId::LookupByNameFailSafe(std::string(name, name_len), &tid);
|
||||
if (!ok)
|
||||
{
|
||||
PyErr_Format(PyExc_KeyError, "The ns3 type with name `%s' is not registered", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
py_tid = PyObject_New(PyNs3TypeId, &PyNs3TypeId_Type);
|
||||
py_tid->obj = new ns3::TypeId (tid);
|
||||
PyNs3TypeId_wrapper_registry[(void *) py_tid->obj] = (PyObject *) py_tid;
|
||||
|
||||
return (PyObject *) py_tid;
|
||||
}
|
||||
145
bindings/python/ns3modulegen.py
Executable file
145
bindings/python/ns3modulegen.py
Executable file
@@ -0,0 +1,145 @@
|
||||
|
||||
LOCAL_MODULES = [
|
||||
#'my_extra_api_definitions',
|
||||
]
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
from pybindgen import FileCodeSink, write_preamble
|
||||
from pybindgen.module import MultiSectionFactory
|
||||
import pybindgen.settings
|
||||
|
||||
from ns3modulegen_generated import module_init, register_types, register_methods, register_functions
|
||||
import ns3modulegen_core_customizations
|
||||
import callbacks_list
|
||||
|
||||
this_script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
|
||||
class ErrorHandler(pybindgen.settings.ErrorHandler):
|
||||
def handle_error(self, wrapper, exception, traceback_):
|
||||
try:
|
||||
stack = wrapper.stack_where_defined
|
||||
except AttributeError:
|
||||
print >> sys.stderr, "??:??: %s / %r" % (wrapper, exception)
|
||||
else:
|
||||
stack = list(stack)
|
||||
stack.reverse()
|
||||
for (filename, line_number, function_name, text) in stack:
|
||||
file_dir = os.path.dirname(os.path.abspath(filename))
|
||||
if file_dir == this_script_dir:
|
||||
print >> sys.stderr, "%s:%i: %r" % (os.path.join("..", "bindings", "python", os.path.basename(filename)),
|
||||
line_number, exception)
|
||||
break
|
||||
return True
|
||||
pybindgen.settings.error_handler = ErrorHandler()
|
||||
|
||||
pybindgen.settings.wrapper_registry = pybindgen.settings.StdMapWrapperRegistry
|
||||
|
||||
|
||||
class MyMultiSectionFactory(MultiSectionFactory):
|
||||
|
||||
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), 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
|
||||
|
||||
def get_section_code_sink(self, section_name):
|
||||
return self.section_sinks[section_name]
|
||||
|
||||
def get_main_code_sink(self):
|
||||
return self.main_sink
|
||||
|
||||
def get_common_header_code_sink(self):
|
||||
return self.header_sink
|
||||
|
||||
def get_common_header_include(self):
|
||||
return '"%s"' % self.header_name
|
||||
|
||||
def close(self):
|
||||
self.header_sink.file.close()
|
||||
self.main_sink.file.close()
|
||||
for sink in self.section_sinks.itervalues():
|
||||
sink.file.close()
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
out = MyMultiSectionFactory(sys.argv[1], sys.argv[2:])
|
||||
root_module = module_init()
|
||||
root_module.add_include('"everything.h"')
|
||||
|
||||
register_types(root_module)
|
||||
|
||||
ns3modulegen_core_customizations.Simulator_customizations(root_module)
|
||||
ns3modulegen_core_customizations.CommandLine_customizations(root_module)
|
||||
ns3modulegen_core_customizations.TypeId_customizations(root_module)
|
||||
|
||||
|
||||
for local_module in LOCAL_MODULES:
|
||||
mod = __import__(local_module)
|
||||
mod.register_types(root_module)
|
||||
|
||||
ns3modulegen_core_customizations.generate_callback_classes(root_module.after_forward_declarations,
|
||||
callbacks_list.callback_classes)
|
||||
|
||||
|
||||
register_methods(root_module)
|
||||
|
||||
for local_module in LOCAL_MODULES:
|
||||
mod = __import__(local_module)
|
||||
mod.register_methods(root_module)
|
||||
|
||||
ns3modulegen_core_customizations.Object_customizations(root_module)
|
||||
ns3modulegen_core_customizations.Attribute_customizations(root_module)
|
||||
|
||||
register_functions(root_module)
|
||||
|
||||
for local_module in LOCAL_MODULES:
|
||||
mod = __import__(local_module)
|
||||
mod.register_functions(root_module)
|
||||
|
||||
enabled_features = os.environ['NS3_ENABLED_FEATURES'].split(',')
|
||||
|
||||
# if GtkConfigStore support is disabled, disable the class wrapper
|
||||
if 'GtkConfigStore' not in enabled_features:
|
||||
try:
|
||||
root_module.classes.remove(root_module['ns3::GtkConfigStore'])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
# if no sqlite, the class SqliteDataOutput is disabled
|
||||
if 'SqliteDataOutput' not in enabled_features:
|
||||
try:
|
||||
root_module.classes.remove(root_module['ns3::SqliteDataOutput'])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if 'Threading' not in enabled_features:
|
||||
for clsname in ['SystemThread', 'SystemMutex', 'SystemCondition', 'CriticalSection']:
|
||||
root_module.classes.remove(root_module['ns3::%s' % clsname])
|
||||
|
||||
if 'RealTime' not in enabled_features:
|
||||
for clsname in ['WallClockSynchronizer', 'RealtimeSimulatorImpl', 'RealtimeEventLock']:
|
||||
root_module.classes.remove(root_module['ns3::%s' % clsname])
|
||||
root_module.enums.remove(root_module['ns3::RealtimeSimulatorImpl::SynchronizationMode'])
|
||||
|
||||
root_module.generate(out, '_ns3')
|
||||
|
||||
out.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
527
bindings/python/ns3modulegen_core_customizations.py
Normal file
527
bindings/python/ns3modulegen_core_customizations.py
Normal file
@@ -0,0 +1,527 @@
|
||||
import re
|
||||
|
||||
from pybindgen.typehandlers import base as typehandlers
|
||||
from pybindgen import ReturnValue, Parameter
|
||||
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
|
||||
from pybindgen.typehandlers.codesink import MemoryCodeSink
|
||||
from pybindgen.typehandlers import ctypeparser
|
||||
from pybindgen import cppclass
|
||||
import warnings
|
||||
|
||||
from pybindgen.typehandlers.base import CodeGenerationError
|
||||
|
||||
import sys
|
||||
|
||||
class SmartPointerTransformation(typehandlers.TypeTransformation):
|
||||
"""
|
||||
This class provides a "type transformation" that tends to support
|
||||
NS-3 smart pointers. Parameters such as "Ptr<Foo> foo" are
|
||||
transformed into something like Parameter.new("Foo*", "foo",
|
||||
transfer_ownership=False). Return values such as Ptr<Foo> are
|
||||
transformed into ReturnValue.new("Foo*",
|
||||
caller_owns_return=False). Since the underlying objects have
|
||||
reference counting, PyBindGen does the right thing.
|
||||
"""
|
||||
def __init__(self):
|
||||
super(SmartPointerTransformation, self).__init__()
|
||||
self.rx = re.compile(r'(ns3::|::ns3::|)Ptr<([^>]+)>')
|
||||
|
||||
def _get_untransformed_type_traits(self, name):
|
||||
m = self.rx.match(name)
|
||||
is_const = False
|
||||
if m is None:
|
||||
return None, False
|
||||
else:
|
||||
name1 = m.group(2).strip()
|
||||
if name1.startswith('const '):
|
||||
name1 = name1[len('const '):]
|
||||
is_const = True
|
||||
if name1.endswith(' const'):
|
||||
name1 = name1[:-len(' const')]
|
||||
is_const = True
|
||||
new_name = name1+' *'
|
||||
|
||||
if new_name.startswith('::'):
|
||||
new_name = new_name[2:]
|
||||
return new_name, is_const
|
||||
|
||||
def get_untransformed_name(self, name):
|
||||
new_name, dummy_is_const = self._get_untransformed_type_traits(name)
|
||||
return new_name
|
||||
|
||||
def create_type_handler(self, type_handler, *args, **kwargs):
|
||||
if issubclass(type_handler, Parameter):
|
||||
kwargs['transfer_ownership'] = False
|
||||
elif issubclass(type_handler, ReturnValue):
|
||||
kwargs['caller_owns_return'] = False
|
||||
else:
|
||||
raise AssertionError
|
||||
|
||||
## fix the ctype, add ns3:: namespace
|
||||
orig_ctype, is_const = self._get_untransformed_type_traits(args[0])
|
||||
if is_const:
|
||||
correct_ctype = 'ns3::Ptr< %s const >' % orig_ctype[:-2]
|
||||
else:
|
||||
correct_ctype = 'ns3::Ptr< %s >' % orig_ctype[:-2]
|
||||
args = tuple([correct_ctype] + list(args[1:]))
|
||||
|
||||
handler = type_handler(*args, **kwargs)
|
||||
handler.set_tranformation(self, orig_ctype)
|
||||
return handler
|
||||
|
||||
def untransform(self, type_handler, declarations, code_block, expression):
|
||||
return 'const_cast<%s> (ns3::PeekPointer (%s))' % (type_handler.untransformed_ctype, expression)
|
||||
|
||||
def transform(self, type_handler, declarations, code_block, expression):
|
||||
assert type_handler.untransformed_ctype[-1] == '*'
|
||||
return 'ns3::Ptr< %s > (%s)' % (type_handler.untransformed_ctype[:-1], expression)
|
||||
|
||||
## register the type transformation
|
||||
transf = SmartPointerTransformation()
|
||||
typehandlers.return_type_matcher.register_transformation(transf)
|
||||
typehandlers.param_type_matcher.register_transformation(transf)
|
||||
del transf
|
||||
|
||||
|
||||
class ArgvParam(Parameter):
|
||||
"""
|
||||
Converts a python list-of-strings argument to a pair of 'int argc,
|
||||
char *argv[]' arguments to pass into C.
|
||||
|
||||
One Python argument becomes two C function arguments -> it's a miracle!
|
||||
|
||||
Note: this parameter type handler is not registered by any name;
|
||||
must be used explicitly.
|
||||
"""
|
||||
|
||||
DIRECTIONS = [Parameter.DIRECTION_IN]
|
||||
CTYPES = []
|
||||
|
||||
def convert_c_to_python(self, wrapper):
|
||||
raise NotImplementedError
|
||||
|
||||
def convert_python_to_c(self, wrapper):
|
||||
py_name = wrapper.declarations.declare_variable('PyObject*', 'py_' + self.name)
|
||||
argc_var = wrapper.declarations.declare_variable('int', 'argc')
|
||||
name = wrapper.declarations.declare_variable('char**', self.name)
|
||||
idx = wrapper.declarations.declare_variable('Py_ssize_t', 'idx')
|
||||
wrapper.parse_params.add_parameter('O!', ['&PyList_Type', '&'+py_name], self.name)
|
||||
|
||||
#wrapper.before_call.write_error_check('!PyList_Check(%s)' % py_name) # XXX
|
||||
|
||||
wrapper.before_call.write_code("%s = (char **) malloc(sizeof(char*)*PyList_Size(%s));"
|
||||
% (name, py_name))
|
||||
wrapper.before_call.add_cleanup_code('free(%s);' % name)
|
||||
wrapper.before_call.write_code('''
|
||||
for (%(idx)s = 0; %(idx)s < PyList_Size(%(py_name)s); %(idx)s++)
|
||||
{
|
||||
''' % vars())
|
||||
wrapper.before_call.sink.indent()
|
||||
wrapper.before_call.write_code('''
|
||||
PyObject *item = PyList_GET_ITEM(%(py_name)s, %(idx)s);
|
||||
''' % vars())
|
||||
#wrapper.before_call.write_error_check('item == NULL')
|
||||
wrapper.before_call.write_error_check(
|
||||
'!PyString_Check(item)',
|
||||
failure_cleanup=('PyErr_SetString(PyExc_TypeError, '
|
||||
'"argument %s must be a list of strings");') % self.name)
|
||||
wrapper.before_call.write_code(
|
||||
'%s[%s] = PyString_AsString(item);' % (name, idx))
|
||||
wrapper.before_call.sink.unindent()
|
||||
wrapper.before_call.write_code('}')
|
||||
wrapper.before_call.write_code('%s = PyList_Size(%s);' % (argc_var, py_name))
|
||||
|
||||
wrapper.call_params.append(argc_var)
|
||||
wrapper.call_params.append(name)
|
||||
|
||||
|
||||
class CallbackImplProxyMethod(typehandlers.ReverseWrapperBase):
|
||||
"""
|
||||
Class that generates a proxy virtual method that calls a similarly named python method.
|
||||
"""
|
||||
|
||||
def __init__(self, return_value, parameters):
|
||||
super(CallbackImplProxyMethod, self).__init__(return_value, parameters)
|
||||
|
||||
def generate_python_call(self):
|
||||
"""code to call the python method"""
|
||||
build_params = self.build_params.get_parameters(force_tuple_creation=True)
|
||||
if build_params[0][0] == '"':
|
||||
build_params[0] = '(char *) ' + build_params[0]
|
||||
args = self.before_call.declare_variable('PyObject*', 'args')
|
||||
self.before_call.write_code('%s = Py_BuildValue(%s);'
|
||||
% (args, ', '.join(build_params)))
|
||||
self.before_call.add_cleanup_code('Py_DECREF(%s);' % args)
|
||||
self.before_call.write_code('py_retval = PyObject_CallObject(m_callback, %s);' % args)
|
||||
self.before_call.write_error_check('py_retval == NULL')
|
||||
self.before_call.add_cleanup_code('Py_DECREF(py_retval);')
|
||||
|
||||
|
||||
|
||||
|
||||
def generate_callback_classes(out, callbacks):
|
||||
for callback_impl_num, template_parameters in enumerate(callbacks):
|
||||
sink = MemoryCodeSink()
|
||||
cls_name = "ns3::Callback< %s >" % ', '.join(template_parameters)
|
||||
#print >> sys.stderr, "***** trying to register callback: %r" % cls_name
|
||||
class_name = "PythonCallbackImpl%i" % callback_impl_num
|
||||
sink.writeln('''
|
||||
class %s : public ns3::CallbackImpl<%s>
|
||||
{
|
||||
public:
|
||||
PyObject *m_callback;
|
||||
%s(PyObject *callback)
|
||||
{
|
||||
Py_INCREF(callback);
|
||||
m_callback = callback;
|
||||
}
|
||||
virtual ~%s()
|
||||
{
|
||||
Py_DECREF(m_callback);
|
||||
m_callback = NULL;
|
||||
}
|
||||
|
||||
virtual bool IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other_base) const
|
||||
{
|
||||
const %s *other = dynamic_cast<const %s*> (ns3::PeekPointer (other_base));
|
||||
if (other != NULL)
|
||||
return (other->m_callback == m_callback);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
''' % (class_name, ', '.join(template_parameters), class_name, class_name, class_name, class_name))
|
||||
sink.indent()
|
||||
callback_return = template_parameters[0]
|
||||
return_ctype = ctypeparser.parse_type(callback_return)
|
||||
if ('const' in return_ctype.remove_modifiers()):
|
||||
kwargs = {'is_const': True}
|
||||
else:
|
||||
kwargs = {}
|
||||
try:
|
||||
return_type = ReturnValue.new(str(return_ctype), **kwargs)
|
||||
except (typehandlers.TypeLookupError, typehandlers.TypeConfigurationError), ex:
|
||||
warnings.warn("***** Unable to register callback; Return value '%s' error (used in %s): %r"
|
||||
% (callback_return, cls_name, ex),
|
||||
Warning)
|
||||
continue
|
||||
|
||||
arguments = []
|
||||
ok = True
|
||||
callback_parameters = [arg for arg in template_parameters[1:] if arg != 'ns3::empty']
|
||||
for arg_num, arg_type in enumerate(callback_parameters):
|
||||
arg_name = 'arg%i' % (arg_num+1)
|
||||
|
||||
param_ctype = ctypeparser.parse_type(arg_type)
|
||||
if ('const' in param_ctype.remove_modifiers()):
|
||||
kwargs = {'is_const': True}
|
||||
else:
|
||||
kwargs = {}
|
||||
try:
|
||||
arguments.append(Parameter.new(str(param_ctype), arg_name, **kwargs))
|
||||
except (typehandlers.TypeLookupError, typehandlers.TypeConfigurationError), ex:
|
||||
warnings.warn("***** Unable to register callback; parameter '%s %s' error (used in %s): %r"
|
||||
% (arg_type, arg_name, cls_name, ex),
|
||||
Warning)
|
||||
ok = False
|
||||
if not ok:
|
||||
continue
|
||||
|
||||
wrapper = CallbackImplProxyMethod(return_type, arguments)
|
||||
wrapper.generate(sink, 'operator()', decl_modifiers=[])
|
||||
|
||||
sink.unindent()
|
||||
sink.writeln('};\n')
|
||||
sink.flush_to(out)
|
||||
|
||||
class PythonCallbackParameter(Parameter):
|
||||
"Class handlers"
|
||||
CTYPES = [cls_name]
|
||||
#print >> sys.stderr, "***** registering callback handler: %r" % ctypeparser.normalize_type_string(cls_name)
|
||||
DIRECTIONS = [Parameter.DIRECTION_IN]
|
||||
PYTHON_CALLBACK_IMPL_NAME = class_name
|
||||
TEMPLATE_ARGS = template_parameters
|
||||
|
||||
def convert_python_to_c(self, wrapper):
|
||||
"parses python args to get C++ value"
|
||||
assert isinstance(wrapper, typehandlers.ForwardWrapperBase)
|
||||
|
||||
py_callback = wrapper.declarations.declare_variable('PyObject*', self.name)
|
||||
wrapper.parse_params.add_parameter('O', ['&'+py_callback], self.name)
|
||||
wrapper.before_call.write_error_check(
|
||||
'!PyCallable_Check(%s)' % py_callback,
|
||||
'PyErr_SetString(PyExc_TypeError, "parameter \'%s\' must be callbale");' % self.name)
|
||||
callback_impl = wrapper.declarations.declare_variable(
|
||||
'ns3::Ptr<%s>' % self.PYTHON_CALLBACK_IMPL_NAME,
|
||||
'%s_cb_impl' % self.name)
|
||||
wrapper.before_call.write_code("%s = ns3::Create<%s> (%s);"
|
||||
% (callback_impl, self.PYTHON_CALLBACK_IMPL_NAME, py_callback))
|
||||
wrapper.call_params.append(
|
||||
'ns3::Callback<%s> (%s)' % (', '.join(self.TEMPLATE_ARGS), callback_impl))
|
||||
|
||||
def convert_c_to_python(self, wrapper):
|
||||
raise typehandlers.NotSupportedError("Reverse wrappers for ns3::Callback<...> types "
|
||||
"(python using callbacks defined in C++) not implemented.")
|
||||
|
||||
|
||||
# def write_preamble(out):
|
||||
# pybindgen.write_preamble(out)
|
||||
# out.writeln("#include \"ns3/everything.h\"")
|
||||
|
||||
|
||||
|
||||
def Simulator_customizations(module):
|
||||
Simulator = module['ns3::Simulator']
|
||||
|
||||
## Simulator::Schedule(delay, callback, ...user..args...)
|
||||
Simulator.add_custom_method_wrapper("Schedule", "_wrap_Simulator_Schedule",
|
||||
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
|
||||
|
||||
|
||||
## Simulator::ScheduleNow(callback, ...user..args...)
|
||||
Simulator.add_custom_method_wrapper("ScheduleNow", "_wrap_Simulator_ScheduleNow",
|
||||
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
|
||||
|
||||
|
||||
## Simulator::ScheduleDestroy(callback, ...user..args...)
|
||||
Simulator.add_custom_method_wrapper("ScheduleDestroy", "_wrap_Simulator_ScheduleDestroy",
|
||||
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
|
||||
|
||||
|
||||
def CommandLine_customizations(module):
|
||||
CommandLine = module['ns3::CommandLine']
|
||||
CommandLine.add_method('Parse', None, [ArgvParam(None, 'argv')],
|
||||
is_static=False)
|
||||
|
||||
|
||||
def Object_customizations(module):
|
||||
## ---------------------------------------------------------------------
|
||||
## Here we generate custom constructor code for all classes that
|
||||
## derive from ns3::Object. The custom constructors are needed in
|
||||
## order to support kwargs only and to translate kwargs into ns3
|
||||
## attributes, etc.
|
||||
## ---------------------------------------------------------------------
|
||||
Object = module['ns3::Object']
|
||||
|
||||
|
||||
## add a GetTypeId method to all generatd helper classes
|
||||
def helper_class_hook(helper_class):
|
||||
decl = """
|
||||
static ns3::TypeId GetTypeId (void)
|
||||
{
|
||||
static ns3::TypeId tid = ns3::TypeId ("%s")
|
||||
.SetParent< %s > ()
|
||||
;
|
||||
return tid;
|
||||
}""" % (helper_class.name, helper_class.class_.full_name)
|
||||
|
||||
helper_class.add_custom_method(decl)
|
||||
helper_class.add_post_generation_code(
|
||||
"NS_OBJECT_ENSURE_REGISTERED (%s);" % helper_class.name)
|
||||
Object.add_helper_class_hook(helper_class_hook)
|
||||
|
||||
## Replace all class constructors with a generic constructor based on CreateObject<T> (AttributeList)
|
||||
module.header.writeln('''
|
||||
namespace ns3 {
|
||||
|
||||
void PythonCompleteConstruct (Ptr<Object> object, TypeId typeId, const AttributeList &attributes);
|
||||
|
||||
template <typename T>
|
||||
Ptr<T> CreateObjectPython (PyObject *pyobj, const AttributeList &attributes)
|
||||
{
|
||||
Ptr<T> p = Ptr<T> (new T (), false);
|
||||
p->set_pyobj (pyobj);
|
||||
PythonCompleteConstruct (p, T::GetTypeId (), attributes);
|
||||
return p;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
''')
|
||||
|
||||
for cls in module.classes:
|
||||
if not cls.is_subclass(Object):
|
||||
continue
|
||||
cls.constructors = [] # clear the list of constructors
|
||||
|
||||
## add our own custom constructor, if possible
|
||||
try:
|
||||
construct_name = cls.get_construct_name()
|
||||
except CodeGenerationError:
|
||||
construct_name = None
|
||||
|
||||
if construct_name and not cls.helper_class:
|
||||
construct_code = '''
|
||||
ns3::Ptr< %(CONSTRUCT_NAME)s > obj = ns3::CreateObject< %(CONSTRUCT_NAME)s > (attrList);
|
||||
obj->Ref ();
|
||||
self->obj = ns3::PeekPointer (obj);
|
||||
''' % dict (CONSTRUCT_NAME=construct_name)
|
||||
|
||||
elif not construct_name and not cls.helper_class:
|
||||
continue
|
||||
|
||||
elif not construct_name and cls.helper_class:
|
||||
construct_code = '''
|
||||
if (self->ob_type != &%(PYTYPESTRUCT)s)
|
||||
{
|
||||
ns3::Ptr< %(HELPER_CLASS_NAME)s > obj = ns3::CreateObjectPython< %(HELPER_CLASS_NAME)s > ((PyObject *)self, attrList);
|
||||
obj->Ref ();
|
||||
self->obj = ns3::PeekPointer (obj);
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "Class cannot be constructed (unless subclassed)");
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
''' % dict (CONSTRUCT_NAME=construct_name, HELPER_CLASS_NAME=cls.helper_class.name,
|
||||
PYTYPESTRUCT=cls.pytypestruct)
|
||||
|
||||
elif construct_name and cls.helper_class:
|
||||
construct_code = '''
|
||||
if (self->ob_type != &%(PYTYPESTRUCT)s)
|
||||
{
|
||||
ns3::Ptr< %(HELPER_CLASS_NAME)s > obj = ns3::CreateObjectPython< %(HELPER_CLASS_NAME)s > ((PyObject *)self, attrList);
|
||||
obj->Ref ();
|
||||
self->obj = ns3::PeekPointer (obj);
|
||||
} else {
|
||||
ns3::Ptr< %(CONSTRUCT_NAME)s > obj = ns3::CreateObject< %(CONSTRUCT_NAME)s > (attrList);
|
||||
obj->Ref ();
|
||||
self->obj = ns3::PeekPointer (obj);
|
||||
}
|
||||
''' % dict (CONSTRUCT_NAME=construct_name, HELPER_CLASS_NAME=cls.helper_class.name,
|
||||
PYTYPESTRUCT=cls.pytypestruct)
|
||||
else:
|
||||
raise AssertionError
|
||||
|
||||
wrapper_name = "_wrap_create_object_%s" % (cls.mangled_full_name,)
|
||||
constructor = '''
|
||||
static int %(WRAPPER_NAME)s (%(PYSTRUCT)s *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
|
||||
{
|
||||
if (PyTuple_Size(args)) {
|
||||
PyErr_SetString(PyExc_TypeError, "positional arguments not supported "
|
||||
"for ns3.Object constructors, only keyword arguments"
|
||||
" should be used (AttributeName=Value)");
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
ns3::AttributeList attrList;
|
||||
if (kwargs && KwargsToAttributeList(kwargs, %(CLASS_NAME)s::GetTypeId(), attrList)) {
|
||||
{
|
||||
PyObject *exc_type, *traceback;
|
||||
PyErr_Fetch(&exc_type, return_exception, &traceback);
|
||||
Py_XDECREF(exc_type);
|
||||
Py_XDECREF(traceback);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
%(CONSTRUCT_CODE)s
|
||||
PyNs3ObjectBase_wrapper_registry[(void *) self->obj] = (PyObject *) self;
|
||||
return 0;
|
||||
}
|
||||
''' % dict(WRAPPER_NAME=wrapper_name, PYSTRUCT=cls.pystruct, CLASS_NAME=cls.full_name,
|
||||
CONSTRUCT_CODE=construct_code, PURE_VIRTUALS=cls.have_pure_virtual_methods)
|
||||
cls.add_constructor(CustomCppConstructorWrapper(wrapper_name, constructor))
|
||||
|
||||
|
||||
# Generate conversion function from PyObject* to AttributeValue
|
||||
# sink = module.body
|
||||
# sink.writeln('''
|
||||
# Ptr<AttributeValue> AttributeValueFromPyObject (PyObject *obj)
|
||||
# {
|
||||
# // note: needs to check for bool first, because bool is a subclass of int
|
||||
# if (PyBool_Check(obj)) {
|
||||
# return Create<BooleanValue>(PyObject_IsTrue(obj));
|
||||
# } else if (PyInt_Check(obj)) {
|
||||
# return Create<IntegerValue>(PyInt_AsLong(obj));
|
||||
# } else if (PyLong_Check(obj)) {
|
||||
# return Create<IntegerValue>(PyLong_AsLongLong(obj));
|
||||
# } else if (PyFloat_Check(obj)) {
|
||||
# return Create<DoubleValue>(PyFloat_AsDouble(obj));
|
||||
# }
|
||||
|
||||
# ''')
|
||||
|
||||
|
||||
|
||||
## ---------------------------------------------------------------------
|
||||
## -------------- write the KwargsToAttributeList function -------------
|
||||
## ---------------------------------------------------------------------
|
||||
Attribute = module['ns3::AttributeValue']
|
||||
module.after_forward_declarations.writeln(
|
||||
'int KwargsToAttributeList(PyObject *kwargs, ns3::TypeId tid, ns3::AttributeList &oAttrList);')
|
||||
|
||||
module.body.writeln(
|
||||
'''
|
||||
int KwargsToAttributeList(PyObject *kwargs, ns3::TypeId tid, ns3::AttributeList &oAttrList)
|
||||
{
|
||||
PyObject *key, *value;
|
||||
Py_ssize_t pos = 0;
|
||||
|
||||
while (PyDict_Next(kwargs, &pos, &key, &value)) {
|
||||
if (!PyString_Check(key)) {
|
||||
PyErr_SetString(PyExc_TypeError, "kwargs keys must be strings");
|
||||
return -1;
|
||||
}
|
||||
if (PyObject_IsInstance(value, (PyObject*) &%s)) {
|
||||
oAttrList.SetWithTid(tid, PyString_AsString(key), *((%s *) value)->obj);''' \
|
||||
% (Attribute.pytypestruct, Attribute.pystruct))
|
||||
|
||||
for conversion_source in Attribute.get_all_implicit_conversions():
|
||||
module.body.writeln('''
|
||||
} else if (PyObject_IsInstance(value, (PyObject*) &%s)) {
|
||||
oAttrList.SetWithTid(tid, PyString_AsString(key), *((%s *) value)->obj);''' \
|
||||
% (conversion_source.pytypestruct, conversion_source.pystruct))
|
||||
|
||||
possible_type_names = ", ".join([cls.name for cls in [Attribute] + Attribute.get_all_implicit_conversions()])
|
||||
module.body.writeln('''
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, \"parameter must an instance of one of the types (%s), not %%s\", value->ob_type->tp_name);
|
||||
return -1;
|
||||
}''' % (possible_type_names))
|
||||
|
||||
module.body.writeln(
|
||||
'''
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
''')
|
||||
|
||||
|
||||
def Attribute_customizations(module):
|
||||
# Fix up for the "const AttributeValue &v = EmptyAttribute()"
|
||||
# case, as used extensively by helper classes.
|
||||
|
||||
# Here's why we need to do this: pybindgen.gccxmlscanner, when
|
||||
# scanning parameter default values, is only provided with the
|
||||
# value as a simple C expression string. (py)gccxml does not
|
||||
# report the type of the default value.
|
||||
|
||||
# As a workaround, here we iterate over all parameters of all
|
||||
# methods of all classes and tell pybindgen what is the type of
|
||||
# the default value for attributes.
|
||||
|
||||
for cls in module.classes:
|
||||
for meth in cls.get_all_methods():
|
||||
for param in meth.parameters:
|
||||
if isinstance(param, cppclass.CppClassRefParameter):
|
||||
if param.cpp_class.name == 'AttributeValue' \
|
||||
and param.default_value is not None \
|
||||
and param.default_value_type is None:
|
||||
param.default_value_type = 'ns3::EmptyAttributeValue'
|
||||
|
||||
|
||||
def TypeId_customizations(module):
|
||||
TypeId = module['ns3::TypeId']
|
||||
TypeId.add_custom_method_wrapper("LookupByNameFailSafe", "_wrap_TypeId_LookupByNameFailSafe",
|
||||
flags=["METH_VARARGS", "METH_KEYWORDS", "METH_STATIC"])
|
||||
|
||||
|
||||
712
bindings/python/ns3modulegen_generated.py
Normal file
712
bindings/python/ns3modulegen_generated.py
Normal file
@@ -0,0 +1,712 @@
|
||||
from pybindgen import Module, FileCodeSink, param, retval, cppclass
|
||||
|
||||
|
||||
import pybindgen.settings
|
||||
import warnings
|
||||
|
||||
class ErrorHandler(pybindgen.settings.ErrorHandler):
|
||||
def handle_error(self, wrapper, exception, traceback_):
|
||||
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
|
||||
return True
|
||||
pybindgen.settings.error_handler = ErrorHandler()
|
||||
|
||||
|
||||
import sys
|
||||
import ns3_module_core
|
||||
import ns3_module_simulator
|
||||
import ns3_module_mobility
|
||||
import ns3_module_common
|
||||
import ns3_module_contrib
|
||||
import ns3_module_node
|
||||
import ns3_module_point_to_point
|
||||
import ns3_module_stats
|
||||
import ns3_module_internet_stack
|
||||
import ns3_module_wifi
|
||||
import ns3_module_csma
|
||||
import ns3_module_bridge
|
||||
import ns3_module_packet_sink
|
||||
import ns3_module_global_routing
|
||||
import ns3_module_onoff
|
||||
import ns3_module_olsr
|
||||
import ns3_module_udp_echo
|
||||
import ns3_module_helper
|
||||
|
||||
def module_init():
|
||||
root_module = Module('ns3', cpp_namespace='::ns3')
|
||||
return root_module
|
||||
|
||||
def register_types(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
root_module.begin_section('ns3_module_core')
|
||||
ns3_module_core.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_core__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_core__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_core')
|
||||
root_module.begin_section('ns3_module_simulator')
|
||||
ns3_module_simulator.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_simulator__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_simulator__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_simulator')
|
||||
root_module.begin_section('ns3_module_mobility')
|
||||
ns3_module_mobility.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_mobility__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_mobility__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_mobility')
|
||||
root_module.begin_section('ns3_module_common')
|
||||
ns3_module_common.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_common__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_common__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_common')
|
||||
root_module.begin_section('ns3_module_contrib')
|
||||
ns3_module_contrib.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_contrib__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_contrib__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_contrib')
|
||||
root_module.begin_section('ns3_module_node')
|
||||
ns3_module_node.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_node__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_node__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_node')
|
||||
root_module.begin_section('ns3_module_point_to_point')
|
||||
ns3_module_point_to_point.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_point_to_point__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_point_to_point__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_point_to_point')
|
||||
root_module.begin_section('ns3_module_stats')
|
||||
ns3_module_stats.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_stats__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_stats__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_stats')
|
||||
root_module.begin_section('ns3_module_internet_stack')
|
||||
ns3_module_internet_stack.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_internet_stack__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_internet_stack__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_internet_stack')
|
||||
root_module.begin_section('ns3_module_wifi')
|
||||
ns3_module_wifi.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_wifi__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_wifi__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_wifi')
|
||||
root_module.begin_section('ns3_module_csma')
|
||||
ns3_module_csma.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_csma__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_csma__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_csma')
|
||||
root_module.begin_section('ns3_module_bridge')
|
||||
ns3_module_bridge.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_bridge__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_bridge__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_bridge')
|
||||
root_module.begin_section('ns3_module_packet_sink')
|
||||
ns3_module_packet_sink.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_packet_sink__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_packet_sink__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_packet_sink')
|
||||
root_module.begin_section('ns3_module_global_routing')
|
||||
ns3_module_global_routing.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_global_routing__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_global_routing__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_global_routing')
|
||||
root_module.begin_section('ns3_module_onoff')
|
||||
ns3_module_onoff.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_onoff__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_onoff__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_onoff')
|
||||
root_module.begin_section('ns3_module_olsr')
|
||||
ns3_module_olsr.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_olsr__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_olsr__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_olsr')
|
||||
root_module.begin_section('ns3_module_udp_echo')
|
||||
ns3_module_udp_echo.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_udp_echo__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_udp_echo__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_udp_echo')
|
||||
root_module.begin_section('ns3_module_helper')
|
||||
ns3_module_helper.register_types(module)
|
||||
|
||||
try:
|
||||
import ns3_module_helper__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_helper__local.register_types(module)
|
||||
|
||||
root_module.end_section('ns3_module_helper')
|
||||
module.add_container('std::vector< unsigned int >', 'unsigned int', container_type='vector')
|
||||
module.add_container('std::list< unsigned int >', 'unsigned int', container_type='list')
|
||||
|
||||
## Register a nested module for the namespace internal
|
||||
|
||||
nested_module = module.add_cpp_namespace('internal')
|
||||
register_types_ns3_internal(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace TimeStepPrecision
|
||||
|
||||
nested_module = module.add_cpp_namespace('TimeStepPrecision')
|
||||
register_types_ns3_TimeStepPrecision(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace Config
|
||||
|
||||
nested_module = module.add_cpp_namespace('Config')
|
||||
register_types_ns3_Config(nested_module)
|
||||
|
||||
|
||||
## Register a nested module for the namespace olsr
|
||||
|
||||
nested_module = module.add_cpp_namespace('olsr')
|
||||
register_types_ns3_olsr(nested_module)
|
||||
|
||||
|
||||
def register_types_ns3_internal(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_TimeStepPrecision(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_types_ns3_Config(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
module.add_container('std::vector< std::string >', 'std::string', container_type='vector')
|
||||
|
||||
def register_types_ns3_olsr(module):
|
||||
root_module = module.get_root()
|
||||
|
||||
|
||||
def register_methods(root_module):
|
||||
root_module.begin_section('ns3_module_core')
|
||||
ns3_module_core.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_core__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_core__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_core')
|
||||
root_module.begin_section('ns3_module_simulator')
|
||||
ns3_module_simulator.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_simulator__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_simulator__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_simulator')
|
||||
root_module.begin_section('ns3_module_mobility')
|
||||
ns3_module_mobility.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_mobility__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_mobility__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_mobility')
|
||||
root_module.begin_section('ns3_module_common')
|
||||
ns3_module_common.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_common__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_common__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_common')
|
||||
root_module.begin_section('ns3_module_contrib')
|
||||
ns3_module_contrib.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_contrib__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_contrib__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_contrib')
|
||||
root_module.begin_section('ns3_module_node')
|
||||
ns3_module_node.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_node__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_node__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_node')
|
||||
root_module.begin_section('ns3_module_point_to_point')
|
||||
ns3_module_point_to_point.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_point_to_point__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_point_to_point__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_point_to_point')
|
||||
root_module.begin_section('ns3_module_stats')
|
||||
ns3_module_stats.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_stats__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_stats__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_stats')
|
||||
root_module.begin_section('ns3_module_internet_stack')
|
||||
ns3_module_internet_stack.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_internet_stack__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_internet_stack__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_internet_stack')
|
||||
root_module.begin_section('ns3_module_wifi')
|
||||
ns3_module_wifi.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_wifi__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_wifi__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_wifi')
|
||||
root_module.begin_section('ns3_module_csma')
|
||||
ns3_module_csma.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_csma__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_csma__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_csma')
|
||||
root_module.begin_section('ns3_module_bridge')
|
||||
ns3_module_bridge.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_bridge__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_bridge__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_bridge')
|
||||
root_module.begin_section('ns3_module_packet_sink')
|
||||
ns3_module_packet_sink.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_packet_sink__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_packet_sink__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_packet_sink')
|
||||
root_module.begin_section('ns3_module_global_routing')
|
||||
ns3_module_global_routing.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_global_routing__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_global_routing__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_global_routing')
|
||||
root_module.begin_section('ns3_module_onoff')
|
||||
ns3_module_onoff.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_onoff__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_onoff__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_onoff')
|
||||
root_module.begin_section('ns3_module_olsr')
|
||||
ns3_module_olsr.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_olsr__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_olsr__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_olsr')
|
||||
root_module.begin_section('ns3_module_udp_echo')
|
||||
ns3_module_udp_echo.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_udp_echo__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_udp_echo__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_udp_echo')
|
||||
root_module.begin_section('ns3_module_helper')
|
||||
ns3_module_helper.register_methods(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_helper__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_helper__local.register_methods(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_helper')
|
||||
return
|
||||
|
||||
def register_functions(root_module):
|
||||
module = root_module
|
||||
root_module.begin_section('ns3_module_core')
|
||||
ns3_module_core.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_core__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_core__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_core')
|
||||
root_module.begin_section('ns3_module_simulator')
|
||||
ns3_module_simulator.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_simulator__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_simulator__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_simulator')
|
||||
root_module.begin_section('ns3_module_mobility')
|
||||
ns3_module_mobility.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_mobility__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_mobility__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_mobility')
|
||||
root_module.begin_section('ns3_module_common')
|
||||
ns3_module_common.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_common__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_common__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_common')
|
||||
root_module.begin_section('ns3_module_contrib')
|
||||
ns3_module_contrib.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_contrib__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_contrib__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_contrib')
|
||||
root_module.begin_section('ns3_module_node')
|
||||
ns3_module_node.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_node__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_node__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_node')
|
||||
root_module.begin_section('ns3_module_point_to_point')
|
||||
ns3_module_point_to_point.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_point_to_point__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_point_to_point__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_point_to_point')
|
||||
root_module.begin_section('ns3_module_stats')
|
||||
ns3_module_stats.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_stats__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_stats__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_stats')
|
||||
root_module.begin_section('ns3_module_internet_stack')
|
||||
ns3_module_internet_stack.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_internet_stack__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_internet_stack__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_internet_stack')
|
||||
root_module.begin_section('ns3_module_wifi')
|
||||
ns3_module_wifi.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_wifi__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_wifi__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_wifi')
|
||||
root_module.begin_section('ns3_module_csma')
|
||||
ns3_module_csma.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_csma__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_csma__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_csma')
|
||||
root_module.begin_section('ns3_module_bridge')
|
||||
ns3_module_bridge.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_bridge__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_bridge__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_bridge')
|
||||
root_module.begin_section('ns3_module_packet_sink')
|
||||
ns3_module_packet_sink.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_packet_sink__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_packet_sink__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_packet_sink')
|
||||
root_module.begin_section('ns3_module_global_routing')
|
||||
ns3_module_global_routing.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_global_routing__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_global_routing__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_global_routing')
|
||||
root_module.begin_section('ns3_module_onoff')
|
||||
ns3_module_onoff.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_onoff__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_onoff__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_onoff')
|
||||
root_module.begin_section('ns3_module_olsr')
|
||||
ns3_module_olsr.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_olsr__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_olsr__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_olsr')
|
||||
root_module.begin_section('ns3_module_udp_echo')
|
||||
ns3_module_udp_echo.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_udp_echo__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_udp_echo__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_udp_echo')
|
||||
root_module.begin_section('ns3_module_helper')
|
||||
ns3_module_helper.register_functions(root_module)
|
||||
|
||||
try:
|
||||
import ns3_module_helper__local
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
ns3_module_helper__local.register_functions(root_module)
|
||||
|
||||
root_module.end_section('ns3_module_helper')
|
||||
register_functions_ns3_internal(module.get_submodule('internal'), root_module)
|
||||
register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
|
||||
register_functions_ns3_Config(module.get_submodule('Config'), root_module)
|
||||
register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
|
||||
return
|
||||
|
||||
def register_functions_ns3_internal(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_TimeStepPrecision(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_Config(module, root_module):
|
||||
return
|
||||
|
||||
def register_functions_ns3_olsr(module, root_module):
|
||||
return
|
||||
|
||||
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)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
295
bindings/python/ns3modulescan.py
Normal file
295
bindings/python/ns3modulescan.py
Normal file
@@ -0,0 +1,295 @@
|
||||
#! /usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
import pybindgen.settings
|
||||
from pybindgen.gccxmlparser import ModuleParser, PygenClassifier, PygenSection, WrapperWarning
|
||||
from pybindgen.typehandlers.codesink import FileCodeSink
|
||||
from pygccxml.declarations import templates
|
||||
from pygccxml.declarations.class_declaration import class_t
|
||||
from pygccxml.declarations.calldef import free_function_t, member_function_t, constructor_t
|
||||
|
||||
|
||||
## we need the smart pointer type transformation to be active even
|
||||
## during gccxml scanning.
|
||||
import ns3modulegen_core_customizations
|
||||
|
||||
|
||||
## silence gccxmlparser errors; we only want error handling in the
|
||||
## generated python script, not while scanning.
|
||||
class ErrorHandler(pybindgen.settings.ErrorHandler):
|
||||
def handle_error(self, dummy_wrapper, dummy_exception, dummy_traceback_):
|
||||
return True
|
||||
pybindgen.settings.error_handler = ErrorHandler()
|
||||
import warnings
|
||||
warnings.filterwarnings(category=WrapperWarning, action='ignore')
|
||||
|
||||
type_annotations = {
|
||||
'::ns3::RefCountBase': {
|
||||
'incref_method': 'Ref',
|
||||
'decref_method': 'Unref',
|
||||
'peekref_method': 'GetReferenceCount',
|
||||
'automatic_type_narrowing': 'true',
|
||||
},
|
||||
'::ns3::Object': {
|
||||
'incref_method': 'Ref',
|
||||
'decref_method': 'Unref',
|
||||
'peekref_method': 'GetReferenceCount',
|
||||
'automatic_type_narrowing': 'true',
|
||||
},
|
||||
'::ns3::Packet': {
|
||||
'incref_method': 'Ref',
|
||||
'decref_method': 'Unref',
|
||||
'peekref_method': 'GetReferenceCount',
|
||||
},
|
||||
'::ns3::CallbackImplBase': {
|
||||
'incref_method': 'Ref',
|
||||
'decref_method': 'Unref',
|
||||
'peekref_method': 'GetReferenceCount',
|
||||
},
|
||||
'::ns3::AttributeChecker': {
|
||||
'automatic_type_narrowing': 'true',
|
||||
'allow_subclassing': 'false',
|
||||
},
|
||||
'::ns3::AttributeValue': {
|
||||
'automatic_type_narrowing': 'true',
|
||||
'allow_subclassing': 'false',
|
||||
},
|
||||
'ns3::RandomVariable::RandomVariable(ns3::RandomVariableBase const & variable) [constructor]': {
|
||||
'ignore': None,
|
||||
},
|
||||
'ns3::RandomVariableBase * ns3::RandomVariable::Peek() const [member function]': {
|
||||
'ignore': None,
|
||||
},
|
||||
'void ns3::RandomVariable::GetSeed(uint32_t * seed) const [member function]': {
|
||||
'params': {'seed':{'direction':'out',
|
||||
'array_length':'6'}}
|
||||
},
|
||||
'bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInfo * info) const [member function]': {
|
||||
'params': {'info':{'transfer_ownership': 'false'}}
|
||||
},
|
||||
'static bool ns3::TypeId::LookupByNameFailSafe(std::string name, ns3::TypeId * tid) [member function]': {
|
||||
'ignore': None, # manually wrapped in
|
||||
},
|
||||
'bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]': {
|
||||
'params': {'obj': {'transfer_ownership':'false'}}
|
||||
},
|
||||
'bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]': {
|
||||
'params': {'obj': {'transfer_ownership':'false'}}
|
||||
},
|
||||
'bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function]': {
|
||||
'params': {'obj': {'transfer_ownership':'false'}}
|
||||
},
|
||||
'bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function]': {
|
||||
'params': {'obj': {'transfer_ownership':'false'}}
|
||||
},
|
||||
'bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]': {
|
||||
'params': {'object': {'transfer_ownership':'false'}}
|
||||
},
|
||||
'ns3::EmpiricalVariable::EmpiricalVariable(ns3::RandomVariableBase const & variable) [constructor]': {
|
||||
'ignore': None
|
||||
},
|
||||
'static ns3::AttributeList * ns3::AttributeList::GetGlobal() [member function]': {
|
||||
'caller_owns_return': 'false'
|
||||
},
|
||||
'void ns3::CommandLine::Parse(int argc, char * * argv) const [member function]': {
|
||||
'ignore': None # manually wrapped
|
||||
},
|
||||
'extern void ns3::PythonCompleteConstruct(ns3::Ptr<ns3::Object> object, ns3::TypeId typeId, ns3::AttributeList const & attributes) [free function]': {
|
||||
'ignore': None # used transparently by, should not be wrapped
|
||||
},
|
||||
}
|
||||
|
||||
def get_ns3_relative_path(path):
|
||||
l = []
|
||||
head = path
|
||||
while head:
|
||||
head, tail = os.path.split(head)
|
||||
if tail == 'ns3':
|
||||
return os.path.join(*l)
|
||||
l.insert(0, tail)
|
||||
raise AssertionError("is the path %r inside ns3?!" % path)
|
||||
|
||||
|
||||
def pre_scan_hook(dummy_module_parser,
|
||||
pygccxml_definition,
|
||||
global_annotations,
|
||||
parameter_annotations):
|
||||
ns3_header = get_ns3_relative_path(pygccxml_definition.location.file_name)
|
||||
|
||||
## Note: we don't include line numbers in the comments because
|
||||
## those numbers are very likely to change frequently, which would
|
||||
## cause needless changes, since the generated python files are
|
||||
## kept under version control.
|
||||
|
||||
#global_annotations['pygen_comment'] = "%s:%i: %s" % \
|
||||
# (ns3_header, pygccxml_definition.location.line, pygccxml_definition)
|
||||
global_annotations['pygen_comment'] = "%s: %s" % \
|
||||
(ns3_header, pygccxml_definition)
|
||||
|
||||
|
||||
## handle ns3::Object::GetObject (left to its own devices,
|
||||
## pybindgen will generate a mangled name containing the template
|
||||
## argument type name).
|
||||
if isinstance(pygccxml_definition, member_function_t) \
|
||||
and pygccxml_definition.parent.name == 'Object' \
|
||||
and pygccxml_definition.name == 'GetObject':
|
||||
template_args = templates.args(pygccxml_definition.demangled_name)
|
||||
if template_args == ['ns3::Object']:
|
||||
global_annotations['template_instance_names'] = 'ns3::Object=>GetObject'
|
||||
|
||||
## Don't wrap Simulator::Schedule* (manually wrapped)
|
||||
if isinstance(pygccxml_definition, member_function_t) \
|
||||
and pygccxml_definition.parent.name == 'Simulator' \
|
||||
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...
|
||||
if pygccxml_definition.name.endswith('Helper'):
|
||||
global_annotations['allow_subclassing'] = 'false'
|
||||
|
||||
if pygccxml_definition.decl_string.startswith('::ns3::Callback<'):
|
||||
# manually handled in ns3modulegen_core_customizations.py
|
||||
global_annotations['ignore'] = None
|
||||
return
|
||||
|
||||
if pygccxml_definition.decl_string.startswith('::ns3::TracedCallback<'):
|
||||
global_annotations['ignore'] = None
|
||||
return
|
||||
|
||||
if pygccxml_definition.decl_string.startswith('::ns3::Ptr<'):
|
||||
# handled by pybindgen "type transformation"
|
||||
global_annotations['ignore'] = None
|
||||
return
|
||||
|
||||
# table driven class customization
|
||||
try:
|
||||
annotations = type_annotations[pygccxml_definition.decl_string]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
global_annotations.update(annotations)
|
||||
|
||||
## free functions
|
||||
if isinstance(pygccxml_definition, free_function_t):
|
||||
if pygccxml_definition.name == 'PeekPointer':
|
||||
global_annotations['ignore'] = None
|
||||
return
|
||||
|
||||
## table driven methods/constructors/functions customization
|
||||
if isinstance(pygccxml_definition, (free_function_t, member_function_t, constructor_t)):
|
||||
try:
|
||||
annotations = type_annotations[str(pygccxml_definition)]
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
for key,value in annotations.items():
|
||||
if key == 'params':
|
||||
parameter_annotations.update (value)
|
||||
del annotations['params']
|
||||
global_annotations.update(annotations)
|
||||
|
||||
|
||||
# def post_scan_hook(dummy_module_parser, dummy_pygccxml_definition, pybindgen_wrapper):
|
||||
# ## classes
|
||||
# if isinstance(pybindgen_wrapper, CppClass):
|
||||
# if pybindgen_wrapper.name.endswith('Checker'):
|
||||
# print >> sys.stderr, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", pybindgen_wrapper
|
||||
# #pybindgen_wrapper.set_instance_creation_function(AttributeChecker_instance_creation_function)
|
||||
|
||||
|
||||
def scan_callback_classes(module_parser, callback_classes_file):
|
||||
callback_classes_file.write("callback_classes = [\n")
|
||||
for cls in module_parser.module_namespace.classes(function=module_parser.location_filter,
|
||||
recursive=False):
|
||||
if not cls.name.startswith("Callback<"):
|
||||
continue
|
||||
assert templates.is_instantiation(cls.decl_string), "%s is not a template instantiation" % cls
|
||||
dummy_cls_name, template_parameters = templates.split(cls.decl_string)
|
||||
callback_classes_file.write(" %r,\n" % template_parameters)
|
||||
callback_classes_file.write("]\n")
|
||||
|
||||
|
||||
class MyPygenClassifier(PygenClassifier):
|
||||
def __init__(self, headers_map):
|
||||
self.headers_map = headers_map
|
||||
|
||||
def classify(self, pygccxml_definition):
|
||||
name = os.path.basename(pygccxml_definition.location.file_name)
|
||||
try:
|
||||
return self.headers_map[name]
|
||||
except KeyError:
|
||||
return '__main__'
|
||||
|
||||
|
||||
def ns3_module_scan(top_builddir, pygen_file_name, everything_h):
|
||||
|
||||
ns3_modules = eval(sys.stdin.read())
|
||||
|
||||
## do a topological sort on the modules graph
|
||||
from topsort import topsort
|
||||
graph = []
|
||||
for ns3_module_name, (ns3_module_deps, dummy) in ns3_modules.iteritems():
|
||||
for dep in ns3_module_deps:
|
||||
graph.append((dep, ns3_module_name))
|
||||
sorted_ns3_modules = topsort(graph)
|
||||
#print >> sys.stderr, "******* topological sort: ", sorted_ns3_modules
|
||||
|
||||
sections = [PygenSection('__main__', FileCodeSink(open(pygen_file_name, "wt")))]
|
||||
headers_map = {} # header_name -> section_name
|
||||
for ns3_module in sorted_ns3_modules:
|
||||
section_name = "ns3_module_%s" % ns3_module.replace('-', '_')
|
||||
file_name = os.path.join(os.path.dirname(pygen_file_name), "%s.py" % section_name)
|
||||
sections.append(PygenSection(section_name, FileCodeSink(open(file_name, "wt")),
|
||||
section_name + "__local"))
|
||||
for header in ns3_modules[ns3_module][1]:
|
||||
headers_map[header] = section_name
|
||||
|
||||
module_parser = ModuleParser('ns3', 'ns3')
|
||||
|
||||
module_parser.add_pre_scan_hook(pre_scan_hook)
|
||||
#module_parser.add_post_scan_hook(post_scan_hook)
|
||||
|
||||
gccxml_options = dict(
|
||||
include_paths=[top_builddir],
|
||||
define_symbols={
|
||||
#'NS3_ASSERT_ENABLE': None,
|
||||
#'NS3_LOG_ENABLE': None,
|
||||
}
|
||||
)
|
||||
|
||||
module_parser.parse_init([everything_h],
|
||||
None, whitelist_paths=[top_builddir, os.path.dirname(everything_h)],
|
||||
#includes=['"ns3/everything.h"'],
|
||||
pygen_sink=sections,
|
||||
pygen_classifier=MyPygenClassifier(headers_map),
|
||||
gccxml_options=gccxml_options)
|
||||
module_parser.scan_types()
|
||||
|
||||
callback_classes_file = open(os.path.join(os.path.dirname(pygen_file_name), "callbacks_list.py"), "wt")
|
||||
scan_callback_classes(module_parser, callback_classes_file)
|
||||
callback_classes_file.close()
|
||||
|
||||
|
||||
module_parser.scan_methods()
|
||||
module_parser.scan_functions()
|
||||
module_parser.parse_finalize()
|
||||
|
||||
for section in sections:
|
||||
section.code_sink.file.close()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ns3_module_scan(sys.argv[1], sys.argv[3], sys.argv[2])
|
||||
|
||||
909
bindings/python/rad_util.py
Normal file
909
bindings/python/rad_util.py
Normal file
@@ -0,0 +1,909 @@
|
||||
# Copyright (c) 2007 RADLogic
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
"""Provide various handy Python functions.
|
||||
|
||||
Running this script directly will execute the doctests.
|
||||
|
||||
Functions:
|
||||
int2bin(i, n) -- Convert integer to binary string.
|
||||
bin2int(bin_string) -- Convert binary string to integer.
|
||||
reverse(input_string) -- Reverse a string.
|
||||
transpose(matrix) -- Transpose a list of lists.
|
||||
polygon_area(points_list) -- Calculate the area of an arbitrary polygon.
|
||||
timestamp() -- Return string containing current time stamp.
|
||||
pt2str(point) -- Return prettier string version of point tuple.
|
||||
gcf(a, b) -- Return the greatest common factor of two numbers.
|
||||
lcm(a, b) -- Return the least common multiple of two numbers.
|
||||
permutations(input_list) -- Generate all permutations of a list of items.
|
||||
reduce_fraction(fraction) -- Reduce fraction (num, denom) to simplest form.
|
||||
quantile(l, p) -- Return p quantile of list l. E.g. p=0.25 for q1.
|
||||
trim(l) -- Discard values in list more than 1.5*IQR outside IQR.
|
||||
nice_units(value) -- Return value converted to human readable units.
|
||||
uniquify(seq) -- Return sequence with duplicate items in sequence seq removed.
|
||||
reverse_dict(d) -- Return the dictionary with the items as keys and vice-versa.
|
||||
lsb(x, n) -- Return the n least significant bits of x.
|
||||
gray_encode(i) -- Gray encode the given integer.
|
||||
random_vec(bits, max_value=None) -- Return a random binary vector.
|
||||
binary_range(bits) -- Return list of all possible binary numbers width=bits.
|
||||
float_range([start], stop, [step]) -- Return range of floats.
|
||||
find_common_fixes(s1, s2) -- Find common (prefix, suffix) of two strings.
|
||||
is_rotated(seq1, seq2) -- Return true if the list is a rotation of other list.
|
||||
getmodule(obj) -- Return the module that contains the object definition of obj.
|
||||
(use inspect.getmodule instead, though)
|
||||
get_args(argv) -- Store command-line args in a dictionary.
|
||||
|
||||
This module requires Python >= 2.2
|
||||
|
||||
"""
|
||||
__author__ = 'Tim Wegener <twegener@radlogic.com.au>'
|
||||
__date__ = '$Date: 2007/03/27 03:15:06 $'
|
||||
__version__ = '$Revision: 0.45 $'
|
||||
__credits__ = """
|
||||
David Chandler, for polygon area algorithm.
|
||||
(http://www.davidchandler.com/AreaOfAGeneralPolygon.pdf)
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import random
|
||||
|
||||
try:
|
||||
True, False
|
||||
except NameError:
|
||||
True, False = (1==1, 0==1)
|
||||
|
||||
|
||||
def int2bin(i, n):
|
||||
"""Convert decimal integer i to n-bit binary number (string).
|
||||
|
||||
>>> int2bin(0, 8)
|
||||
'00000000'
|
||||
|
||||
>>> int2bin(123, 8)
|
||||
'01111011'
|
||||
|
||||
>>> int2bin(123L, 8)
|
||||
'01111011'
|
||||
|
||||
>>> int2bin(15, 2)
|
||||
Traceback (most recent call last):
|
||||
ValueError: Value too large for given number of bits.
|
||||
|
||||
"""
|
||||
hex2bin = {'0': '0000', '1': '0001', '2': '0010', '3': '0011',
|
||||
'4': '0100', '5': '0101', '6': '0110', '7': '0111',
|
||||
'8': '1000', '9': '1001', 'a': '1010', 'b': '1011',
|
||||
'c': '1100', 'd': '1101', 'e': '1110', 'f': '1111'}
|
||||
# Convert to hex then map each hex digit to binary equivalent.
|
||||
result = ''.join([hex2bin[x] for x in hex(i).lower().replace('l','')[2:]])
|
||||
|
||||
# Shrink result to appropriate length.
|
||||
# Raise an error if the value is changed by the truncation.
|
||||
if '1' in result[:-n]:
|
||||
raise ValueError("Value too large for given number of bits.")
|
||||
result = result[-n:]
|
||||
# Zero-pad if length longer than mapped result.
|
||||
result = '0'*(n-len(result)) + result
|
||||
return result
|
||||
|
||||
|
||||
def bin2int(bin_string):
|
||||
"""Convert binary number string to decimal integer.
|
||||
|
||||
Note: Python > v2 has int(bin_string, 2)
|
||||
|
||||
>>> bin2int('1111')
|
||||
15
|
||||
|
||||
>>> bin2int('0101')
|
||||
5
|
||||
|
||||
"""
|
||||
## result = 0
|
||||
## bin_list = list(bin_string)
|
||||
## if len(filter(lambda x: x in ('1','0'), bin_list)) < len(bin_list):
|
||||
## raise Exception ("bin2int: Error - not a binary number: %s"
|
||||
## % bin_string)
|
||||
## bit_list = map(int, bin_list)
|
||||
## bit_list.reverse() # Make most significant bit have highest index.
|
||||
## for bit_place in range(len(bit_list)):
|
||||
## result = result + ((2**bit_place) * bit_list[bit_place])
|
||||
## return result
|
||||
return int(bin_string, 2)
|
||||
|
||||
|
||||
def reverse(input_string):
|
||||
"""Reverse a string. Useful for strings of binary numbers.
|
||||
|
||||
>>> reverse('abc')
|
||||
'cba'
|
||||
|
||||
"""
|
||||
str_list = list(input_string)
|
||||
str_list.reverse()
|
||||
return ''.join(str_list)
|
||||
|
||||
|
||||
def transpose(matrix):
|
||||
"""Transpose a list of lists.
|
||||
|
||||
>>> transpose([['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']])
|
||||
[['a', 'd', 'g'], ['b', 'e', 'h'], ['c', 'f', 'i']]
|
||||
|
||||
>>> transpose([['a', 'b', 'c'], ['d', 'e', 'f']])
|
||||
[['a', 'd'], ['b', 'e'], ['c', 'f']]
|
||||
|
||||
>>> transpose([['a', 'b'], ['d', 'e'], ['g', 'h']])
|
||||
[['a', 'd', 'g'], ['b', 'e', 'h']]
|
||||
|
||||
"""
|
||||
result = zip(*matrix)
|
||||
# Convert list of tuples to list of lists.
|
||||
# map is faster than a list comprehension since it is being used with
|
||||
# a built-in function as an argument.
|
||||
result = map(list, result)
|
||||
return result
|
||||
|
||||
|
||||
def polygon_area(points_list, precision=100):
|
||||
"""Calculate area of an arbitrary polygon using an algorithm from the web.
|
||||
|
||||
Return the area of the polygon as a positive float.
|
||||
|
||||
Arguments:
|
||||
points_list -- list of point tuples [(x0, y0), (x1, y1), (x2, y2), ...]
|
||||
(Unclosed polygons will be closed automatically.
|
||||
precision -- Internal arithmetic precision (integer arithmetic).
|
||||
|
||||
>>> polygon_area([(0, 0), (0, 1), (1, 1), (1, 2), (2, 2), (2, 0), (0, 0)])
|
||||
3.0
|
||||
|
||||
Credits:
|
||||
Area of a General Polygon by David Chandler
|
||||
http://www.davidchandler.com/AreaOfAGeneralPolygon.pdf
|
||||
|
||||
"""
|
||||
# Scale up co-ordinates and convert them to integers.
|
||||
for i in range(len(points_list)):
|
||||
points_list[i] = (int(points_list[i][0] * precision),
|
||||
int(points_list[i][1] * precision))
|
||||
# Close polygon if not closed.
|
||||
if points_list[-1] != points_list[0]:
|
||||
points_list.append(points_list[0])
|
||||
# Calculate area.
|
||||
area = 0
|
||||
for i in range(len(points_list)-1):
|
||||
(x_i, y_i) = points_list[i]
|
||||
(x_i_plus_1, y_i_plus_1) = points_list[i+1]
|
||||
area = area + (x_i_plus_1 * y_i) - (y_i_plus_1 * x_i)
|
||||
area = abs(area / 2)
|
||||
# Unscale area.
|
||||
area = float(area)/(precision**2)
|
||||
return area
|
||||
|
||||
|
||||
def timestamp():
|
||||
"""Return string containing current time stamp.
|
||||
|
||||
Note: In Python 2 onwards can use time.asctime() with no arguments.
|
||||
|
||||
"""
|
||||
|
||||
return time.asctime()
|
||||
|
||||
|
||||
def pt2str(point):
|
||||
"""Return prettier string version of point tuple.
|
||||
|
||||
>>> pt2str((1.8, 1.9))
|
||||
'(1.8, 1.9)'
|
||||
|
||||
"""
|
||||
return "(%s, %s)" % (str(point[0]), str(point[1]))
|
||||
|
||||
|
||||
def gcf(a, b, epsilon=1e-16):
|
||||
"""Return the greatest common factor of a and b, using Euclidean algorithm.
|
||||
|
||||
Arguments:
|
||||
a, b -- two numbers
|
||||
If both numbers are integers return an integer result,
|
||||
otherwise return a float result.
|
||||
epsilon -- floats less than this magnitude are considered to be zero
|
||||
(default: 1e-16)
|
||||
|
||||
Examples:
|
||||
|
||||
>>> gcf(12, 34)
|
||||
2
|
||||
|
||||
>>> gcf(13.5, 4)
|
||||
0.5
|
||||
|
||||
>>> gcf(-2, 4)
|
||||
2
|
||||
|
||||
>>> gcf(5, 0)
|
||||
5
|
||||
|
||||
By (a convenient) definition:
|
||||
>>> gcf(0, 0)
|
||||
0
|
||||
|
||||
"""
|
||||
result = max(a, b)
|
||||
remainder = min(a, b)
|
||||
while remainder and abs(remainder) > epsilon:
|
||||
new_remainder = result % remainder
|
||||
result = remainder
|
||||
remainder = new_remainder
|
||||
return abs(result)
|
||||
|
||||
def lcm(a, b, precision=None):
|
||||
"""Return the least common multiple of a and b, using the gcf function.
|
||||
|
||||
Arguments:
|
||||
a, b -- two numbers. If both are integers return an integer result,
|
||||
otherwise a return a float result.
|
||||
precision -- scaling factor if a and/or b are floats.
|
||||
|
||||
>>> lcm(21, 6)
|
||||
42
|
||||
|
||||
>>> lcm(2.5, 3.5)
|
||||
17.5
|
||||
|
||||
>>> str(lcm(1.5e-8, 2.5e-8, precision=1e9))
|
||||
'7.5e-08'
|
||||
|
||||
By (an arbitary) definition:
|
||||
>>> lcm(0, 0)
|
||||
0
|
||||
|
||||
"""
|
||||
# Note: Dummy precision argument is for backwards compatibility.
|
||||
# Do the division first.
|
||||
# (See http://en.wikipedia.org/wiki/Least_common_multiple )
|
||||
denom = gcf(a, b)
|
||||
if denom == 0:
|
||||
result = 0
|
||||
else:
|
||||
result = a * (b / denom)
|
||||
return result
|
||||
|
||||
|
||||
def permutations(input_list):
|
||||
"""Return a list containing all permutations of the input list.
|
||||
|
||||
Note: This is a recursive function.
|
||||
|
||||
>>> perms = permutations(['a', 'b', 'c'])
|
||||
>>> perms.sort()
|
||||
>>> for perm in perms:
|
||||
... print perm
|
||||
['a', 'b', 'c']
|
||||
['a', 'c', 'b']
|
||||
['b', 'a', 'c']
|
||||
['b', 'c', 'a']
|
||||
['c', 'a', 'b']
|
||||
['c', 'b', 'a']
|
||||
|
||||
"""
|
||||
out_lists = []
|
||||
if len(input_list) > 1:
|
||||
# Extract first item in list.
|
||||
item = input_list[0]
|
||||
# Find all permutations of remainder of list. (Recursive call.)
|
||||
sub_lists = permutations(input_list[1:])
|
||||
# For every permutation of the sub list...
|
||||
for sub_list in sub_lists:
|
||||
# Insert the extracted first item at every position of the list.
|
||||
for i in range(len(input_list)):
|
||||
new_list = sub_list[:]
|
||||
new_list.insert(i, item)
|
||||
out_lists.append(new_list)
|
||||
else:
|
||||
# Termination condition: only one item in input list.
|
||||
out_lists = [input_list]
|
||||
return out_lists
|
||||
|
||||
|
||||
def reduce_fraction(fraction):
|
||||
"""Reduce fraction tuple to simplest form. fraction=(num, denom)
|
||||
|
||||
>>> reduce_fraction((14, 7))
|
||||
(2, 1)
|
||||
|
||||
>>> reduce_fraction((-2, 4))
|
||||
(-1, 2)
|
||||
|
||||
>>> reduce_fraction((0, 4))
|
||||
(0, 1)
|
||||
|
||||
>>> reduce_fraction((4, 0))
|
||||
(1, 0)
|
||||
|
||||
"""
|
||||
(numerator, denominator) = fraction
|
||||
common_factor = abs(gcf(numerator, denominator))
|
||||
result = (numerator/common_factor, denominator/common_factor)
|
||||
return result
|
||||
|
||||
|
||||
def quantile(l, p):
|
||||
"""Return p quantile of list l. E.g. p=0.25 for q1.
|
||||
|
||||
See:
|
||||
http://rweb.stat.umn.edu/R/library/base/html/quantile.html
|
||||
|
||||
"""
|
||||
l_sort = l[:]
|
||||
l_sort.sort()
|
||||
n = len(l)
|
||||
r = 1 + ((n - 1) * p)
|
||||
i = int(r)
|
||||
f = r - i
|
||||
if i < n:
|
||||
result = (1-f)*l_sort[i-1] + f*l_sort[i]
|
||||
else:
|
||||
result = l_sort[i-1]
|
||||
return result
|
||||
|
||||
|
||||
def trim(l):
|
||||
"""Discard values in list more than 1.5*IQR outside IQR.
|
||||
|
||||
(IQR is inter-quartile-range)
|
||||
|
||||
This function uses rad_util.quantile
|
||||
|
||||
1.5*IQR -- mild outlier
|
||||
3*IQR -- extreme outlier
|
||||
|
||||
See:
|
||||
http://wind.cc.whecn.edu/~pwildman/statnew/section_7_-_exploratory_data_analysis.htm
|
||||
|
||||
"""
|
||||
l_sort = l[:]
|
||||
l_sort.sort()
|
||||
# Calculate medianscore (based on stats.py lmedianscore by Gary Strangman)
|
||||
if len(l_sort) % 2 == 0:
|
||||
# If even number of scores, average middle 2.
|
||||
index = int(len(l_sort) / 2) # Integer division correct
|
||||
median = float(l_sort[index] + l_sort[index-1]) / 2
|
||||
else:
|
||||
# int divsion gives mid value when count from 0
|
||||
index = int(len(l_sort) / 2)
|
||||
median = l_sort[index]
|
||||
# Calculate IQR.
|
||||
q1 = quantile(l_sort, 0.25)
|
||||
q3 = quantile(l_sort, 0.75)
|
||||
iqr = q3 - q1
|
||||
iqr_extra = iqr * 1.5
|
||||
def in_interval(x, i=iqr_extra, q1=q1, q3=q3):
|
||||
return (x >= q1-i and x <= q3+i)
|
||||
l_trimmed = [x for x in l_sort if in_interval(x)]
|
||||
return l_trimmed
|
||||
|
||||
|
||||
def nice_units(value, dp=0, sigfigs=None, suffix='', space=' ',
|
||||
use_extra_prefixes=False, use_full_name=False, mode='si'):
|
||||
"""Return value converted to human readable units eg milli, micro, etc.
|
||||
|
||||
Arguments:
|
||||
value -- number in base units
|
||||
dp -- number of decimal places to display (rounded)
|
||||
sigfigs -- number of significant figures to display (rounded)
|
||||
This overrides dp if set.
|
||||
suffix -- optional unit suffix to append to unit multiplier
|
||||
space -- seperator between value and unit multiplier (default: ' ')
|
||||
use_extra_prefixes -- use hecto, deka, deci and centi as well if set.
|
||||
(default: False)
|
||||
use_full_name -- use full name for multiplier symbol,
|
||||
e.g. milli instead of m
|
||||
(default: False)
|
||||
mode -- 'si' for SI prefixes, 'bin' for binary multipliers (1024, etc.)
|
||||
(Default: 'si')
|
||||
|
||||
SI prefixes from:
|
||||
http://physics.nist.gov/cuu/Units/prefixes.html
|
||||
(Greek mu changed to u.)
|
||||
Binary prefixes based on:
|
||||
http://physics.nist.gov/cuu/Units/binary.html
|
||||
|
||||
>>> nice_units(2e-11)
|
||||
'20 p'
|
||||
|
||||
>>> nice_units(2e-11, space='')
|
||||
'20p'
|
||||
|
||||
"""
|
||||
si_prefixes = {1e24: ('Y', 'yotta'),
|
||||
1e21: ('Z', 'zetta'),
|
||||
1e18: ('E', 'exa'),
|
||||
1e15: ('P', 'peta'),
|
||||
1e12: ('T', 'tera'),
|
||||
1e9: ('G', 'giga'),
|
||||
1e6: ('M', 'mega'),
|
||||
1e3: ('k', 'kilo'),
|
||||
1e-3: ('m', 'milli'),
|
||||
1e-6: ('u', 'micro'),
|
||||
1e-9: ('n', 'nano'),
|
||||
1e-12: ('p', 'pico'),
|
||||
1e-15: ('f', 'femto'),
|
||||
1e-18: ('a', 'atto'),
|
||||
1e-21: ('z', 'zepto'),
|
||||
1e-24: ('y', 'yocto')
|
||||
}
|
||||
if use_extra_prefixes:
|
||||
si_prefixes.update({1e2: ('h', 'hecto'),
|
||||
1e1: ('da', 'deka'),
|
||||
1e-1: ('d', 'deci'),
|
||||
1e-2: ('c', 'centi')
|
||||
})
|
||||
bin_prefixes = {2**10: ('K', 'kilo'),
|
||||
2**20: ('M', 'mega'),
|
||||
2**30: ('G', 'mega'),
|
||||
2**40: ('T', 'tera'),
|
||||
2**50: ('P', 'peta'),
|
||||
2**60: ('E', 'exa')
|
||||
}
|
||||
if mode == 'bin':
|
||||
prefixes = bin_prefixes
|
||||
else:
|
||||
prefixes = si_prefixes
|
||||
prefixes[1] = ('', '') # Unity.
|
||||
# Determine appropriate multiplier.
|
||||
multipliers = prefixes.keys()
|
||||
multipliers.sort()
|
||||
mult = None
|
||||
for i in range(len(multipliers) - 1):
|
||||
lower_mult = multipliers[i]
|
||||
upper_mult = multipliers[i+1]
|
||||
if lower_mult <= value < upper_mult:
|
||||
mult_i = i
|
||||
break
|
||||
if mult is None:
|
||||
if value < multipliers[0]:
|
||||
mult_i = 0
|
||||
elif value >= multipliers[-1]:
|
||||
mult_i = len(multipliers) - 1
|
||||
mult = multipliers[mult_i]
|
||||
# Convert value for this multiplier.
|
||||
new_value = value / mult
|
||||
# Deal with special case due to rounding.
|
||||
if sigfigs is None:
|
||||
if mult_i < (len(multipliers) - 1) and \
|
||||
round(new_value, dp) == \
|
||||
round((multipliers[mult_i+1] / mult), dp):
|
||||
mult = multipliers[mult_i + 1]
|
||||
new_value = value / mult
|
||||
# Concatenate multiplier symbol.
|
||||
if use_full_name:
|
||||
label_type = 1
|
||||
else:
|
||||
label_type = 0
|
||||
# Round and truncate to appropriate precision.
|
||||
if sigfigs is None:
|
||||
str_value = eval('"%.'+str(dp)+'f" % new_value', locals(), {})
|
||||
else:
|
||||
str_value = eval('"%.'+str(sigfigs)+'g" % new_value', locals(), {})
|
||||
return str_value + space + prefixes[mult][label_type] + suffix
|
||||
|
||||
|
||||
def uniquify(seq, preserve_order=False):
|
||||
"""Return sequence with duplicate items in sequence seq removed.
|
||||
|
||||
The code is based on usenet post by Tim Peters.
|
||||
|
||||
This code is O(N) if the sequence items are hashable, O(N**2) if not.
|
||||
|
||||
Peter Bengtsson has a blog post with an empirical comparison of other
|
||||
approaches:
|
||||
http://www.peterbe.com/plog/uniqifiers-benchmark
|
||||
|
||||
If order is not important and the sequence items are hashable then
|
||||
list(set(seq)) is readable and efficient.
|
||||
|
||||
If order is important and the sequence items are hashable generator
|
||||
expressions can be used (in py >= 2.4) (useful for large sequences):
|
||||
seen = set()
|
||||
do_something(x for x in seq if x not in seen or seen.add(x))
|
||||
|
||||
Arguments:
|
||||
seq -- sequence
|
||||
preserve_order -- if not set the order will be arbitrary
|
||||
Using this option will incur a speed penalty.
|
||||
(default: False)
|
||||
|
||||
Example showing order preservation:
|
||||
|
||||
>>> uniquify(['a', 'aa', 'b', 'b', 'ccc', 'ccc', 'd'], preserve_order=True)
|
||||
['a', 'aa', 'b', 'ccc', 'd']
|
||||
|
||||
Example using a sequence of un-hashable items:
|
||||
|
||||
>>> uniquify([['z'], ['x'], ['y'], ['z']], preserve_order=True)
|
||||
[['z'], ['x'], ['y']]
|
||||
|
||||
The sorted output or the non-order-preserving approach should equal
|
||||
that of the sorted order-preserving approach output:
|
||||
|
||||
>>> unordered = uniquify([3, 3, 1, 2], preserve_order=False)
|
||||
>>> unordered.sort()
|
||||
>>> ordered = uniquify([3, 3, 1, 2], preserve_order=True)
|
||||
>>> ordered.sort()
|
||||
>>> ordered
|
||||
[1, 2, 3]
|
||||
>>> int(ordered == unordered)
|
||||
1
|
||||
|
||||
"""
|
||||
try:
|
||||
# Attempt fast algorithm.
|
||||
d = {}
|
||||
if preserve_order:
|
||||
# This is based on Dave Kirby's method (f8) noted in the post:
|
||||
# http://www.peterbe.com/plog/uniqifiers-benchmark
|
||||
return [x for x in seq if (x not in d) and not d.__setitem__(x, 0)]
|
||||
else:
|
||||
for x in seq:
|
||||
d[x] = 0
|
||||
return d.keys()
|
||||
except TypeError:
|
||||
# Have an unhashable object, so use slow algorithm.
|
||||
result = []
|
||||
app = result.append
|
||||
for x in seq:
|
||||
if x not in result:
|
||||
app(x)
|
||||
return result
|
||||
|
||||
# Alias to noun form for backward compatibility.
|
||||
unique = uniquify
|
||||
|
||||
|
||||
def reverse_dict(d):
|
||||
"""Reverse a dictionary so the items become the keys and vice-versa.
|
||||
|
||||
Note: The results will be arbitrary if the items are not unique.
|
||||
|
||||
>>> d = reverse_dict({'a': 1, 'b': 2})
|
||||
>>> d_items = d.items()
|
||||
>>> d_items.sort()
|
||||
>>> d_items
|
||||
[(1, 'a'), (2, 'b')]
|
||||
|
||||
"""
|
||||
result = {}
|
||||
for key, value in d.items():
|
||||
result[value] = key
|
||||
return result
|
||||
|
||||
|
||||
def lsb(x, n):
|
||||
"""Return the n least significant bits of x.
|
||||
|
||||
>>> lsb(13, 3)
|
||||
5
|
||||
|
||||
"""
|
||||
return x & ((2 ** n) - 1)
|
||||
|
||||
|
||||
def gray_encode(i):
|
||||
"""Gray encode the given integer."""
|
||||
|
||||
return i ^ (i >> 1)
|
||||
|
||||
|
||||
def random_vec(bits, max_value=None):
|
||||
"""Generate a random binary vector of length bits and given max value."""
|
||||
|
||||
vector = ""
|
||||
for _ in range(int(bits / 10) + 1):
|
||||
i = int((2**10) * random.random())
|
||||
vector += int2bin(i, 10)
|
||||
|
||||
if max_value and (max_value < 2 ** bits - 1):
|
||||
vector = int2bin((int(vector, 2) / (2 ** bits - 1)) * max_value, bits)
|
||||
|
||||
return vector[0:bits]
|
||||
|
||||
|
||||
def binary_range(bits):
|
||||
"""Return a list of all possible binary numbers in order with width=bits.
|
||||
|
||||
It would be nice to extend it to match the
|
||||
functionality of python's range() built-in function.
|
||||
|
||||
"""
|
||||
l = []
|
||||
v = ['0'] * bits
|
||||
|
||||
toggle = [1] + [0] * bits
|
||||
|
||||
while toggle[bits] != 1:
|
||||
v_copy = v[:]
|
||||
v_copy.reverse()
|
||||
l.append(''.join(v_copy))
|
||||
|
||||
toggle = [1] + [0]*bits
|
||||
i = 0
|
||||
while i < bits and toggle[i] == 1:
|
||||
if toggle[i]:
|
||||
if v[i] == '0':
|
||||
v[i] = '1'
|
||||
toggle[i+1] = 0
|
||||
else:
|
||||
v[i] = '0'
|
||||
toggle[i+1] = 1
|
||||
i += 1
|
||||
return l
|
||||
|
||||
|
||||
def float_range(start, stop=None, step=None):
|
||||
"""Return a list containing an arithmetic progression of floats.
|
||||
|
||||
Return a list of floats between 0.0 (or start) and stop with an
|
||||
increment of step.
|
||||
|
||||
This is in functionality to python's range() built-in function
|
||||
but can accept float increments.
|
||||
|
||||
As with range(), stop is omitted from the list.
|
||||
|
||||
"""
|
||||
if stop is None:
|
||||
stop = float(start)
|
||||
start = 0.0
|
||||
|
||||
if step is None:
|
||||
step = 1.0
|
||||
|
||||
cur = float(start)
|
||||
l = []
|
||||
while cur < stop:
|
||||
l.append(cur)
|
||||
cur += step
|
||||
|
||||
return l
|
||||
|
||||
|
||||
def find_common_fixes(s1, s2):
|
||||
"""Find common (prefix, suffix) of two strings.
|
||||
|
||||
>>> find_common_fixes('abc', 'def')
|
||||
('', '')
|
||||
|
||||
>>> find_common_fixes('abcelephantdef', 'abccowdef')
|
||||
('abc', 'def')
|
||||
|
||||
>>> find_common_fixes('abcelephantdef', 'abccow')
|
||||
('abc', '')
|
||||
|
||||
>>> find_common_fixes('elephantdef', 'abccowdef')
|
||||
('', 'def')
|
||||
|
||||
"""
|
||||
prefix = []
|
||||
suffix = []
|
||||
|
||||
i = 0
|
||||
common_len = min(len(s1), len(s2))
|
||||
while i < common_len:
|
||||
if s1[i] != s2[i]:
|
||||
break
|
||||
|
||||
prefix.append(s1[i])
|
||||
i += 1
|
||||
|
||||
i = 1
|
||||
while i < (common_len + 1):
|
||||
if s1[-i] != s2[-i]:
|
||||
break
|
||||
|
||||
suffix.append(s1[-i])
|
||||
i += 1
|
||||
|
||||
suffix.reverse()
|
||||
|
||||
prefix = ''.join(prefix)
|
||||
suffix = ''.join(suffix)
|
||||
|
||||
return (prefix, suffix)
|
||||
|
||||
|
||||
def is_rotated(seq1, seq2):
|
||||
"""Return true if the first sequence is a rotation of the second sequence.
|
||||
|
||||
>>> seq1 = ['A', 'B', 'C', 'D']
|
||||
>>> seq2 = ['C', 'D', 'A', 'B']
|
||||
>>> int(is_rotated(seq1, seq2))
|
||||
1
|
||||
|
||||
>>> seq2 = ['C', 'D', 'B', 'A']
|
||||
>>> int(is_rotated(seq1, seq2))
|
||||
0
|
||||
|
||||
>>> seq1 = ['A', 'B', 'C', 'A']
|
||||
>>> seq2 = ['A', 'A', 'B', 'C']
|
||||
>>> int(is_rotated(seq1, seq2))
|
||||
1
|
||||
|
||||
>>> seq2 = ['A', 'B', 'C', 'A']
|
||||
>>> int(is_rotated(seq1, seq2))
|
||||
1
|
||||
|
||||
>>> seq2 = ['A', 'A', 'C', 'B']
|
||||
>>> int(is_rotated(seq1, seq2))
|
||||
0
|
||||
|
||||
"""
|
||||
# Do a sanity check.
|
||||
if len(seq1) != len(seq2):
|
||||
return False
|
||||
# Look for occurrences of second sequence head item in first sequence.
|
||||
start_indexes = []
|
||||
head_item = seq2[0]
|
||||
for index1 in range(len(seq1)):
|
||||
if seq1[index1] == head_item:
|
||||
start_indexes.append(index1)
|
||||
# Check that wrapped sequence matches.
|
||||
double_seq1 = seq1 + seq1
|
||||
for index1 in start_indexes:
|
||||
if double_seq1[index1:index1+len(seq1)] == seq2:
|
||||
return True
|
||||
return False
|
||||
|
||||
def getmodule(obj):
|
||||
"""Return the module that contains the object definition of obj.
|
||||
|
||||
Note: Use inspect.getmodule instead.
|
||||
|
||||
Arguments:
|
||||
obj -- python obj, generally a class or a function
|
||||
|
||||
Examples:
|
||||
|
||||
A function:
|
||||
>>> module = getmodule(random.choice)
|
||||
>>> module.__name__
|
||||
'random'
|
||||
>>> module is random
|
||||
1
|
||||
|
||||
A class:
|
||||
>>> module = getmodule(random.Random)
|
||||
>>> module.__name__
|
||||
'random'
|
||||
>>> module is random
|
||||
1
|
||||
|
||||
A class inheriting from a class in another module:
|
||||
(note: The inheriting class must define at least one function.)
|
||||
>>> class MyRandom(random.Random):
|
||||
... def play(self):
|
||||
... pass
|
||||
>>> module = getmodule(MyRandom)
|
||||
>>> if __name__ == '__main__':
|
||||
... name = 'rad_util'
|
||||
... else:
|
||||
... name = module.__name__
|
||||
>>> name
|
||||
'rad_util'
|
||||
>>> module is sys.modules[__name__]
|
||||
1
|
||||
|
||||
Discussion:
|
||||
This approach is slightly hackish, and won't work in various situations.
|
||||
However, this was the approach recommended by GvR, so it's as good as
|
||||
you'll get.
|
||||
|
||||
See GvR's post in this thread:
|
||||
http://groups.google.com.au/group/comp.lang.python/browse_thread/thread/966a7bdee07e3b34/c3cab3f41ea84236?lnk=st&q=python+determine+class+module&rnum=4&hl=en#c3cab3f41ea84236
|
||||
|
||||
"""
|
||||
if hasattr(obj, 'func_globals'):
|
||||
func = obj
|
||||
else:
|
||||
# Handle classes.
|
||||
func = None
|
||||
for item in obj.__dict__.values():
|
||||
if hasattr(item, 'func_globals'):
|
||||
func = item
|
||||
break
|
||||
if func is None:
|
||||
raise ValueError("No functions attached to object: %r" % obj)
|
||||
module_name = func.func_globals['__name__']
|
||||
# Get module.
|
||||
module = sys.modules[module_name]
|
||||
return module
|
||||
|
||||
|
||||
def round_grid(value, grid, mode=0):
|
||||
"""Round off the given value to the given grid size.
|
||||
|
||||
Arguments:
|
||||
value -- value to be roudne
|
||||
grid -- result must be a multiple of this
|
||||
mode -- 0 nearest, 1 up, -1 down
|
||||
|
||||
Examples:
|
||||
|
||||
>>> round_grid(7.5, 5)
|
||||
10
|
||||
|
||||
>>> round_grid(7.5, 5, mode=-1)
|
||||
5
|
||||
|
||||
>>> round_grid(7.3, 5, mode=1)
|
||||
10
|
||||
|
||||
>>> round_grid(7.3, 5.0, mode=1)
|
||||
10.0
|
||||
|
||||
"""
|
||||
off_grid = value % grid
|
||||
if mode == 0:
|
||||
add_one = int(off_grid >= (grid / 2.0))
|
||||
elif mode == 1 and off_grid:
|
||||
add_one = 1
|
||||
elif mode == -1 and off_grid:
|
||||
add_one = 0
|
||||
result = ((int(value / grid) + add_one) * grid)
|
||||
return result
|
||||
|
||||
|
||||
def get_args(argv):
|
||||
"""Store command-line args in a dictionary.
|
||||
|
||||
-, -- prefixes are removed
|
||||
Items not prefixed with - or -- are stored as a list, indexed by 'args'
|
||||
|
||||
For options that take a value use --option=value
|
||||
|
||||
Consider using optparse or getopt (in Python standard library) instead.
|
||||
|
||||
"""
|
||||
d = {}
|
||||
args = []
|
||||
|
||||
for arg in argv:
|
||||
|
||||
if arg.startswith('-'):
|
||||
parts = re.sub(r'^-+', '', arg).split('=')
|
||||
if len(parts) == 2:
|
||||
d[parts[0]] = parts[1]
|
||||
else:
|
||||
d[parts[0]] = None
|
||||
else:
|
||||
args.append(arg)
|
||||
|
||||
d['args'] = args
|
||||
|
||||
return d
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import doctest
|
||||
doctest.testmod(sys.modules['__main__'])
|
||||
|
||||
392
bindings/python/topsort.py
Normal file
392
bindings/python/topsort.py
Normal file
@@ -0,0 +1,392 @@
|
||||
# topsort - dependency (topological) sorting and cycle finding functions
|
||||
# Copyright (C) 2007 RADLogic
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation;
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# See http://www.fsf.org/licensing/licenses/lgpl.txt for full license text.
|
||||
"""Provide toplogical sorting (i.e. dependency sorting) functions.
|
||||
|
||||
The topsort function is based on code posted on Usenet by Tim Peters.
|
||||
|
||||
Modifications:
|
||||
- added doctests
|
||||
- changed some bits to use current Python idioms
|
||||
(listcomp instead of filter, +=/-=, inherit from Exception)
|
||||
- added a topsort_levels version that ports items in each dependency level
|
||||
into a sub-list
|
||||
- added find_cycles to aid in cycle debugging
|
||||
|
||||
Run this module directly to run the doctests (unittests).
|
||||
Make sure they all pass before checking in any modifications.
|
||||
|
||||
Requires Python >= 2.2
|
||||
(For Python 2.2 also requires separate sets.py module)
|
||||
|
||||
This requires the rad_util.py module.
|
||||
|
||||
"""
|
||||
|
||||
# Provide support for Python 2.2*
|
||||
from __future__ import generators
|
||||
|
||||
__version__ = '$Revision: 0.9 $'
|
||||
__date__ = '$Date: 2007/03/27 04:15:26 $'
|
||||
__credits__ = '''Tim Peters -- original topsort code
|
||||
Tim Wegener -- doctesting, updating to current idioms, topsort_levels,
|
||||
find_cycles
|
||||
'''
|
||||
|
||||
# Make Python 2.3 sets look like Python 2.4 sets.
|
||||
try:
|
||||
set
|
||||
except NameError:
|
||||
from sets import Set as set
|
||||
|
||||
from rad_util import is_rotated
|
||||
|
||||
|
||||
class CycleError(Exception):
|
||||
"""Cycle Error"""
|
||||
pass
|
||||
|
||||
|
||||
def topsort(pairlist):
|
||||
"""Topologically sort a list of (parent, child) pairs.
|
||||
|
||||
Return a list of the elements in dependency order (parent to child order).
|
||||
|
||||
>>> print topsort( [(1,2), (3,4), (5,6), (1,3), (1,5), (1,6), (2,5)] )
|
||||
[1, 2, 3, 5, 4, 6]
|
||||
|
||||
>>> print topsort( [(1,2), (1,3), (2,4), (3,4), (5,6), (4,5)] )
|
||||
[1, 2, 3, 4, 5, 6]
|
||||
|
||||
>>> print topsort( [(1,2), (2,3), (3,2)] )
|
||||
Traceback (most recent call last):
|
||||
CycleError: ([1], {2: 1, 3: 1}, {2: [3], 3: [2]})
|
||||
|
||||
"""
|
||||
num_parents = {} # element -> # of predecessors
|
||||
children = {} # element -> list of successors
|
||||
for parent, child in pairlist:
|
||||
# Make sure every element is a key in num_parents.
|
||||
if not num_parents.has_key( parent ):
|
||||
num_parents[parent] = 0
|
||||
if not num_parents.has_key( child ):
|
||||
num_parents[child] = 0
|
||||
|
||||
# Since child has a parent, increment child's num_parents count.
|
||||
num_parents[child] += 1
|
||||
|
||||
# ... and parent gains a child.
|
||||
children.setdefault(parent, []).append(child)
|
||||
|
||||
# Suck up everything without a parent.
|
||||
answer = [x for x in num_parents.keys() if num_parents[x] == 0]
|
||||
|
||||
# For everything in answer, knock down the parent count on its children.
|
||||
# Note that answer grows *in* the loop.
|
||||
for parent in answer:
|
||||
del num_parents[parent]
|
||||
if children.has_key( parent ):
|
||||
for child in children[parent]:
|
||||
num_parents[child] -= 1
|
||||
if num_parents[child] == 0:
|
||||
answer.append( child )
|
||||
# Following "del" isn't needed; just makes
|
||||
# CycleError details easier to grasp.
|
||||
del children[parent]
|
||||
|
||||
if num_parents:
|
||||
# Everything in num_parents has at least one child ->
|
||||
# there's a cycle.
|
||||
raise CycleError(answer, num_parents, children)
|
||||
return answer
|
||||
|
||||
def topsort_levels(pairlist):
|
||||
"""Topologically sort a list of (parent, child) pairs into depth levels.
|
||||
|
||||
This returns a generator.
|
||||
Turn this into a an iterator using the iter built-in function.
|
||||
(if you iterate over the iterator, each element gets generated when
|
||||
it is asked for, rather than generating the whole list up-front.)
|
||||
|
||||
Each generated element is a list of items at that dependency level.
|
||||
|
||||
>>> dependency_pairs = [(1,2), (3,4), (5,6), (1,3), (1,5), (1,6), (2,5)]
|
||||
>>> for level in iter(topsort_levels( dependency_pairs )):
|
||||
... print level
|
||||
[1]
|
||||
[2, 3]
|
||||
[4, 5]
|
||||
[6]
|
||||
|
||||
>>> dependency_pairs = [(1,2), (1,3), (2,4), (3,4), (5,6), (4,5)]
|
||||
>>> for level in iter(topsort_levels( dependency_pairs )):
|
||||
... print level
|
||||
[1]
|
||||
[2, 3]
|
||||
[4]
|
||||
[5]
|
||||
[6]
|
||||
|
||||
>>> dependency_pairs = [(1,2), (2,3), (3,4), (4, 3)]
|
||||
>>> try:
|
||||
... for level in iter(topsort_levels( dependency_pairs )):
|
||||
... print level
|
||||
... except CycleError, exc:
|
||||
... print 'CycleError:', exc
|
||||
[1]
|
||||
[2]
|
||||
CycleError: ({3: 1, 4: 1}, {3: [4], 4: [3]})
|
||||
|
||||
|
||||
The cycle error should look like.
|
||||
CycleError: ({3: 1, 4: 1}, {3: [4], 4: [3]})
|
||||
# todo: Make the doctest more robust (i.e. handle arbitrary dict order).
|
||||
|
||||
"""
|
||||
num_parents = {} # element -> # of predecessors
|
||||
children = {} # element -> list of successors
|
||||
for parent, child in pairlist:
|
||||
# Make sure every element is a key in num_parents.
|
||||
if not num_parents.has_key( parent ):
|
||||
num_parents[parent] = 0
|
||||
if not num_parents.has_key( child ):
|
||||
num_parents[child] = 0
|
||||
|
||||
# Since child has a parent, increment child's num_parents count.
|
||||
num_parents[child] += 1
|
||||
|
||||
# ... and parent gains a child.
|
||||
children.setdefault(parent, []).append(child)
|
||||
|
||||
return topsort_levels_core(num_parents, children)
|
||||
|
||||
def topsort_levels_core(num_parents, children):
|
||||
"""Topologically sort a bunch of interdependent items based on dependency.
|
||||
|
||||
This returns a generator.
|
||||
Turn this into a an iterator using the iter built-in function.
|
||||
(if you iterate over the iterator, each element gets generated when
|
||||
it is asked for, rather than generating the whole list up-front.)
|
||||
|
||||
Each generated element is a list of items at that dependency level.
|
||||
|
||||
>>> list(topsort_levels_core(
|
||||
... {1: 0, 2: 1, 3: 1, 4: 1, 5: 2, 6: 2},
|
||||
... {1: [2, 3, 5, 6], 2: [5], 3: [4], 4: [], 5: [6]}))
|
||||
[[1], [2, 3], [4, 5], [6]]
|
||||
|
||||
>>> list(topsort_levels_core(
|
||||
... {1: 0, 2: 2, 3: 1},
|
||||
... {1: [2], 2: [3], 3: [2]}))
|
||||
Traceback (most recent call last):
|
||||
CycleError: ({2: 1, 3: 1}, {2: [3], 3: [2]})
|
||||
|
||||
This function has a more complicated interface than topsort_levels,
|
||||
but is useful if the data is easier to generate in this form.
|
||||
|
||||
Arguments:
|
||||
num_parents -- key: item, value: number of parents (predecessors)
|
||||
children -- key: item, value: list of children (successors)
|
||||
|
||||
"""
|
||||
while 1:
|
||||
# Suck up everything without a predecessor.
|
||||
level_parents = [x for x in num_parents.keys() if num_parents[x] == 0]
|
||||
|
||||
if not level_parents:
|
||||
break
|
||||
|
||||
# Offer the next generated item,
|
||||
# which is a list of the items at this dependency level.
|
||||
yield level_parents
|
||||
|
||||
# For everything item in this level,
|
||||
# decrement the parent count,
|
||||
# since we have accounted for its parent.
|
||||
for level_parent in level_parents:
|
||||
|
||||
del num_parents[level_parent]
|
||||
|
||||
if children.has_key(level_parent):
|
||||
for level_parent_child in children[level_parent]:
|
||||
num_parents[level_parent_child] -= 1
|
||||
del children[level_parent]
|
||||
|
||||
if num_parents:
|
||||
# Everything in num_parents has at least one child ->
|
||||
# there's a cycle.
|
||||
raise CycleError(num_parents, children)
|
||||
else:
|
||||
# This is the end of the generator.
|
||||
raise StopIteration
|
||||
|
||||
|
||||
def find_cycles(parent_children):
|
||||
"""Yield cycles. Each result is a list of items comprising a cycle.
|
||||
|
||||
Use a 'stack' based approach to find all the cycles.
|
||||
This is a generator, so yields each cycle as it finds it.
|
||||
|
||||
It is implicit that the last item in each cycle list is a parent of the
|
||||
first item (thereby forming a cycle).
|
||||
|
||||
Arguments:
|
||||
parent_children -- parent -> collection of children
|
||||
|
||||
Simplest cycle:
|
||||
>>> cycles = list(find_cycles({'A': ['B'], 'B': ['A']}))
|
||||
>>> len(cycles)
|
||||
1
|
||||
>>> cycle = cycles[0]
|
||||
>>> cycle.sort()
|
||||
>>> print cycle
|
||||
['A', 'B']
|
||||
|
||||
Simplest cycle with extra baggage at the start and the end:
|
||||
>>> cycles = list(find_cycles(parent_children={'A': ['B'],
|
||||
... 'B': ['C'],
|
||||
... 'C': ['B', 'D'],
|
||||
... 'D': [],
|
||||
... }))
|
||||
>>> len(cycles)
|
||||
1
|
||||
>>> cycle = cycles[0]
|
||||
>>> cycle.sort()
|
||||
>>> print cycle
|
||||
['B', 'C']
|
||||
|
||||
Double cycle:
|
||||
>>> cycles = list(find_cycles(parent_children={'A': ['B'],
|
||||
... 'B': ['C1', 'C2'],
|
||||
... 'C1': ['D1'],
|
||||
... 'D1': ['E1'],
|
||||
... 'E1': ['D1'],
|
||||
... 'C2': ['D2'],
|
||||
... 'D2': ['E2'],
|
||||
... 'E2': ['D2'],
|
||||
... }))
|
||||
>>> len(cycles)
|
||||
2
|
||||
>>> for cycle in cycles:
|
||||
... cycle.sort()
|
||||
>>> cycles.sort()
|
||||
>>> cycle1 = cycles[0]
|
||||
>>> cycle1.sort()
|
||||
>>> print cycle1
|
||||
['D1', 'E1']
|
||||
>>> cycle2 = cycles[1]
|
||||
>>> cycle2.sort()
|
||||
>>> print cycle2
|
||||
['D2', 'E2']
|
||||
|
||||
Simple cycle with children not specified for one item:
|
||||
# todo: Should this barf instead?
|
||||
>>> cycles = list(find_cycles(parent_children={'A': ['B'],
|
||||
... 'B': ['A'],
|
||||
... 'C': ['D']}))
|
||||
>>> len(cycles)
|
||||
1
|
||||
>>> cycle = cycles[0]
|
||||
>>> cycle.sort()
|
||||
>>> print cycle
|
||||
['A', 'B']
|
||||
|
||||
Diamond cycle
|
||||
>>> cycles = list(find_cycles(parent_children={'A': ['B1', 'B2'],
|
||||
... 'B1': ['C'],
|
||||
... 'B2': ['C'],
|
||||
... 'C': ['A', 'B1']}))
|
||||
>>> len(cycles)
|
||||
3
|
||||
>>> sorted_cycles = []
|
||||
>>> for cycle in cycles:
|
||||
... cycle = list(cycle)
|
||||
... cycle.sort()
|
||||
... sorted_cycles.append(cycle)
|
||||
>>> sorted_cycles.sort()
|
||||
>>> for cycle in sorted_cycles:
|
||||
... print cycle
|
||||
['A', 'B1', 'C']
|
||||
['A', 'B2', 'C']
|
||||
['B1', 'C']
|
||||
|
||||
Hairy case (order can matter if something is wrong):
|
||||
(Note order of B and C in the list.)
|
||||
>>> cycles = list(find_cycles(parent_children={
|
||||
... 'TD': ['DD'],
|
||||
... 'TC': ['DC'],
|
||||
... 'DC': ['DQ'],
|
||||
... 'C': ['DQ'],
|
||||
... 'DQ': ['IA', 'TO'],
|
||||
... 'IA': ['A'],
|
||||
... 'A': ['B', 'C'],
|
||||
... }))
|
||||
>>> len(cycles)
|
||||
1
|
||||
>>> cycle = cycles[0]
|
||||
>>> cycle.sort()
|
||||
>>> print cycle
|
||||
['A', 'C', 'DQ', 'IA']
|
||||
|
||||
"""
|
||||
cycles = []
|
||||
visited_nodes = set()
|
||||
|
||||
for parent in parent_children:
|
||||
if parent in visited_nodes:
|
||||
# This node is part of a path that has already been traversed.
|
||||
continue
|
||||
|
||||
paths = [[parent]]
|
||||
while paths:
|
||||
path = paths.pop()
|
||||
|
||||
parent = path[-1]
|
||||
|
||||
try:
|
||||
children = parent_children[parent]
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
for child in children:
|
||||
# Keeping a set of the path nodes, for O(1) lookups at the
|
||||
# expense of more memory and complexity, actually makes speed
|
||||
# worse. (Due to construction of sets.)
|
||||
# This is O(N).
|
||||
if child in path:
|
||||
# This is a cycle.
|
||||
cycle = path[path.index(child):]
|
||||
# Check that this is not a dup cycle.
|
||||
is_dup = False
|
||||
for other_cycle in cycles:
|
||||
if is_rotated(other_cycle, cycle):
|
||||
is_dup = True
|
||||
break
|
||||
if not is_dup:
|
||||
cycles.append(cycle)
|
||||
yield cycle
|
||||
else:
|
||||
# Push this new path onto the 'stack'.
|
||||
# This is probably the most expensive part of the algorithm
|
||||
# (a list copy).
|
||||
paths.append(path + [child])
|
||||
# Mark the node as visited.
|
||||
visited_nodes.add(child)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Run the doctest tests.
|
||||
import sys
|
||||
import doctest
|
||||
doctest.testmod(sys.modules['__main__'])
|
||||
1
bindings/python/waf
vendored
Normal file
1
bindings/python/waf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
exec "`dirname "$0"`"/../../waf "$@"
|
||||
476
bindings/python/wscript
Normal file
476
bindings/python/wscript
Normal file
@@ -0,0 +1,476 @@
|
||||
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
import re
|
||||
import Params
|
||||
import Configure
|
||||
import Object
|
||||
import Action
|
||||
import os
|
||||
import Task
|
||||
import pproc as subprocess
|
||||
from Params import fatal, warning
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
## Adjust python path to look for our local copy of pybindgen
|
||||
LOCAL_PYBINDGEN_PATH = os.path.join(os.getcwd(), "bindings", "python", "pybindgen")
|
||||
#PYBINDGEN_BRANCH = 'lp:pybindgen'
|
||||
PYBINDGEN_BRANCH = 'https://launchpad.net/pybindgen'
|
||||
if os.environ.get('PYTHONPATH', ''):
|
||||
os.environ['PYTHONPATH'] = LOCAL_PYBINDGEN_PATH + os.pathsep + os.environ.get('PYTHONPATH')
|
||||
else:
|
||||
os.environ['PYTHONPATH'] = LOCAL_PYBINDGEN_PATH
|
||||
|
||||
## https://launchpad.net/pybindgen/
|
||||
REQUIRED_PYBINDGEN_VERSION = (0, 9, 0, 600)
|
||||
REQUIRED_PYGCCXML_VERSION = (0, 9, 5)
|
||||
|
||||
|
||||
def set_options(opt):
|
||||
opt.tool_options('python')
|
||||
opt.add_option('--disable-python',
|
||||
help=("Don't build Python bindings."),
|
||||
action="store_true", default=False,
|
||||
dest='python_disable')
|
||||
opt.add_option('--python-scan',
|
||||
help=("Rescan Python bindings. Needs working GCCXML / pygccxml environment."),
|
||||
action="store_true", default=False,
|
||||
dest='python_scan')
|
||||
opt.add_option('--pybindgen-checkout',
|
||||
help=("During configure, force checkout of pybingen inside ns-3, "
|
||||
"instead of using the system installed version."),
|
||||
action="store_true", default=False,
|
||||
dest='pybindgen_checkout')
|
||||
|
||||
def fetch_pybindgen(conf):
|
||||
"""
|
||||
Fetches pybindgen from launchpad as bindings/python/pybindgen.
|
||||
Returns True if successful, False it not.
|
||||
"""
|
||||
bzr = conf.find_program("bzr")
|
||||
if not bzr:
|
||||
warning("the program 'bzr' is needed in order to fetch pybindgen")
|
||||
return False
|
||||
if len(REQUIRED_PYBINDGEN_VERSION) == 4:
|
||||
rev = "-rrevno:%i" % REQUIRED_PYBINDGEN_VERSION[3]
|
||||
else:
|
||||
rev = "-rtag:%s" % '.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])
|
||||
|
||||
if os.path.exists(LOCAL_PYBINDGEN_PATH):
|
||||
print "Trying to update pybindgen; this will fail if no network connection is available. Hit Ctrl-C to skip."
|
||||
|
||||
cmd = [bzr, "pull", rev, PYBINDGEN_BRANCH]
|
||||
print " => ", ' '.join(cmd)
|
||||
try:
|
||||
if subprocess.Popen(cmd, cwd=LOCAL_PYBINDGEN_PATH).wait():
|
||||
return False
|
||||
except KeyboardInterrupt:
|
||||
print "Interrupted; Python bindings will be disabled."
|
||||
return False
|
||||
print "Update was successful."
|
||||
else:
|
||||
print "Trying to fetch pybindgen; this will fail if no network connection is available. Hit Ctrl-C to skip."
|
||||
cmd = [bzr, "checkout", rev, PYBINDGEN_BRANCH, LOCAL_PYBINDGEN_PATH]
|
||||
print " => ", ' '.join(cmd)
|
||||
try:
|
||||
if subprocess.Popen(cmd).wait():
|
||||
return False
|
||||
except KeyboardInterrupt:
|
||||
print "Interrupted; Python bindings will be disabled."
|
||||
shutil.rmtree(LOCAL_PYBINDGEN_PATH, True)
|
||||
return False
|
||||
print "Fetch was successful."
|
||||
|
||||
## generate a fake version.py file in pybindgen it's safer this
|
||||
## way, since the normal version generation process requires
|
||||
## bazaar python bindings, which may not be available.
|
||||
vfile = open(os.path.join(LOCAL_PYBINDGEN_PATH, "pybindgen", "version.py"), "wt")
|
||||
vfile.write("""
|
||||
# (fake version generated by ns-3)
|
||||
__version__ = %r
|
||||
""" % list(REQUIRED_PYBINDGEN_VERSION))
|
||||
vfile.close()
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def configure(conf):
|
||||
conf.env['ENABLE_PYTHON_BINDINGS'] = False
|
||||
if Params.g_options.python_disable:
|
||||
conf.report_optional_feature("python", "Python Bindings", False,
|
||||
"disabled by user request")
|
||||
return
|
||||
|
||||
conf.check_tool('misc')
|
||||
|
||||
if sys.platform == 'cygwin':
|
||||
conf.report_optional_feature("python", "Python Bindings", False,
|
||||
"unsupported platform 'cygwin'")
|
||||
warning("Python is not supported in CygWin environment. Try MingW instead.")
|
||||
return
|
||||
|
||||
## Check for Python
|
||||
try:
|
||||
conf.check_tool('python')
|
||||
conf.check_python_version((2,3))
|
||||
conf.check_python_headers()
|
||||
except Configure.ConfigurationError, ex:
|
||||
conf.report_optional_feature("python", "Python Bindings", False, str(ex))
|
||||
return
|
||||
|
||||
## Check for pybindgen
|
||||
if Params.g_options.pybindgen_checkout:
|
||||
fetch_pybindgen(conf)
|
||||
|
||||
try:
|
||||
conf.check_python_module('pybindgen')
|
||||
except Configure.ConfigurationError:
|
||||
warning("pybindgen missing")
|
||||
if not fetch_pybindgen(conf):
|
||||
conf.report_optional_feature("python", "Python Bindings", False,
|
||||
"PyBindGen missing and could not be retrieved")
|
||||
return
|
||||
else:
|
||||
out = subprocess.Popen([conf.env['PYTHON'], "-c",
|
||||
"import pybindgen.version; "
|
||||
"print '.'.join([str(x) for x in pybindgen.version.__version__])"],
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
pybindgen_version_str = out.strip()
|
||||
pybindgen_version = tuple([int(x) for x in pybindgen_version_str.split('.')])
|
||||
conf.check_message('pybindgen', 'version',
|
||||
(pybindgen_version >= REQUIRED_PYBINDGEN_VERSION),
|
||||
pybindgen_version_str)
|
||||
if not (pybindgen_version >= REQUIRED_PYBINDGEN_VERSION):
|
||||
warning("pybindgen (found %s) is too old (need %s)" %
|
||||
(pybindgen_version_str,
|
||||
'.'.join([str(x) for x in REQUIRED_PYBINDGEN_VERSION])))
|
||||
if not fetch_pybindgen(conf):
|
||||
conf.report_optional_feature("python", "Python Bindings", False,
|
||||
"PyBindGen too old and newer version could not be retrieved")
|
||||
return
|
||||
|
||||
## If all has gone well, we finally enable the Python bindings
|
||||
conf.env['ENABLE_PYTHON_BINDINGS'] = True
|
||||
conf.report_optional_feature("python", "Python Bindings", True, None)
|
||||
|
||||
## Check for pygccxml
|
||||
try:
|
||||
conf.check_python_module('pygccxml')
|
||||
except Configure.ConfigurationError:
|
||||
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
|
||||
"Missing 'pygccxml' Python module")
|
||||
return
|
||||
|
||||
out = subprocess.Popen([conf.env['PYTHON'], "-c",
|
||||
"import pygccxml; print pygccxml.__version__"],
|
||||
stdout=subprocess.PIPE).communicate()[0]
|
||||
pygccxml_version_str = out.strip()
|
||||
pygccxml_version = tuple([int(x) for x in pygccxml_version_str.split('.')])
|
||||
conf.check_message('pygccxml', 'version',
|
||||
(pygccxml_version >= REQUIRED_PYGCCXML_VERSION),
|
||||
pygccxml_version_str)
|
||||
if not (pygccxml_version >= REQUIRED_PYGCCXML_VERSION):
|
||||
warning("pygccxml (found %s) is too old (need %s) => "
|
||||
"automatic scanning of API definitions will not be possible" %
|
||||
(pygccxml_version_str,
|
||||
'.'.join([str(x) for x in REQUIRED_PYGCCXML_VERSION])))
|
||||
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
|
||||
"pygccxml too old")
|
||||
return
|
||||
|
||||
|
||||
## Check gccxml version
|
||||
gccxml = conf.find_program('gccxml', var='GCCXML')
|
||||
if not gccxml:
|
||||
warning("gccxml missing; automatic scanning of API definitions will not be possible")
|
||||
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
|
||||
"gccxml missing")
|
||||
return
|
||||
|
||||
gccxml_version_line = os.popen(gccxml + " --version").readline().strip()
|
||||
m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
|
||||
gccxml_version = m.group(1)
|
||||
gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
|
||||
conf.check_message('gccxml', 'version', True, gccxml_version)
|
||||
if not gccxml_version_ok:
|
||||
warning("gccxml too old, need version >= 0.9; automatic scanning of API definitions will not be possible")
|
||||
conf.report_optional_feature("pygccxml", "Python API Scanning Support", False,
|
||||
"gccxml too old")
|
||||
return
|
||||
|
||||
## If we reached
|
||||
conf.env['ENABLE_PYTHON_SCANNING'] = True
|
||||
conf.report_optional_feature("pygccxml", "Python API Scanning Support", True, None)
|
||||
|
||||
|
||||
prio_headers = {
|
||||
-2: (
|
||||
"string.h", # work around http://www.gccxml.org/Bug/view.php?id=6682
|
||||
),
|
||||
-1: (
|
||||
"propagation-delay-model.h",
|
||||
"propagation-loss-model.h",
|
||||
"net-device.h",
|
||||
)
|
||||
}
|
||||
|
||||
def get_header_prio(header):
|
||||
for prio, headers in prio_headers.iteritems():
|
||||
if header in headers:
|
||||
return prio
|
||||
return 1
|
||||
|
||||
|
||||
def calc_header_include(path):
|
||||
(head, tail) = os.path.split (path)
|
||||
if tail == 'ns3':
|
||||
return ''
|
||||
else:
|
||||
return os.path.join (calc_header_include (head), tail)
|
||||
|
||||
|
||||
def gen_ns3_metaheader(task):
|
||||
assert len(task.m_outputs) == 1
|
||||
|
||||
header_files = [calc_header_include(node.abspath(task.m_env)) for node in task.m_inputs]
|
||||
outfile = file(task.m_outputs[0].bldpath(task.m_env), "w")
|
||||
|
||||
def sort_func(h1, h2):
|
||||
return cmp((get_header_prio(h1), h1), (get_header_prio(h1), h2))
|
||||
|
||||
header_files.sort(sort_func)
|
||||
|
||||
for header in header_files:
|
||||
print >> outfile, "#include \"ns3/%s\"" % (header,)
|
||||
|
||||
print >> outfile, """
|
||||
namespace ns3 {
|
||||
static inline Ptr<Object>
|
||||
__dummy_function_to_force_template_instantiation (Ptr<Object> obj, TypeId typeId)
|
||||
{
|
||||
return obj->GetObject<Object> (typeId);
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
__dummy_function_to_force_template_instantiation_v2 ()
|
||||
{
|
||||
Time t1, t2, t3;
|
||||
t1 = t2 + t3;
|
||||
t1 = t2 - t3;
|
||||
TimeSquare tsq = t2*t3;
|
||||
Time tsqdiv = tsq/Seconds(1);
|
||||
Scalar scal = t2/t3;
|
||||
TimeInvert inv = scal/t3;
|
||||
t1 = scal*t1;
|
||||
t1 = t1/scal;
|
||||
t1 < t2;
|
||||
t1 <= t2;
|
||||
t1 == t2;
|
||||
t1 != t2;
|
||||
t1 >= t2;
|
||||
t1 > t2;
|
||||
}
|
||||
|
||||
}
|
||||
"""
|
||||
outfile.close()
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
class all_ns3_headers_taskgen(Object.task_gen):
|
||||
"""Generates a 'everything.h' header file that includes some/all public ns3 headers.
|
||||
This single header file is to be parsed only once by gccxml, for greater efficiency.
|
||||
"""
|
||||
def __init__(self, *features):
|
||||
Object.task_gen.__init__(self, *features)
|
||||
self.inst_var = 0#'INCLUDEDIR'
|
||||
#self.inst_dir = 'ns3'
|
||||
|
||||
def apply(self):
|
||||
## get all of the ns3 headers
|
||||
ns3_dir_node = Params.g_build.m_srcnode.find_dir("ns3")
|
||||
all_headers_inputs = []
|
||||
|
||||
for filename in self.to_list(self.source):
|
||||
src_node = ns3_dir_node.find_build(filename)
|
||||
if src_node is None:
|
||||
Params.fatal("source ns3 header file %s not found" % (filename,))
|
||||
all_headers_inputs.append(src_node)
|
||||
|
||||
## if self.source was empty, include all ns3 headers in enabled modules
|
||||
if not all_headers_inputs:
|
||||
for ns3headers in Object.g_allobjs:
|
||||
if type(ns3headers).__name__ == 'ns3header_taskgen': # XXX: find less hackish way to compare
|
||||
## skip headers not part of enabled modules
|
||||
if self.env['NS3_ENABLED_MODULES']:
|
||||
if ("ns3-%s" % ns3headers.module) not in self.env['NS3_ENABLED_MODULES']:
|
||||
continue
|
||||
|
||||
for source in ns3headers.to_list(ns3headers.source):
|
||||
#source = os.path.basename(source)
|
||||
node = ns3_dir_node.find_build(source)
|
||||
if node is None:
|
||||
fatal("missing header file %s" % (source,))
|
||||
all_headers_inputs.append(node)
|
||||
assert all_headers_inputs
|
||||
all_headers_outputs = [self.path.find_build("everything.h")]
|
||||
task = self.create_task('gen-ns3-metaheader', self.env, 4)
|
||||
task.set_inputs(all_headers_inputs)
|
||||
task.set_outputs(all_headers_outputs)
|
||||
|
||||
def install(self):
|
||||
pass
|
||||
|
||||
|
||||
def get_modules_and_headers():
|
||||
"""
|
||||
Gets a dict of
|
||||
module_name => ([module_dep1, module_dep2, ...], [module_header1, module_header2, ...])
|
||||
tuples, one for each module.
|
||||
"""
|
||||
|
||||
retval = {}
|
||||
for module in Object.g_allobjs:
|
||||
if not module.name.startswith('ns3-'):
|
||||
continue
|
||||
module_name = module.name[4:] # strip the ns3- prefix
|
||||
## find the headers object for this module
|
||||
headers = []
|
||||
for ns3headers in Object.g_allobjs:
|
||||
if type(ns3headers).__name__ != 'ns3header_taskgen': # XXX: find less hackish way to compare
|
||||
continue
|
||||
if ns3headers.module != module_name:
|
||||
continue
|
||||
for source in ns3headers.to_list(ns3headers.source):
|
||||
headers.append(source)
|
||||
retval[module_name] = (list(module.module_deps), headers)
|
||||
return retval
|
||||
|
||||
|
||||
|
||||
class PythonScanTask(Task.TaskBase):
|
||||
"""Uses gccxml to scan the file 'everything.h' and extract API definitions.
|
||||
"""
|
||||
def __init__(self, curdirnode, env):
|
||||
self.m_display = 'python-scan'
|
||||
self.prio = 5 # everything.h has prio 4
|
||||
super(PythonScanTask, self).__init__()
|
||||
self.curdirnode = curdirnode
|
||||
self.env = env
|
||||
|
||||
def run(self):
|
||||
#print "Rescanning the python bindings..."
|
||||
argv = [
|
||||
self.env['PYTHON'],
|
||||
os.path.join(self.curdirnode.abspath(), 'ns3modulescan.py'), # scanning script
|
||||
self.curdirnode.find_dir('../..').abspath(self.env), # include path (where the ns3 include dir is)
|
||||
self.curdirnode.find_build('everything.h').abspath(self.env),
|
||||
os.path.join(self.curdirnode.abspath(), 'ns3modulegen_generated.py'), # output file
|
||||
]
|
||||
scan = subprocess.Popen(argv, stdin=subprocess.PIPE)
|
||||
scan.stdin.write(repr(get_modules_and_headers()))
|
||||
scan.stdin.close()
|
||||
if scan.wait():
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(0)
|
||||
|
||||
def build(bld):
|
||||
if Params.g_options.python_disable:
|
||||
return
|
||||
|
||||
env = bld.env_of_name('default')
|
||||
curdir = bld.m_curdirnode.abspath()
|
||||
|
||||
#Object.register('all-ns3-headers', AllNs3Headers)
|
||||
Action.Action('gen-ns3-metaheader', func=gen_ns3_metaheader, color='BLUE')
|
||||
|
||||
if env['ENABLE_PYTHON_BINDINGS']:
|
||||
obj = bld.create_obj('all_ns3_headers')
|
||||
|
||||
if Params.g_options.python_scan:
|
||||
if not env['ENABLE_PYTHON_SCANNING']:
|
||||
Params.fatal("Cannot re-scan python bindings: (py)gccxml not available")
|
||||
PythonScanTask(bld.m_curdirnode, env)
|
||||
|
||||
## Get a list of scanned modules; the set of scanned modules
|
||||
## may be smaller than the set of all modules, in case a new
|
||||
## ns3 module is being developed which wasn't scanned yet.
|
||||
scanned_modules = []
|
||||
for filename in os.listdir(curdir):
|
||||
m = re.match(r"^ns3_module_(.+)\.py$", filename)
|
||||
if m is None:
|
||||
continue
|
||||
name = m.group(1)
|
||||
if name.endswith("__local"):
|
||||
continue
|
||||
scanned_modules.append(name)
|
||||
|
||||
if env['ENABLE_PYTHON_BINDINGS']:
|
||||
bindgen = bld.create_obj('command-output')
|
||||
bindgen.name = 'pybindgen'
|
||||
bindgen.command = env['PYTHON']
|
||||
bindgen.command_is_external = True
|
||||
bindgen.stderr = 'ns3modulegen.log'
|
||||
bindgen.argv = [
|
||||
#'-m', 'pdb',
|
||||
bindgen.input_file("ns3modulegen.py"),
|
||||
bindgen.output_file("ns3module.cc"),
|
||||
]
|
||||
bindgen.argv.extend(get_modules_and_headers().iterkeys())
|
||||
bindgen.hidden_inputs = ['ns3modulegen_generated.py',
|
||||
'ns3modulegen_core_customizations.py']
|
||||
|
||||
for module in scanned_modules:
|
||||
bindgen.hidden_inputs.append("ns3_module_%s.py" % module)
|
||||
local = "ns3_module_%s__local.py" % module
|
||||
if os.path.exists(os.path.join(curdir, local)):
|
||||
bindgen.hidden_inputs.append(local)
|
||||
|
||||
bindgen.hidden_outputs = ['ns3module.h']
|
||||
for module in scanned_modules:
|
||||
bindgen.hidden_outputs.append("ns3_module_%s.cc" % module)
|
||||
|
||||
bindgen.prio = 50
|
||||
|
||||
bindgen.os_env = dict(os.environ)
|
||||
features = []
|
||||
for (name, caption, was_enabled, reason_not_enabled) in env['NS3_OPTIONAL_FEATURES']:
|
||||
if was_enabled:
|
||||
features.append(name)
|
||||
bindgen.os_env['NS3_ENABLED_FEATURES'] = ','.join(features)
|
||||
|
||||
|
||||
## we build python bindings if either we have the tools to
|
||||
## generate them or if the pregenerated source file is already
|
||||
## present in the source dir.
|
||||
if env['ENABLE_PYTHON_BINDINGS'] \
|
||||
or os.path.exists(os.path.join(bld.m_curdirnode.abspath(), 'ns3module.cc')):
|
||||
pymod = bld.create_obj('cpp', 'shlib', 'pyext')
|
||||
pymod.source = ['ns3module.cc', 'ns3module_helpers.cc']
|
||||
pymod.includes = '.'
|
||||
for module in scanned_modules:
|
||||
pymod.source.append("ns3_module_%s.cc" % module)
|
||||
pymod.target = 'ns3/_ns3'
|
||||
pymod.name = 'ns3module'
|
||||
pymod.uselib_local = "ns3"
|
||||
pymod.env.append_value('CXXDEFINES', ['NS_DEPRECATED=""', 'NS3_DEPRECATED_H'])
|
||||
|
||||
# copy the __init__.py file to the build dir waf can't handle
|
||||
# this, it's against waf's principles to have build dir files
|
||||
# with the same name as source dir files, apparently.
|
||||
dirnode = bld.m_curdirnode.find_dir('ns3')
|
||||
src = os.path.join(dirnode.abspath(), '__init__.py')
|
||||
dst = os.path.join(dirnode.abspath(env), '__init__.py')
|
||||
try:
|
||||
need_copy = os.stat(src).st_mtime > os.stat(dst).st_mtime
|
||||
except OSError:
|
||||
need_copy = True
|
||||
if need_copy:
|
||||
try:
|
||||
os.mkdir(os.path.dirname(dst))
|
||||
except OSError:
|
||||
pass
|
||||
print "%r -> %r" % (src, dst)
|
||||
shutil.copy2(src, dst)
|
||||
Reference in New Issue
Block a user