예제 #1
0
def register_types(module):
    root_module = module.get_root()

    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::dot11s::IeBeaconTimingUnit, ns3::empty, ns3::DefaultDeleter<ns3::dot11s::IeBeaconTimingUnit> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::dot11s::IeBeaconTimingUnit', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::dot11s::IeBeaconTimingUnit>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))

    ## 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 FatalImpl

    nested_module = module.add_cpp_namespace('FatalImpl')
    register_types_ns3_FatalImpl(nested_module)

    ## Register a nested module for the namespace addressUtils

    nested_module = module.add_cpp_namespace('addressUtils')
    register_types_ns3_addressUtils(nested_module)

    ## Register a nested module for the namespace aodv

    nested_module = module.add_cpp_namespace('aodv')
    register_types_ns3_aodv(nested_module)

    ## Register a nested module for the namespace dot11s

    nested_module = module.add_cpp_namespace('dot11s')
    register_types_ns3_dot11s(nested_module)

    ## Register a nested module for the namespace dsdv

    nested_module = module.add_cpp_namespace('dsdv')
    register_types_ns3_dsdv(nested_module)

    ## Register a nested module for the namespace flame

    nested_module = module.add_cpp_namespace('flame')
    register_types_ns3_flame(nested_module)

    ## 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 olsr

    nested_module = module.add_cpp_namespace('olsr')
    register_types_ns3_olsr(nested_module)
예제 #2
0
def generate(fp):
    mod = Module('foo')
    mod.add_include('"ownership.hpp"')

    Foo = mod.add_class('Foo', automatic_type_narrowing=True)
    Foo.add_constructor([Parameter.new('std::string', 'datum')])
    Foo.add_constructor([])
    Foo.add_constructor([Parameter.new('const Foo&', 'foo')])

    ## Zbr is a reference counted class
    Zbr = mod.add_class('Zbr',
                        memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                            incref_method='Ref',
                            decref_method='Unref',
                            peekref_method="GetReferenceCount"))
    #                        allow_subclassing=True)

    Zbr.add_constructor([])
    Zbr.add_constructor([Parameter.new('std::string', 'datum')])
    Zbr.add_method('get_datum', ReturnValue.new('std::string'), [])
    Zbr.add_method('get_int',
                   ReturnValue.new('int'), [Parameter.new('int', 'x')],
                   is_virtual=True)
    Zbr.add_static_attribute('instance_count', ReturnValue.new('int'))
    Zbr.add_method(
        'get_value', ReturnValue.new('int'),
        [Parameter.new('int*', 'x', direction=Parameter.DIRECTION_OUT)])

    mod.add_function('store_zbr', None,
                     [Parameter.new('Zbr*', 'zbr', transfer_ownership=True)])
    mod.add_function('invoke_zbr', ReturnValue.new('int'),
                     [Parameter.new('int', 'x')])
    mod.add_function('delete_stored_zbr', None, [])

    SomeObject = mod.add_class('SomeObject', allow_subclassing=True)

    SomeObject.add_method(
        'set_foo_ptr', ReturnValue.new('void'),
        [Parameter.new('Foo*', 'foo', transfer_ownership=True)])
    SomeObject.add_method(
        'set_foo_shared_ptr', ReturnValue.new('void'),
        [Parameter.new('Foo*', 'foo', transfer_ownership=False)])

    SomeObject.add_method(
        'get_foo_shared_ptr',
        ReturnValue.new('const Foo*', caller_owns_return=False), [])
    SomeObject.add_method('get_foo_ptr',
                          ReturnValue.new('Foo*', caller_owns_return=True), [])

    mod.generate(fp)
예제 #3
0
def my_module_gen(out_file):

    mod = Module('e')
    mod.add_include('"e.h"')

    E = mod.add_class('E',
                      memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                          decref_method='Unref', incref_method='Ref'))
    if 1:
        E.add_function_as_constructor(
            "E::CreateWithRef", ReturnValue.new("E*", caller_owns_return=True),
            [])
    else:
        ## alternative:
        E.add_function_as_constructor(
            "E::CreateWithoutRef",
            ReturnValue.new("E*", caller_owns_return=False), [])
    E.add_method("Do", None, [])

    mod.generate(FileCodeSink(out_file))
예제 #4
0
def register_types(module):
    root_module = module.get_root()

    ## histogram.h: ns3::Histogram [class]
    module.add_class('Histogram')
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::FlowClassifier, ns3::empty, ns3::DefaultDeleter<ns3::FlowClassifier> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::FlowClassifier', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::FlowClassifier>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::FlowProbe, ns3::empty, ns3::DefaultDeleter<ns3::FlowProbe> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::FlowProbe', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::FlowProbe>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## flow-classifier.h: ns3::FlowClassifier [class]
    module.add_class(
        'FlowClassifier',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::FlowClassifier, ns3::empty, ns3::DefaultDeleter<ns3::FlowClassifier> >']
    )
    ## flow-monitor.h: ns3::FlowMonitor [class]
    module.add_class('FlowMonitor', parent=root_module['ns3::Object'])
    ## flow-monitor.h: ns3::FlowMonitor::FlowStats [struct]
    module.add_class('FlowStats', outer_class=root_module['ns3::FlowMonitor'])
    ## flow-probe.h: ns3::FlowProbe [class]
    module.add_class(
        'FlowProbe',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::FlowProbe, ns3::empty, ns3::DefaultDeleter<ns3::FlowProbe> >']
    )
    ## flow-probe.h: ns3::FlowProbe::FlowStats [struct]
    module.add_class('FlowStats', outer_class=root_module['ns3::FlowProbe'])
    ## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier [class]
    module.add_class('Ipv4FlowClassifier',
                     parent=root_module['ns3::FlowClassifier'])
    ## ipv4-flow-classifier.h: ns3::Ipv4FlowClassifier::FiveTuple [struct]
    module.add_class('FiveTuple',
                     outer_class=root_module['ns3::Ipv4FlowClassifier'])
    ## ipv4-flow-probe.h: ns3::Ipv4FlowProbe [class]
    module.add_class('Ipv4FlowProbe', parent=root_module['ns3::FlowProbe'])
    ## ipv4-flow-probe.h: ns3::Ipv4FlowProbe::DropReason [enumeration]
    module.add_enum('DropReason', [
        'DROP_NO_ROUTE', 'DROP_TTL_EXPIRE', 'DROP_BAD_CHECKSUM',
        'DROP_INVALID_REASON'
    ],
                    outer_class=root_module['ns3::Ipv4FlowProbe'])
    module.add_container(
        'std::map< unsigned int, ns3::FlowMonitor::FlowStats >',
        ('unsigned int', 'ns3::FlowMonitor::FlowStats'),
        container_type='map')
    module.add_container('std::map< unsigned int, ns3::FlowProbe::FlowStats >',
                         ('unsigned int', 'ns3::FlowProbe::FlowStats'),
                         container_type='map')
    typehandlers.add_type_alias('uint32_t', 'ns3::FlowPacketId')
    typehandlers.add_type_alias('uint32_t*', 'ns3::FlowPacketId*')
    typehandlers.add_type_alias('uint32_t&', 'ns3::FlowPacketId&')
    typehandlers.add_type_alias('uint32_t', 'ns3::FlowId')
    typehandlers.add_type_alias('uint32_t*', 'ns3::FlowId*')
    typehandlers.add_type_alias('uint32_t&', 'ns3::FlowId&')

    ## 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 TimeStepPrecision

    nested_module = module.add_cpp_namespace('TimeStepPrecision')
    register_types_ns3_TimeStepPrecision(nested_module)

    ## Register a nested module for the namespace addressUtils

    nested_module = module.add_cpp_namespace('addressUtils')
    register_types_ns3_addressUtils(nested_module)

    ## Register a nested module for the namespace aodv

    nested_module = module.add_cpp_namespace('aodv')
    register_types_ns3_aodv(nested_module)

    ## Register a nested module for the namespace dot11s

    nested_module = module.add_cpp_namespace('dot11s')
    register_types_ns3_dot11s(nested_module)

    ## Register a nested module for the namespace flame

    nested_module = module.add_cpp_namespace('flame')
    register_types_ns3_flame(nested_module)

    ## 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 olsr

    nested_module = module.add_cpp_namespace('olsr')
    register_types_ns3_olsr(nested_module)
예제 #5
0
def register_types(module):
    root_module = module.get_root()
    
    ## address.h (module 'network'): ns3::Address [class]
    module.add_class('Address', import_from_module='ns.network')
    ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
    module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network')
    ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
    module.add_class('AttributeConstructionList', import_from_module='ns.core')
    ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
    module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList'])
    ## buffer.h (module 'network'): ns3::Buffer [class]
    module.add_class('Buffer', import_from_module='ns.network')
    ## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
    module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer'])
    ## packet.h (module 'network'): ns3::ByteTagIterator [class]
    module.add_class('ByteTagIterator', import_from_module='ns.network')
    ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
    module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator'])
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
    module.add_class('ByteTagList', import_from_module='ns.network')
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
    module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList'])
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
    module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator'])
    ## callback.h (module 'core'): ns3::CallbackBase [class]
    module.add_class('CallbackBase', import_from_module='ns.core')
    ## event-id.h (module 'core'): ns3::EventId [class]
    module.add_class('EventId', import_from_module='ns.core')
    ## hash.h (module 'core'): ns3::Hasher [class]
    module.add_class('Hasher', import_from_module='ns.core')
    ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
    module.add_class('Inet6SocketAddress', import_from_module='ns.network')
    ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
    root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
    ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
    module.add_class('InetSocketAddress', import_from_module='ns.network')
    ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
    root_module['ns3::InetSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
    ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
    module.add_class('Ipv4Address', import_from_module='ns.network')
    ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
    root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address'])
    ## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
    module.add_class('Ipv4InterfaceAddress', import_from_module='ns.internet')
    ## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e [enumeration]
    module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'], outer_class=root_module['ns3::Ipv4InterfaceAddress'], import_from_module='ns.internet')
    ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
    module.add_class('Ipv4Mask', import_from_module='ns.network')
    ## ipv4-routing-helper.h (module 'internet'): ns3::Ipv4RoutingHelper [class]
    module.add_class('Ipv4RoutingHelper', allow_subclassing=True, import_from_module='ns.internet')
    ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
    module.add_class('Ipv6Address', import_from_module='ns.network')
    ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
    root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address'])
    ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
    module.add_class('Ipv6Prefix', import_from_module='ns.network')
    ## mac48-address.h (module 'network'): ns3::Mac48Address [class]
    module.add_class('Mac48Address', import_from_module='ns.network')
    ## mac48-address.h (module 'network'): ns3::Mac48Address [class]
    root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address'])
    ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class]
    module.add_class('NetDeviceContainer', import_from_module='ns.network')
    ## node-container.h (module 'network'): ns3::NodeContainer [class]
    module.add_class('NodeContainer', import_from_module='ns.network')
    ## node-list.h (module 'network'): ns3::NodeList [class]
    module.add_class('NodeList', import_from_module='ns.network')
    ## object-base.h (module 'core'): ns3::ObjectBase [class]
    module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
    ## object.h (module 'core'): ns3::ObjectDeleter [struct]
    module.add_class('ObjectDeleter', import_from_module='ns.core')
    ## object-factory.h (module 'core'): ns3::ObjectFactory [class]
    module.add_class('ObjectFactory', import_from_module='ns.core')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
    module.add_class('PacketMetadata', import_from_module='ns.network')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
    module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration]
    module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
    module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata'])
    ## packet.h (module 'network'): ns3::PacketTagIterator [class]
    module.add_class('PacketTagIterator', import_from_module='ns.network')
    ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
    module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator'])
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
    module.add_class('PacketTagList', import_from_module='ns.network')
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
    module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList'])
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration]
    module.add_enum('TagData_e', ['MAX_SIZE'], outer_class=root_module['ns3::PacketTagList::TagData'], import_from_module='ns.network')
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simulator.h (module 'core'): ns3::Simulator [class]
    module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core')
    ## tag.h (module 'network'): ns3::Tag [class]
    module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
    ## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
    module.add_class('TagBuffer', import_from_module='ns.network')
    ## nstime.h (module 'core'): ns3::TimeWithUnit [class]
    module.add_class('TimeWithUnit', import_from_module='ns.core')
    ## type-id.h (module 'core'): ns3::TypeId [class]
    module.add_class('TypeId', import_from_module='ns.core')
    ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
    module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core')
    ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
    module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
    ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
    module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId'])
    ## empty.h (module 'core'): ns3::empty [class]
    module.add_class('empty', import_from_module='ns.core')
    ## int64x64-double.h (module 'core'): ns3::int64x64_t [class]
    module.add_class('int64x64_t', import_from_module='ns.core')
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration]
    module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core')
    ## chunk.h (module 'network'): ns3::Chunk [class]
    module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase'])
    ## header.h (module 'network'): ns3::Header [class]
    module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk'])
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
    module.add_class('Ipv4Header', import_from_module='ns.internet', parent=root_module['ns3::Header'])
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
    module.add_enum('DscpType', ['DscpDefault', 'DSCP_CS1', 'DSCP_AF11', 'DSCP_AF12', 'DSCP_AF13', 'DSCP_CS2', 'DSCP_AF21', 'DSCP_AF22', 'DSCP_AF23', 'DSCP_CS3', 'DSCP_AF31', 'DSCP_AF32', 'DSCP_AF33', 'DSCP_CS4', 'DSCP_AF41', 'DSCP_AF42', 'DSCP_AF43', 'DSCP_CS5', 'DSCP_EF', 'DSCP_CS6', 'DSCP_CS7'], outer_class=root_module['ns3::Ipv4Header'], import_from_module='ns.internet')
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header::EcnType [enumeration]
    module.add_enum('EcnType', ['ECN_NotECT', 'ECN_ECT1', 'ECN_ECT0', 'ECN_CE'], outer_class=root_module['ns3::Ipv4Header'], import_from_module='ns.internet')
    ## ipv4-nix-vector-helper.h (module 'nix-vector-routing'): ns3::Ipv4NixVectorHelper [class]
    module.add_class('Ipv4NixVectorHelper', parent=root_module['ns3::Ipv4RoutingHelper'])
    ## object.h (module 'core'): ns3::Object [class]
    module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])
    ## object.h (module 'core'): ns3::Object::AggregateIterator [class]
    module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object'])
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
def register_types(module):
    root_module = module.get_root()

    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::RadvdInterface', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::RadvdInterface>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::RadvdPrefix', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::RadvdPrefix>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## radvd.h: ns3::Radvd [class]
    module.add_class('Radvd', parent=root_module['ns3::Application'])
    ## radvd-interface.h: ns3::RadvdInterface [class]
    module.add_class(
        'RadvdInterface',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::RadvdInterface, ns3::empty, ns3::DefaultDeleter<ns3::RadvdInterface> >']
    )
    ## radvd-prefix.h: ns3::RadvdPrefix [class]
    module.add_class(
        'RadvdPrefix',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::RadvdPrefix, ns3::empty, ns3::DefaultDeleter<ns3::RadvdPrefix> >']
    )

    ## 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 FatalImpl

    nested_module = module.add_cpp_namespace('FatalImpl')
    register_types_ns3_FatalImpl(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 addressUtils

    nested_module = module.add_cpp_namespace('addressUtils')
    register_types_ns3_addressUtils(nested_module)

    ## Register a nested module for the namespace aodv

    nested_module = module.add_cpp_namespace('aodv')
    register_types_ns3_aodv(nested_module)

    ## Register a nested module for the namespace dot11s

    nested_module = module.add_cpp_namespace('dot11s')
    register_types_ns3_dot11s(nested_module)

    ## Register a nested module for the namespace flame

    nested_module = module.add_cpp_namespace('flame')
    register_types_ns3_flame(nested_module)

    ## 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 olsr

    nested_module = module.add_cpp_namespace('olsr')
    register_types_ns3_olsr(nested_module)
예제 #7
0
def my_module_gen(out_file):

    mod = Module('foo')
    foomodulegen_common.customize_module_pre(mod)

    mod.add_include('"foo.h"')

    mod.add_function('TypeNameGet',
                     'std::string', [],
                     custom_name='IntegerTypeNameGet',
                     template_parameters=['int'])

    Foo = mod.add_class('Foo', automatic_type_narrowing=True)

    Foo.add_static_attribute('instance_count', ReturnValue.new('int'))
    Foo.add_constructor([Parameter.new('std::string', 'datum')])
    Foo.add_constructor([])
    Foo.add_constructor([Parameter.new('const Foo&', 'foo')])
    Foo.add_method('get_datum', ReturnValue.new('const std::string'), [])
    Foo.add_method('is_initialized',
                   ReturnValue.new('bool'), [],
                   is_const=True)
    Foo.add_output_stream_operator()
    Foo.add_method('add_sub',
                   ReturnValue.new('int'), [
                       Parameter.new('int', 'a'),
                       Parameter.new('int', 'b', default_value='3'),
                       Parameter.new('bool', 'subtract', default_value='false')
                   ],
                   is_static=True)
    Foo.add_custom_instance_attribute("is_unique",
                                      "bool",
                                      getter="is_unique",
                                      is_const=True)

    Zoo = mod.add_class('Zoo', automatic_type_narrowing=True)
    Zoo.add_constructor([Parameter.new('std::string', 'datum')])
    Zoo.add_constructor([])
    Zoo.add_method('get_datum', ReturnValue.new('std::string'), [])
    Zoo.implicitly_converts_to(Foo)

    Foobar = mod.add_class('Foobar', allow_subclassing=True)
    Foobar.add_static_attribute('instance_count', ReturnValue.new('int'))

    Bar = mod.add_class('Bar', parent=Foo)
    Bar.inherit_default_constructors()
    ## a static method..
    Bar.add_method('Hooray',
                   ReturnValue.new('std::string'), [],
                   is_static=True)

    ## to test RTTI with a hidden subclass
    mod.add_function('get_hidden_subclass_pointer',
                     ReturnValue.new('Foo*', caller_owns_return=True), [])

    ## Zbr is a reference counted class
    Zbr = mod.add_class('Zbr',
                        memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                            incref_method='Ref',
                            decref_method='Unref',
                            peekref_method="GetReferenceCount"),
                        allow_subclassing=True)

    def helper_class_hook(helper_class):
        helper_class.add_custom_method(
            declaration="static int custom_method_added_by_a_hook(int x);",
            body="""
int %s::custom_method_added_by_a_hook(int x)
{
  return x + 1;
}
""" % helper_class.name)
        helper_class.add_post_generation_code(
            "// this comment was written by a helper class hook function")

    Zbr.add_helper_class_hook(helper_class_hook)

    Zbr.add_constructor([])
    Zbr.add_constructor([Parameter.new('std::string', 'datum')])
    Zbr.add_method('get_datum', ReturnValue.new('std::string'), [])
    Zbr.add_method('get_int',
                   ReturnValue.new('int'), [Parameter.new('int', 'x')],
                   is_virtual=True)
    Zbr.add_static_attribute('instance_count', ReturnValue.new('int'))
    Zbr.add_method(
        'get_value', ReturnValue.new('int'),
        [Parameter.new('int*', 'x', direction=Parameter.DIRECTION_OUT)])

    mod.add_function('store_zbr', None,
                     [Parameter.new('Zbr*', 'zbr', transfer_ownership=True)])
    mod.add_function('invoke_zbr', ReturnValue.new('int'),
                     [Parameter.new('int', 'x')])
    mod.add_function('delete_stored_zbr', None, [])

    mod.add_function('print_something',
                     ReturnValue.new('int'),
                     [Parameter.new('const char*', 'message')],
                     deprecated=True)
    mod.add_function('print_something_else', ReturnValue.new('int'),
                     [Parameter.new('const char*', 'message2')])

    ## test overloaded functions
    mod.add_function('get_int_from_string',
                     ReturnValue.new('int'), [
                         Parameter.new('const char*', 'from_string'),
                         Parameter.new('int', 'multiplier', default_value='1')
                     ],
                     custom_name="get_int")
    mod.add_function('get_int_from_float',
                     ReturnValue.new('int'), [
                         Parameter.new('double', 'from_float'),
                         Parameter.new('int', 'multiplier', default_value='1')
                     ],
                     custom_name="get_int")

    ## test free_after_copy.
    mod.add_function('return_c_string_to_be_freed',
                     ReturnValue.new('char *', free_after_copy=True),
                     [Parameter.new('int', 'size')])
    mod.add_function('return_c_string_to_not_be_freed',
                     ReturnValue.new('char *', free_after_copy=False),
                     [Parameter.new('int', 'size')])

    ToBeFreed = mod.add_class('ToBeFreed')
    ToBeFreed.add_constructor([Parameter.new('int', 'size')])
    ToBeFreed.add_copy_constructor()
    ToBeFreed.add_method('value', ReturnValue.new('char *'), [])
    mod.add_function('return_class_to_be_freed',
                     ReturnValue.new('ToBeFreed *', free_after_copy=True),
                     [Parameter.new('int', 'size')])
    mod.add_function('return_class_to_not_be_freed',
                     ReturnValue.new('ToBeFreed *', free_after_copy=False),
                     [Parameter.new('int', 'size')])

    SomeObject = mod.add_class('SomeObject', allow_subclassing=True)

    SomeObject.add_instance_attribute('foo',
                                      ReturnValue.new('Foo'),
                                      getter='get_foo_value',
                                      setter='set_foo_value')
    SomeObject.add_instance_attribute('m_prefix',
                                      ReturnValue.new('std::string'))
    SomeObject.add_static_attribute('staticData',
                                    ReturnValue.new('std::string'))

    SomeObject.add_static_attribute('instance_count', ReturnValue.new('int'))

    SomeObject.add_method('add_prefix', ReturnValue.new('int'), [
        Parameter.new(
            'std::string&', 'message', direction=Parameter.DIRECTION_INOUT)
    ])
    SomeObject.add_constructor([Parameter.new('std::string', 'prefix')])
    SomeObject.add_constructor([Parameter.new('int', 'prefix_len')])

    SomeObject.add_method(
        'operator()',
        ReturnValue.new('int'), [
            Parameter.new(
                'std::string&', 'message', direction=Parameter.DIRECTION_INOUT)
        ],
        custom_name='__call__')

    # --- some virtual methods ---
    SomeObject.add_method('get_prefix',
                          ReturnValue.new('std::string'), [],
                          is_virtual=True,
                          is_const=True)

    SomeObject.add_method('get_prefix_with_foo_value',
                          ReturnValue.new('std::string'),
                          [Parameter.new('Foo', 'foo')],
                          is_virtual=True,
                          is_const=True)

    SomeObject.add_method(
        'get_prefix_with_foo_ref',
        ReturnValue.new('std::string'), [
            Parameter.new(
                'const Foo&', 'foo', direction=Parameter.DIRECTION_INOUT)
        ],
        is_virtual=True,
        is_const=True)

    SomeObject.add_method(
        'get_prefix_with_foo_ptr',
        ReturnValue.new('std::string'),
        [Parameter.new('const Foo*', 'foo', transfer_ownership=False)],
        is_virtual=True,
        is_const=True)

    ## overloaded virtual methods
    SomeObject.add_method('get_something',
                          ReturnValue.new('std::string'), [],
                          is_virtual=True,
                          is_const=True)
    SomeObject.add_method('get_something',
                          ReturnValue.new('std::string'),
                          [Parameter.new('int', 'x')],
                          is_virtual=True,
                          is_const=True)

    SomeObject.add_method(
        'set_pyobject',
        None,
        [Parameter.new('PyObject*', 'pyobject', transfer_ownership=False)],
        is_virtual=True)
    SomeObject.add_method('get_pyobject',
                          ReturnValue.new('PyObject*',
                                          caller_owns_return=True), [],
                          is_virtual=True)

    ## add a function that appears as a method of an object
    SomeObject.add_function_as_method(
        'some_object_get_something_prefixed',
        ReturnValue.new('std::string'), [
            Parameter.new('const SomeObject*', 'obj',
                          transfer_ownership=False),
            Parameter.new('std::string', 'something')
        ],
        custom_name='get_something_prefixed')

    ## add a function that appears as a method of an object
    SomeObject.add_function_as_method(
        'some_object_val_get_something_prefixed',
        ReturnValue.new('std::string'), [
            Parameter.new('SomeObject', 'obj'),
            Parameter.new('std::string', 'something')
        ],
        custom_name='val_get_something_prefixed')

    ## add a function that appears as a method of an object
    SomeObject.add_function_as_method(
        'some_object_ref_get_something_prefixed',
        ReturnValue.new('std::string'), [
            Parameter.new('const SomeObject&', 'obj'),
            Parameter.new('std::string', 'something')
        ],
        custom_name='ref_get_something_prefixed')

    # ---
    SomeObject.add_method('call_get_prefix', ReturnValue.new('std::string'),
                          [])

    SomeObject.add_method('set_foo_value', None, [Parameter.new('Foo', 'foo')])
    SomeObject.add_method('get_foo_value', ReturnValue.new('Foo'), [])

    SomeObject.add_method(
        'set_foo_ptr', ReturnValue.new('void'),
        [Parameter.new('Foo*', 'foo', transfer_ownership=True)])
    SomeObject.add_method(
        'set_foo_shared_ptr', ReturnValue.new('void'),
        [Parameter.new('Foo*', 'foo', transfer_ownership=False)])

    SomeObject.add_method(
        'get_foo_shared_ptr',
        ReturnValue.new('const Foo*', caller_owns_return=False), [])
    SomeObject.add_method('get_foo_ptr',
                          ReturnValue.new('Foo*', caller_owns_return=True), [])

    SomeObject.add_method(
        'set_foo_by_ref', ReturnValue.new('void'),
        [Parameter.new('Foo&', 'foo', direction=Parameter.DIRECTION_IN)])
    SomeObject.add_method(
        'get_foo_by_ref', ReturnValue.new('void'),
        [Parameter.new('Foo&', 'foo', direction=Parameter.DIRECTION_OUT)])

    ## custodian/ward tests
    SomeObject.add_method(
        'get_foobar_with_self_as_custodian',
        ReturnValue.new('Foobar*', custodian=0,
                        reference_existing_object=True), [])
    SomeObject.add_method(
        'get_foobar_with_other_as_custodian',
        ReturnValue.new('Foobar*', custodian=1,
                        reference_existing_object=True),
        [Parameter.new('SomeObject*', 'other', transfer_ownership=False)])
    SomeObject.add_method(
        'set_foobar_with_self_as_custodian', ReturnValue.new('void'), [
            Parameter.new(
                'Foobar*', 'foobar', transfer_ownership=True, custodian=0)
        ])

    mod.add_function(
        'get_foobar_with_other_as_custodian',
        ReturnValue.new('Foobar*', custodian=1,
                        reference_existing_object=True),
        [Parameter.new('SomeObject*', 'other', transfer_ownership=False)])

    mod.add_function('create_new_foobar',
                     ReturnValue.new('Foobar*', caller_owns_return=True), [])

    mod.add_function(
        'set_foobar_with_other_as_custodian', ReturnValue.new('void'), [
            Parameter.new(
                'Foobar*', 'foobar', transfer_ownership=True, custodian=2),
            Parameter.new('SomeObject*', 'other', transfer_ownership=False)
        ])

    mod.add_function(
        'set_foobar_with_return_as_custodian',
        ReturnValue.new('SomeObject*', caller_owns_return=True), [
            Parameter.new(
                'Foobar*', 'foobar', transfer_ownership=True, custodian=-1)
        ])

    ## get/set recfcounted object Zbr
    SomeObject.add_method('get_zbr',
                          ReturnValue.new('Zbr*', caller_owns_return=True), [])
    SomeObject.add_method('get_internal_zbr',
                          ReturnValue.new('Zbr*', caller_owns_return=True), [])
    SomeObject.add_method('peek_zbr',
                          ReturnValue.new('Zbr*', caller_owns_return=False),
                          [])
    SomeObject.add_method(
        'set_zbr_transfer', ReturnValue.new('void'),
        [Parameter.new('Zbr*', 'zbr', transfer_ownership=True)])
    SomeObject.add_method(
        'set_zbr_shared', ReturnValue.new('void'),
        [Parameter.new('Zbr*', 'zbr', transfer_ownership=False)])

    ## methods with transformed types
    SomeObject.add_method('set_zbr_pholder', ReturnValue.new('void'),
                          [Parameter.new('PointerHolder<Zbr>', 'zbr')])
    SomeObject.add_method('get_zbr_pholder',
                          ReturnValue.new('PointerHolder<Zbr>'), [])

    ## test overloaded methods
    SomeObject.add_method('get_int',
                          ReturnValue.new('int'),
                          [Parameter.new('const char*', 'from_string')],
                          custom_name="get_int")
    SomeObject.add_method('get_int',
                          ReturnValue.new('int'),
                          [Parameter.new('double', 'from_float')],
                          custom_name="get_int")

    # Bug #508577
    SomeObject.add_method('protected_method_that_is_not_virtual',
                          ReturnValue.new('std::string'),
                          [Parameter.new('std::string', 'arg')],
                          is_const=True,
                          visibility='protected')

    SomeObject.add_method('method_returning_cstring',
                          ReturnValue.new('const char *'), [],
                          is_virtual=True,
                          is_const=True)

    mod.add_function(
        'store_some_object', ReturnValue.new('void'),
        [Parameter.new('SomeObject*', 'obj', transfer_ownership=True)])
    mod.add_function('invoke_some_object_get_prefix',
                     ReturnValue.new('std::string'), [])
    mod.add_function('take_some_object',
                     ReturnValue.new('SomeObject*', caller_owns_return=True),
                     [])
    mod.add_function('delete_some_object', ReturnValue.new('void'), [])

    xpto = mod.add_cpp_namespace("xpto")
    xpto.add_function('some_function', ReturnValue.new('std::string'), [])

    ## enums..
    xpto.add_enum('FooType', ['FOO_TYPE_AAA', 'FOO_TYPE_BBB', 'FOO_TYPE_CCC'])
    xpto.add_function('get_foo_type', ReturnValue.new('FooType'), [])
    xpto.add_function('set_foo_type', ReturnValue.new('void'),
                      [Parameter.new("FooType", 'type')])
    xpto.add_function('set_foo_type_inout', ReturnValue.new('void'), [
        Parameter.new("FooType&", 'type', direction=Parameter.DIRECTION_INOUT)
    ])
    xpto.add_function('set_foo_type_ptr', ReturnValue.new('void'), [
        Parameter.new("FooType*", 'type', direction=Parameter.DIRECTION_INOUT)
    ])

    xpto_SomeClass = xpto.add_class(
        'SomeClass', docstring="This is the docstring for SomeClass")
    xpto_SomeClass.add_constructor([])

    xpto.add_typedef(Foo, 'FooXpto')
    xpto.add_function('get_foo_datum', 'std::string',
                      [Parameter.new('const xpto::FooXpto&', 'foo')])

    typehandlers.add_type_alias('uint32_t', 'xpto::FlowId')
    xpto.add_function('get_flow_id', 'xpto::FlowId',
                      [Parameter.new('xpto::FlowId', 'flowId')])

    # bug #798383
    XptoClass = xpto.add_struct('XptoClass')
    XptoClass.add_method("GetSomeClass",
                         retval("xpto::SomeClass*", caller_owns_return=True),
                         [])

    ## ---- some implicity conversion APIs
    mod.add_function('function_that_takes_foo', ReturnValue.new('void'),
                     [Parameter.new('Foo', 'foo')])
    mod.add_function('function_that_returns_foo', ReturnValue.new('Foo'), [])

    cls = mod.add_class('ClassThatTakesFoo')
    cls.add_constructor([Parameter.new('Foo', 'foo')])
    cls.add_method('get_foo', ReturnValue.new('Foo'), [])

    cls = mod.add_class('SingletonClass', is_singleton=True)
    cls.add_method('GetInstance',
                   ReturnValue.new('SingletonClass*', caller_owns_return=True),
                   [],
                   is_static=True)

    ## A class that has no public default constructor...
    cls = mod.add_class('InterfaceId', is_singleton=True)
    ## A function that returns such a class...
    mod.add_function('make_interface_id', ReturnValue.new('InterfaceId'), [])

    ## A class the cannot be constructed; this will cause late CodeGenerationError's
    cls = mod.add_class('CannotBeConstructed')
    cls.set_cannot_be_constructed("no reason")
    cls.add_method('get_value',
                   ReturnValue.new('CannotBeConstructed'), [],
                   is_static=True)
    cls.add_method('get_ptr',
                   ReturnValue.new('CannotBeConstructed*',
                                   caller_owns_return=True), [],
                   is_static=True)
    mod.add_function('get_cannot_be_constructed_value',
                     ReturnValue.new('CannotBeConstructed'), [])
    mod.add_function(
        'get_cannot_be_constructed_ptr',
        ReturnValue.new('CannotBeConstructed*', caller_owns_return=True), [])

    ## A nested class
    #NestedClass = mod.add_class('NestedClass', automatic_type_narrowing=True, outer_class=SomeObject)
    NestedClass = SomeObject.add_class('NestedClass',
                                       automatic_type_narrowing=True)
    NestedClass.add_static_attribute('instance_count', ReturnValue.new('int'))
    NestedClass.add_constructor([Parameter.new('std::string', 'datum')])
    NestedClass.add_constructor([])
    NestedClass.add_method('get_datum', ReturnValue.new('std::string'), [])

    ## A nested enum..
    #mod.add_enum('NestedEnum', ['FOO_TYPE_AAA', 'FOO_TYPE_BBB', 'FOO_TYPE_CCC'], outer_class=SomeObject)
    SomeObject.add_enum('NestedEnum',
                        ['FOO_TYPE_AAA', 'FOO_TYPE_BBB', 'FOO_TYPE_CCC'])

    ## anonymous enum
    SomeObject.add_enum('', ['CONSTANT_A', 'CONSTANT_B', 'CONSTANT_C'])

    AbstractBaseClass2 = mod.add_class('AbstractBaseClass2',
                                       allow_subclassing=True)

    AbstractBaseClass2.add_method('invoke_private_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_const=True)
    AbstractBaseClass2.add_method('invoke_protected_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_const=True)
    AbstractBaseClass2.add_method('invoke_protected_pure_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_const=True)
    AbstractBaseClass2.add_constructor([], visibility='protected')

    AbstractBaseClass2.add_method('protected_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_virtual=True,
                                  visibility='protected',
                                  is_const=True)
    AbstractBaseClass2.add_method('protected_pure_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_virtual=True,
                                  is_pure_virtual=True,
                                  visibility='protected',
                                  is_const=True)

    AbstractBaseClass2.add_method('private_virtual',
                                  ReturnValue.new('int'),
                                  [Parameter.new('int', 'x')],
                                  is_virtual=True,
                                  is_pure_virtual=True,
                                  visibility='private',
                                  is_const=True)

    AbstractXpto = mod.add_class('AbstractXpto', allow_subclassing=True)
    AbstractXpto.add_method('something',
                            ReturnValue.new('void'),
                            [Parameter.new('int', 'x')],
                            is_const=True,
                            is_virtual=True,
                            is_pure_virtual=True)
    AbstractXpto.add_constructor([])

    AbstractXptoImpl = mod.add_class('AbstractXptoImpl', parent=AbstractXpto)
    AbstractXptoImpl.add_method('something',
                                ReturnValue.new('void'),
                                [Parameter.new('int', 'x')],
                                is_const=True,
                                is_virtual=True,
                                is_pure_virtual=False)
    AbstractXptoImpl.add_constructor([])

    Word = mod.add_class('Word')
    Word.add_instance_attribute('low', 'uint8_t', is_const=False)
    Word.add_instance_attribute('high', 'uint8_t', is_const=False)
    Word.add_instance_attribute('word', 'uint16_t', is_const=False)
    Word.add_constructor([])

    mod.add_function('matrix_sum_of_elements', ReturnValue.new('float'), [
        Parameter.new("float*",
                      'matrix',
                      direction=Parameter.DIRECTION_IN,
                      array_length=6)
    ])

    mod.add_function('matrix_identity_new', ReturnValue.new('void'), [
        Parameter.new("float*",
                      'matrix',
                      direction=Parameter.DIRECTION_OUT,
                      array_length=6)
    ])

    top_ns = mod.add_cpp_namespace('TopNs')
    outer_base = top_ns.add_class('OuterBase')
    bottom_ns = top_ns.add_cpp_namespace('PrefixBottomNs')
    inner = bottom_ns.add_class('PrefixInner', parent=outer_base)
    inner.add_constructor([])
    inner.add_method('Do', 'void', [])

    Socket = mod.add_class('Socket', allow_subclassing=True)
    Socket.add_constructor([])
    Socket.add_method('Bind', ReturnValue.new('int'), [], is_virtual=True)
    Socket.add_method('Bind',
                      ReturnValue.new('int'),
                      [Parameter.new('int', 'address')],
                      is_virtual=True)

    UdpSocket = mod.add_class('UdpSocket', parent=Socket)
    UdpSocket.add_constructor([])
    UdpSocket.add_method('Bind', ReturnValue.new('int'), [], is_virtual=True)

    simple_struct_t = mod.add_struct('simple_struct_t')
    simple_struct_t.add_instance_attribute('xpto', 'int')

    # containers...
    mod.add_container('SimpleStructList', ReturnValue.new('simple_struct_t'),
                      'list')
    mod.add_function('get_simple_list', ReturnValue.new('SimpleStructList'),
                     [])
    mod.add_function('set_simple_list', 'int',
                     [Parameter.new('SimpleStructList', 'list')])

    mod.add_container('std::set<float>', 'float', 'set')

    TestContainer = mod.add_class('TestContainer', allow_subclassing=True)
    TestContainer.add_constructor([])
    TestContainer.add_instance_attribute('m_floatSet', 'std::set<float>')
    TestContainer.add_method('get_simple_list',
                             ReturnValue.new('SimpleStructList'), [],
                             is_virtual=True)
    TestContainer.add_method('set_simple_list',
                             'int',
                             [Parameter.new('SimpleStructList', 'list')],
                             is_virtual=True)
    TestContainer.add_method(
        'set_simple_list_by_ref',
        'int', [
            Parameter.new('SimpleStructList&',
                          'inout_list',
                          direction=Parameter.DIRECTION_INOUT)
        ],
        is_virtual=True)

    mod.add_container('std::vector<simple_struct_t>',
                      ReturnValue.new('simple_struct_t'), 'vector')
    TestContainer.add_method('get_simple_vec',
                             ReturnValue.new('std::vector<simple_struct_t>'),
                             [],
                             is_virtual=True)
    TestContainer.add_method(
        'set_simple_vec',
        'int', [Parameter.new('std::vector<simple_struct_t>', 'vec')],
        is_virtual=True)

    mod.add_container('std::vector<std::string>', 'std::string', 'vector')
    TestContainer.add_method('get_vec', 'void', [
        Parameter.new('std::vector<std::string> &',
                      'outVec',
                      direction=Parameter.DIRECTION_OUT)
    ])

    TestContainer.add_method('set_vec_ptr', 'void', [
        Parameter.new('std::vector<std::string>*',
                      'inVec',
                      direction=Parameter.DIRECTION_IN,
                      transfer_ownership=True)
    ])
    TestContainer.add_method('get_vec_ptr', 'void', [
        Parameter.new('std::vector<std::string>*',
                      'outVec',
                      direction=Parameter.DIRECTION_OUT)
    ])

    mod.add_container(
        'std::map<std::string, simple_struct_t>',
        (ReturnValue.new('std::string'), ReturnValue.new('simple_struct_t')),
        'map')
    TestContainer.add_method(
        'get_simple_map',
        ReturnValue.new('std::map<std::string, simple_struct_t>'), [],
        is_virtual=True)
    TestContainer.add_method(
        'set_simple_map',
        'int',
        [Parameter.new('std::map<std::string, simple_struct_t>', 'map')],
        is_virtual=True)

    mod.add_container('SimpleStructUnorderedMap',
                      ('std::string', 'simple_struct_t'),
                      container_type='map')
    typehandlers.add_type_alias(
        'std::unordered_map< std::string, simple_struct_t >',
        'SimpleStructUnorderedMap')
    typehandlers.add_type_alias(
        'std::unordered_map< std::string, simple_struct_t >*',
        'SimpleStructUnorderedMap*')
    typehandlers.add_type_alias(
        'std::unordered_map< std::string, simple_struct_t >&',
        'SimpleStructUnorderedMap&')

    TestContainer.add_method(
        'get_simple_unordered_map',
        ReturnValue.new('std::unordered_map<std::string, simple_struct_t>'),
        [],
        is_virtual=True)
    TestContainer.add_method(
        'set_simple_unordered_map',
        'int', [
            Parameter.new('std::unordered_map<std::string, simple_struct_t>',
                          'map')
        ],
        is_virtual=True)

    Tupl = mod.add_class('Tupl')
    Tupl.add_binary_comparison_operator('<')
    Tupl.add_binary_comparison_operator('<=')
    Tupl.add_binary_comparison_operator('>=')
    Tupl.add_binary_comparison_operator('>')
    Tupl.add_binary_comparison_operator('==')
    Tupl.add_binary_comparison_operator('!=')
    Tupl.add_binary_numeric_operator('+')
    Tupl.add_binary_numeric_operator('-')
    Tupl.add_binary_numeric_operator('*')
    Tupl.add_binary_numeric_operator('/')
    Tupl.add_instance_attribute('x', 'int', is_const=False)
    Tupl.add_instance_attribute('y', 'int', is_const=False)
    Tupl.add_constructor([Parameter.new('Tupl const &', 'arg0')])
    Tupl.add_constructor([])
    Tupl.add_inplace_numeric_operator('+=')
    Tupl.add_inplace_numeric_operator('-=')
    Tupl.add_inplace_numeric_operator('*=')
    Tupl.add_inplace_numeric_operator('/=')

    Tupl.add_unary_numeric_operator('-')

    Tupl.add_inplace_numeric_operator('+=', right='int')

    ManipulatedObject = mod.add_class('ManipulatedObject')
    ManipulatedObject.add_constructor([])
    ManipulatedObject.add_method('GetValue', 'int', [], is_const=True)
    ManipulatedObject.add_method('SetValue', 'void',
                                 [Parameter.new('int', 'value')])

    ReferenceManipulator = mod.add_class('ReferenceManipulator',
                                         allow_subclassing=True)
    ReferenceManipulator.add_constructor([])
    ReferenceManipulator.add_method('manipulate_object', 'int', [])
    ReferenceManipulator.add_method(
        'do_manipulate_object',
        'void', [
            Parameter.new('ManipulatedObject&',
                          'obj',
                          direction=Parameter.DIRECTION_INOUT)
        ],
        is_virtual=True,
        is_pure_virtual=True)

    VectorLike = mod.add_class('VectorLike')
    VectorLike.add_constructor([])
    VectorLike.add_constructor([Parameter.new("VectorLike&", "obj")])
    VectorLike.add_method('get_len', 'size_t', [], custom_name='__len__')
    VectorLike.add_method('add_VectorLike',
                          'VectorLike', [Parameter.new('VectorLike', 'rhs')],
                          custom_name='__add__')
    VectorLike.add_method('iadd_VectorLike',
                          'VectorLike', [Parameter.new('VectorLike', 'rhs')],
                          custom_name='__iadd__')
    VectorLike.add_method('mul_VectorLike',
                          'VectorLike', [Parameter.new('unsigned int', 'n')],
                          custom_name='__mul__')
    VectorLike.add_method('imul_VectorLike',
                          'VectorLike', [Parameter.new('unsigned int', 'n')],
                          custom_name='__imul__')
    VectorLike.add_method(
        'set_item',
        'int',
        [Parameter.new('int', 'index'),
         Parameter.new('double', 'value')],
        custom_name='__setitem__')
    VectorLike.add_method('get_item',
                          'double', [Parameter.new('int', 'index')],
                          custom_name='__getitem__')
    VectorLike.add_method('set_slice',
                          'int', [
                              Parameter.new('int', 'index1'),
                              Parameter.new('int', 'index2'),
                              Parameter.new('VectorLike', 'values')
                          ],
                          custom_name='__setslice__')
    VectorLike.add_method(
        'get_slice',
        'VectorLike',
        [Parameter.new('int', 'index1'),
         Parameter.new('int', 'index2')],
        custom_name='__getslice__')
    VectorLike.add_method('contains_value',
                          'int', [Parameter.new('double', 'value')],
                          custom_name='__contains__')
    VectorLike.add_method('append', 'void', [Parameter.new('double', 'value')])

    VectorLike2 = mod.add_class('VectorLike2')
    VectorLike2.add_constructor([])
    VectorLike2.add_method('append', 'void',
                           [Parameter.new('double', 'value')])

    MapLike = mod.add_class('MapLike')
    MapLike.add_constructor([])
    MapLike.add_method(
        'set', 'void',
        [Parameter.new('int', 'key'),
         Parameter.new('double', 'value')])

    Error = mod.add_exception('Error')
    DomainError = mod.add_exception('DomainError', parent=Error)

    mod.add_function('my_inverse_func',
                     'double', [Parameter.new('double', 'x')],
                     throw=[DomainError])

    ClassThatThrows = mod.add_class('ClassThatThrows', allow_subclassing=True)
    ClassThatThrows.add_constructor([Parameter.new('double', 'x')],
                                    throw=[DomainError])
    ClassThatThrows.add_method('my_inverse_method',
                               'double', [Parameter.new('double', 'x')],
                               throw=[DomainError])

    std_exception = mod.add_exception('exception',
                                      foreign_cpp_namespace='std',
                                      message_rvalue='%(EXC)s.what()')
    mod.add_function('my_inverse_func2',
                     'double', [Parameter.new('double', 'x')],
                     throw=[std_exception])
    ClassThatThrows.add_method('my_inverse_method2',
                               'double', [Parameter.new('double', 'x')],
                               throw=[std_exception])

    mod.add_function('my_inverse_func3',
                     'double', [Parameter.new('double', 'x')],
                     throw=[std_exception])
    ClassThatThrows.add_method('my_inverse_method3',
                               'double', [Parameter.new('double', 'x')],
                               throw=[std_exception])

    ClassThatThrows.add_method('throw_error',
                               'int', [],
                               throw=[mod["out_of_range"]],
                               is_const=True,
                               is_virtual=True)

    ClassThatThrows.add_method('throw_out_of_range',
                               'int', [],
                               throw=[mod["out_of_range"]])

    # https://bugs.launchpad.net/pybindgen/+bug/450255
    ProtectedConstructor = mod.add_class('ProtectedConstructor')
    ProtectedConstructor.add_constructor([])
    ProtectedConstructor.add_constructor(
        [Parameter.new('ProtectedConstructor&', 'c')], visibility='protected')

    # https://bugs.launchpad.net/pybindgen/+bug/455689
    property_std_string = mod.add_struct('property',
                                         template_parameters=['std::string'])

    Box = mod.add_class('Box')
    Box.add_constructor([])
    Box.add_static_attribute('instance_count', ReturnValue.new('int'))
    Box.add_method(
        'getFoobarInternalPtr',
        ReturnValue.new('const Foobar*', reference_existing_object=True), [])
    Box.add_method('getFoobarInternalRef',
                   ReturnValue.new('Foobar&', reference_existing_object=True),
                   [])
    Box.add_method('getFoobarInternalPtr2',
                   ReturnValue.new('Foobar*', return_internal_reference=True),
                   [])
    Box.add_method('getFoobarInternalRef2',
                   ReturnValue.new('Foobar&', return_internal_reference=True),
                   [])
    Box.add_instance_attribute(
        'm_internalFoobar',
        ReturnValue.new('Foobar*', reference_existing_object=True))

    # multiple inheritance
    MIRoot = mod.add_class('MIRoot')
    MIRoot.add_constructor([])
    MIRoot.add_method('root_method', 'int', [], is_const=True)

    MIBase1 = mod.add_class('MIBase1', parent=MIRoot)
    MIBase1.add_constructor([])
    MIBase1.add_method('base1_method', 'int', [], is_const=True)

    MIBase2 = mod.add_class('MIBase2', parent=MIRoot)
    MIBase2.add_constructor([])
    MIBase2.add_method('base2_method', 'int', [], is_const=True)

    MIMixed = mod.add_class('MIMixed', parent=[MIBase1, MIBase2])
    MIMixed.add_constructor([])
    MIMixed.add_method('mixed_method', 'int', [], is_const=True)

    mod.add_function('my_throwing_func', 'Tupl', [], throw=[std_exception])

    IFoo = mod.add_class("IFoo",
                         destructor_visibility='protected',
                         allow_subclassing=True)
    IFoo.add_method("DoSomething", None, [], is_pure_virtual=True)

    IFooImpl = mod.add_class("IFooImpl",
                             parent=IFoo,
                             destructor_visibility='public')
    IFooImpl.add_constructor([])
    IFooImpl.add_method("DoSomething", None, [], is_virtual=True)

    mod.add_function(
        "test_args_kwargs", "int",
        [param("const char *", "args"),
         param("const char *", "kwargs")])

    # https://github.com/gjcarneiro/pybindgen/issues/21
    cls = mod.add_class('RAStruct')
    cls.add_constructor([])
    cls.add_constructor([param('RAStruct const &', 'arg0')])
    cls.add_instance_attribute('a', 'int', is_const=False)

    cls = mod.add_class('ReturnConstRef', allow_subclassing=True)
    cls.add_constructor([])
    cls.add_constructor([param('ReturnConstRef const &', 'arg0')])
    cls.add_method('ReturnMyAStruct',
                   'RAStruct const &', [],
                   is_pure_virtual=True,
                   is_virtual=True)

    cls = mod.add_class('RAReturnConstRef', parent=mod['ReturnConstRef'])
    cls.add_constructor([])
    cls.add_constructor([param('int', 'value')])
    cls.add_constructor([param('RAReturnConstRef const &', 'arg0')])
    cls.add_method('ReturnMyAStruct', 'RAStruct const &', [], is_virtual=True)

    #### --- error handler ---
    class MyErrorHandler(pybindgen.settings.ErrorHandler):
        def __init__(self):
            super(MyErrorHandler, self).__init__()
            self.num_errors = 0

        def handle_error(self, wrapper, exception, traceback_):
            print("exception %s in wrapper %s" % (exception, wrapper),
                  file=sys.stderr)
            self.num_errors += 1
            if 0:  # verbose?
                import traceback
                traceback.print_tb(traceback_)
            return True

    pybindgen.settings.error_handler = MyErrorHandler()

    foomodulegen_common.customize_module(mod)

    ## ---- finally, generate the whole thing ----
    mod.generate(FileCodeSink(out_file))
예제 #8
0
def register_types(module):
    root_module = module.get_root()
    
    ## mesh-wifi-beacon.h: ns3::MeshWifiBeacon [class]
    module.add_class('MeshWifiBeacon')
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::MeshWifiInterfaceMacPlugin', 'ns3::empty', 'ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## mesh-information-element-vector.h: ns3::MeshInformationElementVector [class]
    module.add_class('MeshInformationElementVector', parent=root_module['ns3::WifiInformationElementVector'])
    ## mesh-l2-routing-protocol.h: ns3::MeshL2RoutingProtocol [class]
    module.add_class('MeshL2RoutingProtocol', parent=root_module['ns3::Object'])
    ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
    module.add_class('MeshWifiInterfaceMac', parent=root_module['ns3::WifiMac'])
    ## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin [class]
    module.add_class('MeshWifiInterfaceMacPlugin', parent=root_module['ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >'])
    ## mesh-point-device.h: ns3::MeshPointDevice [class]
    module.add_class('MeshPointDevice', parent=root_module['ns3::NetDevice'])
    
    ## 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 FatalImpl
    
    nested_module = module.add_cpp_namespace('FatalImpl')
    register_types_ns3_FatalImpl(nested_module)
    
    
    ## Register a nested module for the namespace addressUtils
    
    nested_module = module.add_cpp_namespace('addressUtils')
    register_types_ns3_addressUtils(nested_module)
    
    
    ## Register a nested module for the namespace aodv
    
    nested_module = module.add_cpp_namespace('aodv')
    register_types_ns3_aodv(nested_module)
    
    
    ## Register a nested module for the namespace dot11s
    
    nested_module = module.add_cpp_namespace('dot11s')
    register_types_ns3_dot11s(nested_module)
    
    
    ## Register a nested module for the namespace flame
    
    nested_module = module.add_cpp_namespace('flame')
    register_types_ns3_flame(nested_module)
    
    
    ## 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 olsr
    
    nested_module = module.add_cpp_namespace('olsr')
    register_types_ns3_olsr(nested_module)
def register_types(module):
    module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core')
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core',
                     template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'],
                     parent=module['ns3::ObjectBase'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    module.add_class('Object', import_from_module='ns.core', parent=module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >'])

    module.add_class('TypeId', import_from_module='ns.core')
    module.add_class('AttributeValue', import_from_module='ns.core')

    module.add_class('NodeContainer', import_from_module='ns.network')
    module.add_class('Node', import_from_module='ns.network', parent=module['ns3::Object'])
    module.add_class('ApplicationContainer', import_from_module='ns.network')

    # ZhangYu 2017-9-16, should state before use
    module.add_class('empty', import_from_module='ns.core')
    module.add_cpp_namespace('empty')
    # ZhangYu 2017-9-16 for tracer, refer to same file in ubuntu 12.04, should state before use
    root_module=module.get_root()
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::AppDelayTracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::AppDelayTracer> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::AppDelayTracer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::AppDelayTracer>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::CsTracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::CsTracer> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::CsTracer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::CsTracer>'], parent=module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::ndn::L3Tracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::L3Tracer> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::ndn::L3Tracer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::ndn::L3Tracer>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::L2Tracer, ns3::empty, ns3::DefaultDeleter<ns3::L2Tracer> > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::L2Tracer', 'ns3::empty', 'ns3::DefaultDeleter<ns3::L2Tracer>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))

    ## if not state follow sentence, the method InstallAll of CsTracer will not appear because of the type ns3::Time can not be recognized 
    ## nstime.h (module 'core'): ns3::Time [class]
    module.add_class('Time', import_from_module='ns.core')
    
    ## names.h (module 'core'): ns3::Names [class]
    #module.add_cpp_namespace('Names')
    #module.add_class('Names', import_from_module='ns.core')
    #Module('Names',cpp_namespace="::Names")



    def reg_ndn(module):
        module.add_class('StackHelper')
        module.add_class('FibHelper')
        module.add_class('StrategyChoiceHelper')
        module.add_class('AppHelper')
        module.add_class('GlobalRoutingHelper')

        module.add_class('L3Protocol', parent=module.get_root()['ns3::Object'])

        module.add_class('Name')
        module.add_class('Interest')
        module.add_class('Data')
        module.add_class('Face', memory_policy=StdSharedPtr('ns3::ndn::Face'))
        module.add_class('FaceContainer', memory_policy=Ns3PtrMemoryPolicy('::ns3::ndn::FaceContainer'))

        def reg_name(module):
            module.add_class('Component')
        reg_name(module.add_cpp_namespace('name'))

        def reg_nfd(module):
            module.add_class('Forwarder', memory_policy=StdSharedPtr('::ns3::ndn::nfd::Forwarder'), is_singleton=True)
            module.add_class('Fib')
            module.add_class('Pit')
            module.add_class('Cs')

            def reg_fib(module):
                module.add_class('Entry')#, memory_policy=StdSharedPtr('ns3::ndn::nfd::fib::Entry'))
                module.add_class('NextHop')
                module.add_class('NextHopList')
            reg_fib(module.add_cpp_namespace('fib'))

            def reg_pit(module):
                module.add_class('Entry')#, memory_policy=StdSharedPtr('ns3::ndn::nfd::pit::Entry'))
            reg_pit(module.add_cpp_namespace('pit'))

            def reg_cs(module):
                module.add_class('Entry')#, memory_policy=StdSharedPtr('ns3::ndn::nfd::cs::Entry'))
            reg_cs(module.add_cpp_namespace('cs'))

        reg_nfd(module.add_cpp_namespace('nfd'))
        
        #ZhangYu 2017-9-16 ------------------------Tracer---------------------
        root_module=module.get_root()
        module.add_class('AppDelayTracer', parent=root_module['ns3::SimpleRefCount< ns3::ndn::AppDelayTracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::AppDelayTracer> >'])
        module.add_class('CsTracer', parent=root_module['ns3::SimpleRefCount< ns3::ndn::CsTracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::CsTracer> >'])
        module.add_class('L3Tracer', parent=root_module['ns3::SimpleRefCount< ns3::ndn::L3Tracer, ns3::empty, ns3::DefaultDeleter<ns3::ndn::L3Tracer> >'])
        module.add_class('L3RateTracer', parent=root_module['ns3::ndn::L3Tracer'])
        ## ndn-l3-aggregate-tracer.h (module 'ndnSIM'): ns3::ndn::L3AggregateTracer [class]
        #module.add_class('L3AggregateTracer', parent=root_module['ns3::ndn::L3Tracer'])


    reg_ndn(module.add_cpp_namespace('ndn'))

    ## l2-tracer.h (module 'ndnSIM'): ns3::L2Tracer [class]
    module.add_class('L2Tracer', parent=root_module['ns3::SimpleRefCount< ns3::L2Tracer, ns3::empty, ns3::DefaultDeleter<ns3::L2Tracer> >'])
    ## l2-rate-tracer.h (module 'ndnSIM'): ns3::L2RateTracer [class]
    module.add_class('L2RateTracer', parent=root_module['ns3::L2Tracer'])
    
    # ZhangYu 2017-9-4, refer to the same file in ubuntu 12.04, also can see from http://ndnsim.net/2.3/doxygen/classns3_1_1AnnotatedTopologyReader.html
    # refer to scr/topology-read/modulegen_gcc_ILP32.py
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TopologyReader', 'ns3::empty',
    'ns3::DefaultDeleter<ns3::TopologyReader>'], parent=module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref',
        peekref_method='GetReferenceCount'))
    module.add_class('TopologyReader',allow_subclassing=True, import_from_module='ns.topology_read',parent=module['ns3::SimpleRefCount< ns3::TopologyReader, ns3::empty, ns3::DefaultDeleter<ns3::TopologyReader> >'])
    Module("TopologyReader",cpp_namespace="::TopologyReader")
    # Refer to the file in Ubuntu1204, annotated-topology-reader.h (module 'ndnSIM'): ns3::AnnotatedTopologyReader [class]
    module.add_class('AnnotatedTopologyReader', allow_subclassing=True, parent=module['ns3::TopologyReader'])
    Module("AnnotatedTopologyReader",cpp_namespace="ns3::AnnotatedTopologyReader")
def register_types(module):
    module.add_class('ObjectBase',
                     allow_subclassing=True,
                     import_from_module='ns.core')
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'
                     ],
                     parent=module['ns3::ObjectBase'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    module.add_class(
        'Object',
        import_from_module='ns.core',
        parent=module[
            'ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']
    )

    module.add_class('TypeId', import_from_module='ns.core')
    module.add_class('AttributeValue', import_from_module='ns.core')

    module.add_class('NodeContainer', import_from_module='ns.network')
    module.add_class('Node',
                     import_from_module='ns.network',
                     parent=module['ns3::Object'])
    module.add_class('ApplicationContainer', import_from_module='ns.network')

    def reg_ndn(module):
        module.add_class('StackHelper')
        module.add_class('FibHelper')
        module.add_class('StrategyChoiceHelper')
        module.add_class('AppHelper')
        module.add_class('GlobalRoutingHelper')

        module.add_class('L3Protocol', parent=module.get_root()['ns3::Object'])

        module.add_class('Name')
        module.add_class('Interest')
        module.add_class('Data')
        module.add_class('Face', memory_policy=StdSharedPtr('ns3::ndn::Face'))

        def reg_name(module):
            module.add_class('Component')

        reg_name(module.add_cpp_namespace('name'))

        def reg_nfd(module):
            module.add_class(
                'Forwarder',
                memory_policy=StdSharedPtr('::ns3::ndn::nfd::Forwarder'),
                is_singleton=True)
            module.add_class('Fib')
            module.add_class('Pit')
            module.add_class('Cs')
            module.add_class('FaceTable')
            module.add_class('Face')

            def reg_fib(module):
                module.add_class(
                    'Entry'
                )  #, memory_policy=StdSharedPtr('ns3::ndn::nfd::fib::Entry'))
                module.add_class('NextHop')
                module.add_class('NextHopList')

            reg_fib(module.add_cpp_namespace('fib'))

            def reg_pit(module):
                module.add_class(
                    'Entry'
                )  #, memory_policy=StdSharedPtr('ns3::ndn::nfd::pit::Entry'))

            reg_pit(module.add_cpp_namespace('pit'))

            def reg_cs(module):
                module.add_class(
                    'Entry'
                )  #, memory_policy=StdSharedPtr('ns3::ndn::nfd::cs::Entry'))

            reg_cs(module.add_cpp_namespace('cs'))

        reg_nfd(module.add_cpp_namespace('nfd'))

    reg_ndn(module.add_cpp_namespace('ndn'))
예제 #11
0
def register_types(module):
    root_module = module.get_root()

    ## wifi-mac-header.h (module 'wifi'): ns3::WifiMacType [enumeration]
    module.add_enum('WifiMacType', [
        'WIFI_MAC_CTL_CTLWRAPPER', 'WIFI_MAC_CTL_RTS', 'WIFI_MAC_CTL_CTS',
        'WIFI_MAC_CTL_ACK', 'WIFI_MAC_CTL_BACKREQ', 'WIFI_MAC_CTL_BACKRESP',
        'WIFI_MAC_MGT_BEACON', 'WIFI_MAC_MGT_ASSOCIATION_REQUEST',
        'WIFI_MAC_MGT_ASSOCIATION_RESPONSE', 'WIFI_MAC_MGT_DISASSOCIATION',
        'WIFI_MAC_MGT_REASSOCIATION_REQUEST',
        'WIFI_MAC_MGT_REASSOCIATION_RESPONSE', 'WIFI_MAC_MGT_PROBE_REQUEST',
        'WIFI_MAC_MGT_PROBE_RESPONSE', 'WIFI_MAC_MGT_AUTHENTICATION',
        'WIFI_MAC_MGT_DEAUTHENTICATION', 'WIFI_MAC_MGT_ACTION',
        'WIFI_MAC_MGT_ACTION_NO_ACK', 'WIFI_MAC_MGT_MULTIHOP_ACTION',
        'WIFI_MAC_DATA', 'WIFI_MAC_DATA_CFACK', 'WIFI_MAC_DATA_CFPOLL',
        'WIFI_MAC_DATA_CFACK_CFPOLL', 'WIFI_MAC_DATA_NULL',
        'WIFI_MAC_DATA_NULL_CFACK', 'WIFI_MAC_DATA_NULL_CFPOLL',
        'WIFI_MAC_DATA_NULL_CFACK_CFPOLL', 'WIFI_MAC_QOSDATA',
        'WIFI_MAC_QOSDATA_CFACK', 'WIFI_MAC_QOSDATA_CFPOLL',
        'WIFI_MAC_QOSDATA_CFACK_CFPOLL', 'WIFI_MAC_QOSDATA_NULL',
        'WIFI_MAC_QOSDATA_NULL_CFPOLL', 'WIFI_MAC_QOSDATA_NULL_CFACK_CFPOLL'
    ],
                    import_from_module='ns.wifi')
    ## wifi-preamble.h (module 'wifi'): ns3::WifiPreamble [enumeration]
    module.add_enum('WifiPreamble', [
        'WIFI_PREAMBLE_LONG', 'WIFI_PREAMBLE_SHORT', 'WIFI_PREAMBLE_HT_MF',
        'WIFI_PREAMBLE_HT_GF', 'WIFI_PREAMBLE_VHT', 'WIFI_PREAMBLE_NONE'
    ],
                    import_from_module='ns.wifi')
    ## wifi-phy.h (module 'wifi'): ns3::mpduType [enumeration]
    module.add_enum(
        'mpduType',
        ['NORMAL_MPDU', 'MPDU_IN_AGGREGATE', 'LAST_MPDU_IN_AGGREGATE'],
        import_from_module='ns.wifi')
    ## wifi-mode.h (module 'wifi'): ns3::WifiModulationClass [enumeration]
    module.add_enum('WifiModulationClass', [
        'WIFI_MOD_CLASS_UNKNOWN', 'WIFI_MOD_CLASS_IR', 'WIFI_MOD_CLASS_FHSS',
        'WIFI_MOD_CLASS_DSSS', 'WIFI_MOD_CLASS_HR_DSSS',
        'WIFI_MOD_CLASS_ERP_PBCC', 'WIFI_MOD_CLASS_DSSS_OFDM',
        'WIFI_MOD_CLASS_ERP_OFDM', 'WIFI_MOD_CLASS_OFDM', 'WIFI_MOD_CLASS_HT',
        'WIFI_MOD_CLASS_VHT'
    ],
                    import_from_module='ns.wifi')
    ## wifi-phy-standard.h (module 'wifi'): ns3::WifiPhyStandard [enumeration]
    module.add_enum('WifiPhyStandard', [
        'WIFI_PHY_STANDARD_80211a', 'WIFI_PHY_STANDARD_80211b',
        'WIFI_PHY_STANDARD_80211g', 'WIFI_PHY_STANDARD_80211_10MHZ',
        'WIFI_PHY_STANDARD_80211_5MHZ', 'WIFI_PHY_STANDARD_holland',
        'WIFI_PHY_STANDARD_80211n_2_4GHZ', 'WIFI_PHY_STANDARD_80211n_5GHZ',
        'WIFI_PHY_STANDARD_80211ac'
    ],
                    import_from_module='ns.wifi')
    ## qos-utils.h (module 'wifi'): ns3::AcIndex [enumeration]
    module.add_enum(
        'AcIndex',
        ['AC_BE', 'AC_BK', 'AC_VI', 'AC_VO', 'AC_BE_NQOS', 'AC_UNDEF'],
        import_from_module='ns.wifi')
    ## wifi-mode.h (module 'wifi'): ns3::WifiCodeRate [enumeration]
    module.add_enum('WifiCodeRate', [
        'WIFI_CODE_RATE_UNDEFINED', 'WIFI_CODE_RATE_3_4', 'WIFI_CODE_RATE_2_3',
        'WIFI_CODE_RATE_1_2', 'WIFI_CODE_RATE_5_6'
    ],
                    import_from_module='ns.wifi')
    ## address.h (module 'network'): ns3::Address [class]
    module.add_class('Address', import_from_module='ns.network')
    ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
    module.add_enum('MaxSize_e', ['MAX_SIZE'],
                    outer_class=root_module['ns3::Address'],
                    import_from_module='ns.network')
    ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class]
    module.add_class('AttributeConstructionList', import_from_module='ns.core')
    ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct]
    module.add_class('Item',
                     import_from_module='ns.core',
                     outer_class=root_module['ns3::AttributeConstructionList'])
    ## buffer.h (module 'network'): ns3::Buffer [class]
    module.add_class('Buffer', import_from_module='ns.network')
    ## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
    module.add_class('Iterator',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::Buffer'])
    ## packet.h (module 'network'): ns3::ByteTagIterator [class]
    module.add_class('ByteTagIterator', import_from_module='ns.network')
    ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
    module.add_class('Item',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::ByteTagIterator'])
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
    module.add_class('ByteTagList', import_from_module='ns.network')
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
    module.add_class('Iterator',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::ByteTagList'])
    ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
    module.add_class('Item',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::ByteTagList::Iterator'])
    ## callback.h (module 'core'): ns3::CallbackBase [class]
    module.add_class('CallbackBase', import_from_module='ns.core')
    ## dsr-helper.h (module 'dsr'): ns3::DsrHelper [class]
    module.add_class('DsrHelper')
    ## dsr-main-helper.h (module 'dsr'): ns3::DsrMainHelper [class]
    module.add_class('DsrMainHelper')
    ## event-garbage-collector.h (module 'core'): ns3::EventGarbageCollector [class]
    module.add_class('EventGarbageCollector', import_from_module='ns.core')
    ## event-id.h (module 'core'): ns3::EventId [class]
    module.add_class('EventId', import_from_module='ns.core')
    ## hash.h (module 'core'): ns3::Hasher [class]
    module.add_class('Hasher', import_from_module='ns.core')
    ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
    module.add_class('Inet6SocketAddress', import_from_module='ns.network')
    ## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
    root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(
        root_module['ns3::Address'])
    ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
    module.add_class('InetSocketAddress', import_from_module='ns.network')
    ## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
    root_module['ns3::InetSocketAddress'].implicitly_converts_to(
        root_module['ns3::Address'])
    ## int-to-type.h (module 'core'): ns3::IntToType<0> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['0'])
    ## int-to-type.h (module 'core'): ns3::IntToType<0>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 0 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<1> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['1'])
    ## int-to-type.h (module 'core'): ns3::IntToType<1>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 1 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<2> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['2'])
    ## int-to-type.h (module 'core'): ns3::IntToType<2>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 2 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<3> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['3'])
    ## int-to-type.h (module 'core'): ns3::IntToType<3>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 3 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<4> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['4'])
    ## int-to-type.h (module 'core'): ns3::IntToType<4>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 4 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<5> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['5'])
    ## int-to-type.h (module 'core'): ns3::IntToType<5>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 5 >'],
                    import_from_module='ns.core')
    ## int-to-type.h (module 'core'): ns3::IntToType<6> [struct]
    module.add_class('IntToType',
                     import_from_module='ns.core',
                     template_parameters=['6'])
    ## int-to-type.h (module 'core'): ns3::IntToType<6>::v_e [enumeration]
    module.add_enum('v_e', ['value'],
                    outer_class=root_module['ns3::IntToType< 6 >'],
                    import_from_module='ns.core')
    ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
    module.add_class('Ipv4Address', import_from_module='ns.network')
    ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
    root_module['ns3::Ipv4Address'].implicitly_converts_to(
        root_module['ns3::Address'])
    ## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress [class]
    module.add_class('Ipv4InterfaceAddress', import_from_module='ns.internet')
    ## ipv4-interface-address.h (module 'internet'): ns3::Ipv4InterfaceAddress::InterfaceAddressScope_e [enumeration]
    module.add_enum('InterfaceAddressScope_e', ['HOST', 'LINK', 'GLOBAL'],
                    outer_class=root_module['ns3::Ipv4InterfaceAddress'],
                    import_from_module='ns.internet')
    ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class]
    module.add_class('Ipv4Mask', import_from_module='ns.network')
    ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
    module.add_class('Ipv6Address', import_from_module='ns.network')
    ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
    root_module['ns3::Ipv6Address'].implicitly_converts_to(
        root_module['ns3::Address'])
    ## ipv6-interface-address.h (module 'internet'): ns3::Ipv6InterfaceAddress [class]
    module.add_class('Ipv6InterfaceAddress', import_from_module='ns.internet')
    ## ipv6-interface-address.h (module 'internet'): ns3::Ipv6InterfaceAddress::State_e [enumeration]
    module.add_enum('State_e', [
        'TENTATIVE', 'DEPRECATED', 'PREFERRED', 'PERMANENT', 'HOMEADDRESS',
        'TENTATIVE_OPTIMISTIC', 'INVALID'
    ],
                    outer_class=root_module['ns3::Ipv6InterfaceAddress'],
                    import_from_module='ns.internet')
    ## ipv6-interface-address.h (module 'internet'): ns3::Ipv6InterfaceAddress::Scope_e [enumeration]
    module.add_enum('Scope_e', ['HOST', 'LINKLOCAL', 'GLOBAL'],
                    outer_class=root_module['ns3::Ipv6InterfaceAddress'],
                    import_from_module='ns.internet')
    ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class]
    module.add_class('Ipv6Prefix', import_from_module='ns.network')
    ## mac48-address.h (module 'network'): ns3::Mac48Address [class]
    module.add_class('Mac48Address', import_from_module='ns.network')
    ## mac48-address.h (module 'network'): ns3::Mac48Address [class]
    root_module['ns3::Mac48Address'].implicitly_converts_to(
        root_module['ns3::Address'])
    ## node-container.h (module 'network'): ns3::NodeContainer [class]
    module.add_class('NodeContainer', import_from_module='ns.network')
    ## non-copyable.h (module 'core'): ns3::NonCopyable [class]
    module.add_class('NonCopyable',
                     destructor_visibility='protected',
                     import_from_module='ns.core')
    ## object-base.h (module 'core'): ns3::ObjectBase [class]
    module.add_class('ObjectBase',
                     allow_subclassing=True,
                     import_from_module='ns.core')
    ## object.h (module 'core'): ns3::ObjectDeleter [struct]
    module.add_class('ObjectDeleter', import_from_module='ns.core')
    ## object-factory.h (module 'core'): ns3::ObjectFactory [class]
    module.add_class('ObjectFactory', import_from_module='ns.core')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class]
    module.add_class('PacketMetadata', import_from_module='ns.network')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
    module.add_class('Item',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::PacketMetadata'])
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration]
    module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'],
                    outer_class=root_module['ns3::PacketMetadata::Item'],
                    import_from_module='ns.network')
    ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
    module.add_class('ItemIterator',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::PacketMetadata'])
    ## packet.h (module 'network'): ns3::PacketTagIterator [class]
    module.add_class('PacketTagIterator', import_from_module='ns.network')
    ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
    module.add_class('Item',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::PacketTagIterator'])
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
    module.add_class('PacketTagList', import_from_module='ns.network')
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
    module.add_class('TagData',
                     import_from_module='ns.network',
                     outer_class=root_module['ns3::PacketTagList'])
    ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration]
    module.add_enum('TagData_e', ['MAX_SIZE'],
                    outer_class=root_module['ns3::PacketTagList::TagData'],
                    import_from_module='ns.network')
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'
                     ],
                     parent=root_module['ns3::ObjectBase'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simulator.h (module 'core'): ns3::Simulator [class]
    module.add_class('Simulator',
                     destructor_visibility='private',
                     import_from_module='ns.core')
    ## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
    module.add_class('SystemWallClockMs', import_from_module='ns.core')
    ## tag.h (module 'network'): ns3::Tag [class]
    module.add_class('Tag',
                     import_from_module='ns.network',
                     parent=root_module['ns3::ObjectBase'])
    ## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
    module.add_class('TagBuffer', import_from_module='ns.network')
    ## nstime.h (module 'core'): ns3::TimeWithUnit [class]
    module.add_class('TimeWithUnit', import_from_module='ns.core')
    ## timer.h (module 'core'): ns3::Timer [class]
    module.add_class('Timer', import_from_module='ns.core')
    ## timer.h (module 'core'): ns3::Timer::DestroyPolicy [enumeration]
    module.add_enum(
        'DestroyPolicy',
        ['CANCEL_ON_DESTROY', 'REMOVE_ON_DESTROY', 'CHECK_ON_DESTROY'],
        outer_class=root_module['ns3::Timer'],
        import_from_module='ns.core')
    ## timer.h (module 'core'): ns3::Timer::State [enumeration]
    module.add_enum('State', ['RUNNING', 'EXPIRED', 'SUSPENDED'],
                    outer_class=root_module['ns3::Timer'],
                    import_from_module='ns.core')
    ## timer-impl.h (module 'core'): ns3::TimerImpl [class]
    module.add_class('TimerImpl',
                     allow_subclassing=True,
                     import_from_module='ns.core')
    ## traced-value.h (module 'core'): ns3::TracedValue<unsigned int> [class]
    module.add_class('TracedValue',
                     import_from_module='ns.core',
                     template_parameters=['unsigned int'])
    ## type-id.h (module 'core'): ns3::TypeId [class]
    module.add_class('TypeId', import_from_module='ns.core')
    ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration]
    module.add_enum('AttributeFlag',
                    ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'],
                    outer_class=root_module['ns3::TypeId'],
                    import_from_module='ns.core')
    ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct]
    module.add_class('AttributeInformation',
                     import_from_module='ns.core',
                     outer_class=root_module['ns3::TypeId'])
    ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct]
    module.add_class('TraceSourceInformation',
                     import_from_module='ns.core',
                     outer_class=root_module['ns3::TypeId'])
    ## wifi-mode.h (module 'wifi'): ns3::WifiMode [class]
    module.add_class('WifiMode', import_from_module='ns.wifi')
    ## wifi-mode.h (module 'wifi'): ns3::WifiModeFactory [class]
    module.add_class('WifiModeFactory', import_from_module='ns.wifi')
    ## wifi-phy.h (module 'wifi'): ns3::WifiPhyListener [class]
    module.add_class('WifiPhyListener',
                     allow_subclassing=True,
                     import_from_module='ns.wifi')
    ## wifi-remote-station-manager.h (module 'wifi'): ns3::WifiRemoteStation [struct]
    module.add_class('WifiRemoteStation', import_from_module='ns.wifi')
    ## wifi-remote-station-manager.h (module 'wifi'): ns3::WifiRemoteStationInfo [class]
    module.add_class('WifiRemoteStationInfo', import_from_module='ns.wifi')
    ## wifi-remote-station-manager.h (module 'wifi'): ns3::WifiRemoteStationState [struct]
    module.add_class('WifiRemoteStationState', import_from_module='ns.wifi')
    ## wifi-remote-station-manager.h (module 'wifi'): ns3::WifiRemoteStationState [enumeration]
    module.add_enum(
        '', ['BRAND_NEW', 'DISASSOC', 'WAIT_ASSOC_TX_OK', 'GOT_ASSOC_TX_OK'],
        outer_class=root_module['ns3::WifiRemoteStationState'],
        import_from_module='ns.wifi')
    ## wifi-tx-vector.h (module 'wifi'): ns3::WifiTxVector [class]
    module.add_class('WifiTxVector', import_from_module='ns.wifi')
    ## empty.h (module 'core'): ns3::empty [class]
    module.add_class('empty', import_from_module='ns.core')
    ## int64x64-double.h (module 'core'): ns3::int64x64_t [class]
    module.add_class('int64x64_t', import_from_module='ns.core')
    ## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration]
    module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'],
                    outer_class=root_module['ns3::int64x64_t'],
                    import_from_module='ns.core')
    ## wifi-phy.h (module 'wifi'): ns3::mpduInfo [struct]
    module.add_class('mpduInfo', import_from_module='ns.wifi')
    ## wifi-phy.h (module 'wifi'): ns3::signalNoiseDbm [struct]
    module.add_class('signalNoiseDbm', import_from_module='ns.wifi')
    ## chunk.h (module 'network'): ns3::Chunk [class]
    module.add_class('Chunk',
                     import_from_module='ns.network',
                     parent=root_module['ns3::ObjectBase'])
    ## header.h (module 'network'): ns3::Header [class]
    module.add_class('Header',
                     import_from_module='ns.network',
                     parent=root_module['ns3::Chunk'])
    ## icmpv4.h (module 'internet'): ns3::Icmpv4DestinationUnreachable [class]
    module.add_class('Icmpv4DestinationUnreachable',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## icmpv4.h (module 'internet'): ns3::Icmpv4DestinationUnreachable [enumeration]
    module.add_enum(
        '', [
            'NET_UNREACHABLE', 'HOST_UNREACHABLE', 'PROTOCOL_UNREACHABLE',
            'PORT_UNREACHABLE', 'FRAG_NEEDED', 'SOURCE_ROUTE_FAILED'
        ],
        outer_class=root_module['ns3::Icmpv4DestinationUnreachable'],
        import_from_module='ns.internet')
    ## icmpv4.h (module 'internet'): ns3::Icmpv4Echo [class]
    module.add_class('Icmpv4Echo',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## icmpv4.h (module 'internet'): ns3::Icmpv4Header [class]
    module.add_class('Icmpv4Header',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## icmpv4.h (module 'internet'): ns3::Icmpv4Header [enumeration]
    module.add_enum('',
                    ['ECHO_REPLY', 'DEST_UNREACH', 'ECHO', 'TIME_EXCEEDED'],
                    outer_class=root_module['ns3::Icmpv4Header'],
                    import_from_module='ns.internet')
    ## icmpv4.h (module 'internet'): ns3::Icmpv4TimeExceeded [class]
    module.add_class('Icmpv4TimeExceeded',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## icmpv4.h (module 'internet'): ns3::Icmpv4TimeExceeded [enumeration]
    module.add_enum('', ['TIME_TO_LIVE', 'FRAGMENT_REASSEMBLY'],
                    outer_class=root_module['ns3::Icmpv4TimeExceeded'],
                    import_from_module='ns.internet')
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header [class]
    module.add_class('Ipv4Header',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header::DscpType [enumeration]
    module.add_enum('DscpType', [
        'DscpDefault', 'DSCP_CS1', 'DSCP_AF11', 'DSCP_AF12', 'DSCP_AF13',
        'DSCP_CS2', 'DSCP_AF21', 'DSCP_AF22', 'DSCP_AF23', 'DSCP_CS3',
        'DSCP_AF31', 'DSCP_AF32', 'DSCP_AF33', 'DSCP_CS4', 'DSCP_AF41',
        'DSCP_AF42', 'DSCP_AF43', 'DSCP_CS5', 'DSCP_EF', 'DSCP_CS6', 'DSCP_CS7'
    ],
                    outer_class=root_module['ns3::Ipv4Header'],
                    import_from_module='ns.internet')
    ## ipv4-header.h (module 'internet'): ns3::Ipv4Header::EcnType [enumeration]
    module.add_enum('EcnType',
                    ['ECN_NotECT', 'ECN_ECT1', 'ECN_ECT0', 'ECN_CE'],
                    outer_class=root_module['ns3::Ipv4Header'],
                    import_from_module='ns.internet')
    ## ipv6-header.h (module 'internet'): ns3::Ipv6Header [class]
    module.add_class('Ipv6Header',
                     import_from_module='ns.internet',
                     parent=root_module['ns3::Header'])
    ## ipv6-header.h (module 'internet'): ns3::Ipv6Header::DscpType [enumeration]
    module.add_enum('DscpType', [
        'DscpDefault', 'DSCP_CS1', 'DSCP_AF11', 'DSCP_AF12', 'DSCP_AF13',
        'DSCP_CS2', 'DSCP_AF21', 'DSCP_AF22', 'DSCP_AF23', 'DSCP_CS3',
        'DSCP_AF31', 'DSCP_AF32', 'DSCP_AF33', 'DSCP_CS4', 'DSCP_AF41',
        'DSCP_AF42', 'DSCP_AF43', 'DSCP_CS5', 'DSCP_EF', 'DSCP_CS6', 'DSCP_CS7'
    ],
                    outer_class=root_module['ns3::Ipv6Header'],
                    import_from_module='ns.internet')
    ## ipv6-header.h (module 'internet'): ns3::Ipv6Header::NextHeader_e [enumeration]
    module.add_enum('NextHeader_e', [
        'IPV6_EXT_HOP_BY_HOP', 'IPV6_IPV4', 'IPV6_TCP', 'IPV6_UDP',
        'IPV6_IPV6', 'IPV6_EXT_ROUTING', 'IPV6_EXT_FRAGMENTATION',
        'IPV6_EXT_CONFIDENTIALITY', 'IPV6_EXT_AUTHENTIFICATION', 'IPV6_ICMPV6',
        'IPV6_EXT_END', 'IPV6_EXT_DESTINATION', 'IPV6_SCTP',
        'IPV6_EXT_MOBILITY', 'IPV6_UDP_LITE'
    ],
                    outer_class=root_module['ns3::Ipv6Header'],
                    import_from_module='ns.internet')
    ## object.h (module 'core'): ns3::Object [class]
    module.add_class(
        'Object',
        import_from_module='ns.core',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']
    )
    ## object.h (module 'core'): ns3::Object::AggregateIterator [class]
    module.add_class('AggregateIterator',
                     import_from_module='ns.core',
                     outer_class=root_module['ns3::Object'])
    ## packet-filter.h (module 'traffic-control'): ns3::PacketFilter [class]
    module.add_class('PacketFilter',
                     import_from_module='ns.traffic_control',
                     parent=root_module['ns3::Object'])
    ## queue.h (module 'network'): ns3::Queue [class]
    module.add_class('Queue',
                     import_from_module='ns.network',
                     parent=root_module['ns3::Object'])
    ## queue.h (module 'network'): ns3::Queue::QueueMode [enumeration]
    module.add_enum('QueueMode', ['QUEUE_MODE_PACKETS', 'QUEUE_MODE_BYTES'],
                    outer_class=root_module['ns3::Queue'],
                    import_from_module='ns.network')
    ## queue-disc.h (module 'traffic-control'): ns3::QueueDisc [class]
    module.add_class('QueueDisc',
                     import_from_module='ns.traffic_control',
                     parent=root_module['ns3::Object'])
    ## queue-disc.h (module 'traffic-control'): ns3::QueueDisc::WakeMode [enumeration]
    module.add_enum('WakeMode', ['WAKE_ROOT', 'WAKE_CHILD'],
                    outer_class=root_module['ns3::QueueDisc'],
                    import_from_module='ns.traffic-control')
    ## queue-disc.h (module 'traffic-control'): ns3::QueueDiscClass [class]
    module.add_class('QueueDiscClass',
                     import_from_module='ns.traffic_control',
                     parent=root_module['ns3::Object'])
    ## random-variable-stream.h (module 'core'): ns3::RandomVariableStream [class]
    module.add_class('RandomVariableStream',
                     import_from_module='ns.core',
                     parent=root_module['ns3::Object'])
    ## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable [class]
    module.add_class('SequentialRandomVariable',
                     import_from_module='ns.core',
                     parent=root_module['ns3::RandomVariableStream'])
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::AttributeAccessor', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::AttributeAccessor>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::AttributeChecker', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::AttributeChecker>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::AttributeValue', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::AttributeValue>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::CallbackImplBase', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::CallbackImplBase>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::EventImpl', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::EventImpl>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     import_from_module='ns.core',
                     template_parameters=[
                         'ns3::Hash::Implementation', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::Hash::Implementation>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
예제 #12
0
def register_types(module):
    root_module = module.get_root()

    ## wifi-information-element-vector.h: ns3::WifiElementId [enumeration]
    module.add_enum('WifiElementId', [
        'IE11S_MESH_CONFIGURATION', 'IE11S_MESH_ID',
        'IE11S_LINK_METRIC_REPORT', 'IE11S_CONGESTION_NOTIFICATION',
        'IE11S_PEERING_MANAGEMENT', 'IE11S_SUPP_MBSS_REG_CLASSES_CHANNELS',
        'IE11S_MESH_CHANNEL_SWITCH_ANNOUNCEMENT', 'IE11S_MESH_TIM',
        'IE11S_AWAKE_WINDOW', 'IE11S_BEACON_TIMING',
        'IE11S_MCCAOP_SETUP_REQUEST', 'IE11S_MCCAOP_SETUP_REPLY',
        'IE11S_MCCAOP_ADVERTISEMENT', 'IE11S_MCCAOP_RESERVATION_TEARDOWN',
        'IE11S_PORTAL_ANNOUNCEMENT', 'IE11S_RANN', 'IE11S_PREQ', 'IE11S_PREP',
        'IE11S_PERR', 'IE11S_PROXY_UPDATE', 'IE11S_PROXY_UPDATE_CONFIRMATION',
        'IE11S_ABBREVIATED_HANDSHAKE', 'IE11S_MESH_PEERING_PROTOCOL_VERSION'
    ])
    ## mesh-wifi-beacon.h: ns3::MeshWifiBeacon [class]
    module.add_class('MeshWifiBeacon')
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::MeshWifiInterfaceMacPlugin', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## simple-ref-count.h: ns3::SimpleRefCount<ns3::WifiInformationElement, ns3::empty, ns3::DefaultDeleter<ns3::WifiInformationElement> > [class]
    module.add_class('SimpleRefCount',
                     automatic_type_narrowing=True,
                     template_parameters=[
                         'ns3::WifiInformationElement', 'ns3::empty',
                         'ns3::DefaultDeleter<ns3::WifiInformationElement>'
                     ],
                     parent=root_module['ns3::empty'],
                     memory_policy=cppclass.ReferenceCountingMethodsPolicy(
                         incref_method='Ref',
                         decref_method='Unref',
                         peekref_method='GetReferenceCount'))
    ## wifi-information-element-vector.h: ns3::WifiInformationElement [class]
    module.add_class(
        'WifiInformationElement',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::WifiInformationElement, ns3::empty, ns3::DefaultDeleter<ns3::WifiInformationElement> >']
    )
    ## wifi-information-element-vector.h: ns3::WifiInformationElementVector [class]
    module.add_class('WifiInformationElementVector',
                     parent=root_module['ns3::Header'])
    ## mesh-l2-routing-protocol.h: ns3::MeshL2RoutingProtocol [class]
    module.add_class('MeshL2RoutingProtocol',
                     parent=root_module['ns3::Object'])
    ## mesh-wifi-interface-mac.h: ns3::MeshWifiInterfaceMac [class]
    module.add_class('MeshWifiInterfaceMac',
                     parent=root_module['ns3::WifiMac'])
    ## mesh-wifi-interface-mac-plugin.h: ns3::MeshWifiInterfaceMacPlugin [class]
    module.add_class(
        'MeshWifiInterfaceMacPlugin',
        parent=root_module[
            'ns3::SimpleRefCount< ns3::MeshWifiInterfaceMacPlugin, ns3::empty, ns3::DefaultDeleter<ns3::MeshWifiInterfaceMacPlugin> >']
    )
    ## mesh-point-device.h: ns3::MeshPointDevice [class]
    module.add_class('MeshPointDevice', parent=root_module['ns3::NetDevice'])

    ## 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 TimeStepPrecision

    nested_module = module.add_cpp_namespace('TimeStepPrecision')
    register_types_ns3_TimeStepPrecision(nested_module)

    ## Register a nested module for the namespace addressUtils

    nested_module = module.add_cpp_namespace('addressUtils')
    register_types_ns3_addressUtils(nested_module)

    ## Register a nested module for the namespace aodv

    nested_module = module.add_cpp_namespace('aodv')
    register_types_ns3_aodv(nested_module)

    ## Register a nested module for the namespace dot11s

    nested_module = module.add_cpp_namespace('dot11s')
    register_types_ns3_dot11s(nested_module)

    ## Register a nested module for the namespace flame

    nested_module = module.add_cpp_namespace('flame')
    register_types_ns3_flame(nested_module)

    ## 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 olsr

    nested_module = module.add_cpp_namespace('olsr')
    register_types_ns3_olsr(nested_module)