How to use the pybindgen.cppclass function in PyBindGen

To help you get started, we’ve selected a few PyBindGen examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github named-data-ndnSIM / ndnSIM / bindings / modulegen__gcc_ILP32.py View on Github external
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')
github samueljero / snake / ns-3-dev / bindings / python / apidefs / gcc-LP64 / ns3_module_flow_monitor.py View on Github external
def register_types(module):
    root_module = module.get_root()
    
    ## histogram.h: ns3::Histogram [class]
    module.add_class('Histogram')
    ## simple-ref-count.h: ns3::SimpleRefCount > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::FlowClassifier', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simple-ref-count.h: ns3::SimpleRefCount > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::FlowProbe', 'ns3::empty', 'ns3::DefaultDeleter'], 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 >'])
    ## 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 >'])
    ## 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'])
github samueljero / snake / ns-3-dev / bindings / python / apidefs / gcc-LP64 / ns3_module_simulator.py View on Github external
## traced-value.h: ns3::TracedValue [class]
    root_module['ns3::TracedValue< ns3::Time >'].implicitly_converts_to(root_module['ns3::Time'])
    ## watchdog.h: ns3::Watchdog [class]
    module.add_class('Watchdog')
    ## nstime.h: ns3::Scalar [class]
    module.add_class('Scalar')
    ## nstime.h: ns3::Scalar [class]
    root_module['ns3::Scalar'].implicitly_converts_to(root_module['ns3::Time'])
    ## scheduler.h: ns3::Scheduler [class]
    module.add_class('Scheduler', parent=root_module['ns3::Object'])
    ## scheduler.h: ns3::Scheduler::Event [struct]
    module.add_class('Event', outer_class=root_module['ns3::Scheduler'])
    ## scheduler.h: ns3::Scheduler::EventKey [struct]
    module.add_class('EventKey', outer_class=root_module['ns3::Scheduler'])
    ## simple-ref-count.h: ns3::SimpleRefCount > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simple-ref-count.h: ns3::SimpleRefCount > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::FdReader', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## simulator-impl.h: ns3::SimulatorImpl [class]
    module.add_class('SimulatorImpl', parent=root_module['ns3::Object'])
    ## synchronizer.h: ns3::Synchronizer [class]
    module.add_class('Synchronizer', parent=root_module['ns3::Object'])
    ## wall-clock-synchronizer.h: ns3::WallClockSynchronizer [class]
    module.add_class('WallClockSynchronizer', parent=root_module['ns3::Synchronizer'])
    ## calendar-scheduler.h: ns3::CalendarScheduler [class]
    module.add_class('CalendarScheduler', parent=root_module['ns3::Scheduler'])
    ## default-simulator-impl.h: ns3::DefaultSimulatorImpl [class]
    module.add_class('DefaultSimulatorImpl', parent=root_module['ns3::SimulatorImpl'])
    ## event-impl.h: ns3::EventImpl [class]
    module.add_class('EventImpl', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter >'])
    ## unix-fd-reader.h: ns3::FdReader [class]
    module.add_class('FdReader', parent=root_module['ns3::SimpleRefCount< ns3::FdReader, ns3::empty, ns3::DefaultDeleter >'])
github tkn-tub / ns3-gym / bindings / python / ns3modulegen_core_customizations.py View on Github external
# Fix up for the "const AttributeValue &v = EmptyAttribute()"
    # case, as used extensively by helper classes.

    # Here's why we need to do this: pybindgen.gccxmlscanner, when
    # scanning parameter default values, is only provided with the
    # value as a simple C expression string.  (py)gccxml does not
    # report the type of the default value.

    # As a workaround, here we iterate over all parameters of all
    # methods of all classes and tell pybindgen what is the type of
    # the default value for attributes.

    for cls in module.classes:
        for meth in cls.get_all_methods():
            for param in meth.parameters:
                if isinstance(param, cppclass.CppClassRefParameter):
                    if param.cpp_class.name == 'AttributeValue' \
                            and param.default_value is not None \
                            and param.default_value_type is None:
                        param.default_value_type = 'ns3::EmptyAttributeValue'
github alibaba-edu / High-Precision-Congestion-Control / simulation / src / config-store / bindings / modulegen__gcc_ILP32.py View on Github external
## 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')
    ## config-store.h (module 'config-store'): ns3::ConfigStore [class]
    module.add_class('ConfigStore', parent=root_module['ns3::ObjectBase'])
    ## config-store.h (module 'config-store'): ns3::ConfigStore::Mode [enumeration]
    module.add_enum('Mode', ['LOAD', 'SAVE', 'NONE'], outer_class=root_module['ns3::ConfigStore'])
    ## config-store.h (module 'config-store'): ns3::ConfigStore::FileFormat [enumeration]
    module.add_enum('FileFormat', ['XML', 'RAW_TEXT'], outer_class=root_module['ns3::ConfigStore'])
    ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter'], 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 > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter'], 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 > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter'], 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 > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter'], 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 > [class]
    module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
    ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class]
    module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter >'])
    ## attribute.h (module 'core'): ns3::AttributeAccessor [class]
    module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter >'])
    ## attribute.h (module 'core'): ns3::AttributeChecker [class]
    module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter >'])
    ## attribute.h (module 'core'): ns3::AttributeValue [class]
    module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter >'])
github Gabrielcarvfer / NS3 / bindings / python / ns3modulegen_core_customizations.py View on Github external
# Fix up for the "const AttributeValue &v = EmptyAttribute()"
    # case, as used extensively by helper classes.

    # Here's why we need to do this: pybindgen.gccxmlscanner, when
    # scanning parameter default values, is only provided with the
    # value as a simple C expression string.  (py)gccxml does not
    # report the type of the default value.

    # As a workaround, here we iterate over all parameters of all
    # methods of all classes and tell pybindgen what is the type of
    # the default value for attributes.

    for cls in module.classes:
        for meth in cls.get_all_methods():
            for param in meth.parameters:
                if isinstance(param, cppclass.CppClassRefParameter):
                    if param.cpp_class.name == 'AttributeValue' \
                            and param.default_value is not None \
                            and param.default_value_type is None:
                        param.default_value_type = 'ns3::EmptyAttributeValue'
github named-data-ndnSIM / ndnSIM / bindings / modulegen__gcc_LP64.py View on Github external
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')