bindings/python/ns3_module_core.py
changeset 3474 dac9146297c8
parent 3468 0bb5275704fc
child 3484 ebdeeb7cd463
equal deleted inserted replaced
3473:6bce86ea4778 3474:dac9146297c8
     1 from pybindgen import Module, FileCodeSink, param, retval, cppclass
     1 from pybindgen import Module, FileCodeSink, param, retval, cppclass
     2 
     2 
     3 def register_types(module):
     3 def register_types(module):
     4     root_module = module.get_root()
     4     root_module = module.get_root()
     5     
     5     
       
     6     ## log.h: ns3::LogLevel [enumeration]
       
     7     module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME'])
     6     ## random-variable.h: ns3::RandomVariable [class]
     8     ## random-variable.h: ns3::RandomVariable [class]
     7     module.add_class('RandomVariable')
     9     module.add_class('RandomVariable')
     8     ## random-variable.h: ns3::TriangularVariable [class]
    10     ## random-variable.h: ns3::TriangularVariable [class]
     9     module.add_class('TriangularVariable', parent=root_module['ns3::RandomVariable'])
    11     module.add_class('TriangularVariable', parent=root_module['ns3::RandomVariable'])
    10     ## global-value.h: ns3::GlobalValue [class]
    12     ## global-value.h: ns3::GlobalValue [class]
   115     module.add_class('TracedCallback', template_parameters=['ns3::Ptr<ns3::Packet const>', 'double', 'ns3::WifiMode', 'ns3::WifiPreamble'])
   117     module.add_class('TracedCallback', template_parameters=['ns3::Ptr<ns3::Packet const>', 'double', 'ns3::WifiMode', 'ns3::WifiPreamble'])
   116     ## traced-callback.h: ns3::TracedCallback<unsigned int, unsigned int, ns3::empty, ns3::empty> [class]
   118     ## traced-callback.h: ns3::TracedCallback<unsigned int, unsigned int, ns3::empty, ns3::empty> [class]
   117     module.add_class('TracedCallback', template_parameters=['unsigned int', 'unsigned int', 'ns3::empty', 'ns3::empty'])
   119     module.add_class('TracedCallback', template_parameters=['unsigned int', 'unsigned int', 'ns3::empty', 'ns3::empty'])
   118     ## random-variable.h: ns3::DeterministicVariable [class]
   120     ## random-variable.h: ns3::DeterministicVariable [class]
   119     module.add_class('DeterministicVariable', parent=root_module['ns3::RandomVariable'])
   121     module.add_class('DeterministicVariable', parent=root_module['ns3::RandomVariable'])
       
   122     ## log.h: ns3::LogComponent [class]
       
   123     module.add_class('LogComponent')
   120     ## attribute-list.h: ns3::AttributeList [class]
   124     ## attribute-list.h: ns3::AttributeList [class]
   121     module.add_class('AttributeList')
   125     module.add_class('AttributeList')
   122     ## attribute.h: ns3::AttributeValue [class]
   126     ## attribute.h: ns3::AttributeValue [class]
   123     module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::RefCountBase'])
   127     module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, parent=root_module['ns3::RefCountBase'])
   124     ## random-variable.h: ns3::UniformVariable [class]
   128     ## random-variable.h: ns3::UniformVariable [class]
   266     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Ns3WifiMode_Ns3WifiPreamble_Unsigned_char_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, ns3::WifiMode, ns3::WifiPreamble, unsigned char >'])
   270     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Ns3WifiMode_Ns3WifiPreamble_Unsigned_char_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, ns3::WifiMode, ns3::WifiPreamble, unsigned char >'])
   267     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Double_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, double, ns3::empty, ns3::empty >'])
   271     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Double_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, double, ns3::empty, ns3::empty >'])
   268     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Double_Ns3WifiMode_Ns3WifiPreamble_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, double, ns3::WifiMode, ns3::WifiPreamble >'])
   272     register_Ns3TracedCallback__Ns3Ptr__lt__ns3Packet_const__gt___Double_Ns3WifiMode_Ns3WifiPreamble_methods(root_module, root_module['ns3::TracedCallback< ns3::Ptr<ns3::Packet const>, double, ns3::WifiMode, ns3::WifiPreamble >'])
   269     register_Ns3TracedCallback__Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::TracedCallback< unsigned int, unsigned int, ns3::empty, ns3::empty >'])
   273     register_Ns3TracedCallback__Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::TracedCallback< unsigned int, unsigned int, ns3::empty, ns3::empty >'])
   270     register_Ns3DeterministicVariable_methods(root_module, root_module['ns3::DeterministicVariable'])
   274     register_Ns3DeterministicVariable_methods(root_module, root_module['ns3::DeterministicVariable'])
       
   275     register_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
   271     register_Ns3AttributeList_methods(root_module, root_module['ns3::AttributeList'])
   276     register_Ns3AttributeList_methods(root_module, root_module['ns3::AttributeList'])
   272     register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
   277     register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue'])
   273     register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable'])
   278     register_Ns3UniformVariable_methods(root_module, root_module['ns3::UniformVariable'])
   274     register_Ns3Object_methods(root_module, root_module['ns3::Object'])
   279     register_Ns3Object_methods(root_module, root_module['ns3::Object'])
   275     register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
   280     register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
   885 def register_Ns3Empty_methods(root_module, cls):
   890 def register_Ns3Empty_methods(root_module, cls):
   886     cls.add_constructor([])
   891     cls.add_constructor([])
   887     return
   892     return
   888 
   893 
   889 def register_Ns3ObjectBase_methods(root_module, cls):
   894 def register_Ns3ObjectBase_methods(root_module, cls):
   890     ## object-base.h: ns3::ObjectBase::ObjectBase() [constructor]
       
   891     cls.add_constructor([])
       
   892     ## object-base.h: ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
   895     ## object-base.h: ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor]
   893     cls.add_constructor([param('ns3::ObjectBase&', 'arg0', is_const=True)])
   896     cls.add_constructor([param('ns3::ObjectBase&', 'arg0', is_const=True)])
       
   897     ## object-base.h: ns3::ObjectBase::ObjectBase() [constructor]
       
   898     cls.add_constructor([])
   894     ## object-base.h: static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
   899     ## object-base.h: static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function]
   895     cls.add_method('GetTypeId', 
   900     cls.add_method('GetTypeId', 
   896                    'ns3::TypeId', 
   901                    'ns3::TypeId', 
   897                    [], 
   902                    [], 
   898                    is_static=True)
   903                    is_static=True)
  1323     return
  1328     return
  1324 
  1329 
  1325 def register_Ns3DeterministicVariable_methods(root_module, cls):
  1330 def register_Ns3DeterministicVariable_methods(root_module, cls):
  1326     ## random-variable.h: ns3::DeterministicVariable::DeterministicVariable(double * d, uint32_t c) [constructor]
  1331     ## random-variable.h: ns3::DeterministicVariable::DeterministicVariable(double * d, uint32_t c) [constructor]
  1327     cls.add_constructor([param('double *', 'd'), param('uint32_t', 'c')])
  1332     cls.add_constructor([param('double *', 'd'), param('uint32_t', 'c')])
       
  1333     return
       
  1334 
       
  1335 def register_Ns3LogComponent_methods(root_module, cls):
       
  1336     ## log.h: ns3::LogComponent::LogComponent(char const * name) [constructor]
       
  1337     cls.add_constructor([param('char *', 'name', transfer_ownership=False, is_const=True)])
       
  1338     ## log.h: void ns3::LogComponent::EnvVarCheck(char const * name) [member function]
       
  1339     cls.add_method('EnvVarCheck', 
       
  1340                    'void', 
       
  1341                    [param('char *', 'name', transfer_ownership=False, is_const=True)])
       
  1342     ## log.h: bool ns3::LogComponent::IsEnabled(ns3::LogLevel level) const [member function]
       
  1343     cls.add_method('IsEnabled', 
       
  1344                    'bool', 
       
  1345                    [param('ns3::LogLevel', 'level')], 
       
  1346                    is_const=True)
       
  1347     ## log.h: bool ns3::LogComponent::IsNoneEnabled() const [member function]
       
  1348     cls.add_method('IsNoneEnabled', 
       
  1349                    'bool', 
       
  1350                    [], 
       
  1351                    is_const=True)
       
  1352     ## log.h: void ns3::LogComponent::Enable(ns3::LogLevel level) [member function]
       
  1353     cls.add_method('Enable', 
       
  1354                    'void', 
       
  1355                    [param('ns3::LogLevel', 'level')])
       
  1356     ## log.h: void ns3::LogComponent::Disable(ns3::LogLevel level) [member function]
       
  1357     cls.add_method('Disable', 
       
  1358                    'void', 
       
  1359                    [param('ns3::LogLevel', 'level')])
       
  1360     ## log.h: char const * ns3::LogComponent::Name() const [member function]
       
  1361     cls.add_method('Name', 
       
  1362                    retval('char *', is_const=True, caller_owns_return=False), 
       
  1363                    [], 
       
  1364                    is_const=True)
  1328     return
  1365     return
  1329 
  1366 
  1330 def register_Ns3AttributeList_methods(root_module, cls):
  1367 def register_Ns3AttributeList_methods(root_module, cls):
  1331     ## attribute-list.h: ns3::AttributeList::AttributeList() [constructor]
  1368     ## attribute-list.h: ns3::AttributeList::AttributeList() [constructor]
  1332     cls.add_constructor([])
  1369     cls.add_constructor([])
  2029                         [])
  2066                         [])
  2030     ## enum.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeEnumChecker(int v1, std::string n1, int v2=0, std::string n2="", int v3=0, std::string n3="", int v4=0, std::string n4="", int v5=0, std::string n5="", int v6=0, std::string n6="", int v7=0, std::string n7="", int v8=0, std::string n8="", int v9=0, std::string n9="", int v10=0, std::string n10="", int v11=0, std::string n11="", int v12=0, std::string n12="") [free function]
  2067     ## enum.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeEnumChecker(int v1, std::string n1, int v2=0, std::string n2="", int v3=0, std::string n3="", int v4=0, std::string n4="", int v5=0, std::string n5="", int v6=0, std::string n6="", int v7=0, std::string n7="", int v8=0, std::string n8="", int v9=0, std::string n9="", int v10=0, std::string n10="", int v11=0, std::string n11="", int v12=0, std::string n12="") [free function]
  2031     module.add_function('MakeEnumChecker', 
  2068     module.add_function('MakeEnumChecker', 
  2032                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2069                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2033                         [param('int', 'v1'), param('std::string', 'n1'), param('int', 'v2', default_value='0'), param('std::string', 'n2', default_value='""'), param('int', 'v3', default_value='0'), param('std::string', 'n3', default_value='""'), param('int', 'v4', default_value='0'), param('std::string', 'n4', default_value='""'), param('int', 'v5', default_value='0'), param('std::string', 'n5', default_value='""'), param('int', 'v6', default_value='0'), param('std::string', 'n6', default_value='""'), param('int', 'v7', default_value='0'), param('std::string', 'n7', default_value='""'), param('int', 'v8', default_value='0'), param('std::string', 'n8', default_value='""'), param('int', 'v9', default_value='0'), param('std::string', 'n9', default_value='""'), param('int', 'v10', default_value='0'), param('std::string', 'n10', default_value='""'), param('int', 'v11', default_value='0'), param('std::string', 'n11', default_value='""'), param('int', 'v12', default_value='0'), param('std::string', 'n12', default_value='""')])
  2070                         [param('int', 'v1'), param('std::string', 'n1'), param('int', 'v2', default_value='0'), param('std::string', 'n2', default_value='""'), param('int', 'v3', default_value='0'), param('std::string', 'n3', default_value='""'), param('int', 'v4', default_value='0'), param('std::string', 'n4', default_value='""'), param('int', 'v5', default_value='0'), param('std::string', 'n5', default_value='""'), param('int', 'v6', default_value='0'), param('std::string', 'n6', default_value='""'), param('int', 'v7', default_value='0'), param('std::string', 'n7', default_value='""'), param('int', 'v8', default_value='0'), param('std::string', 'n8', default_value='""'), param('int', 'v9', default_value='0'), param('std::string', 'n9', default_value='""'), param('int', 'v10', default_value='0'), param('std::string', 'n10', default_value='""'), param('int', 'v11', default_value='0'), param('std::string', 'n11', default_value='""'), param('int', 'v12', default_value='0'), param('std::string', 'n12', default_value='""')])
       
  2071     ## log.h: extern void ns3::LogComponentEnableAll(ns3::LogLevel level) [free function]
       
  2072     module.add_function('LogComponentEnableAll', 
       
  2073                         'void', 
       
  2074                         [param('ns3::LogLevel', 'level')])
  2034     ## type-id.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTypeIdChecker() [free function]
  2075     ## type-id.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeTypeIdChecker() [free function]
  2035     module.add_function('MakeTypeIdChecker', 
  2076     module.add_function('MakeTypeIdChecker', 
  2036                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2077                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2037                         [])
  2078                         [])
  2038     ## ptr.h: extern ns3::Ptr<ns3::PointerValue> ns3::Create() [free function]
  2079     ## ptr.h: extern ns3::Ptr<ns3::PointerValue> ns3::Create() [free function]
  2047                         template_parameters=['ns3::ObjectVectorValue'])
  2088                         template_parameters=['ns3::ObjectVectorValue'])
  2048     ## object-factory.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeObjectFactoryChecker() [free function]
  2089     ## object-factory.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeObjectFactoryChecker() [free function]
  2049     module.add_function('MakeObjectFactoryChecker', 
  2090     module.add_function('MakeObjectFactoryChecker', 
  2050                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2091                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2051                         [])
  2092                         [])
       
  2093     ## log.h: extern ns3::LogTimePrinter ns3::LogGetTimePrinter() [free function]
       
  2094     module.add_function('LogGetTimePrinter', 
       
  2095                         'ns3::LogTimePrinter *', 
       
  2096                         [])
       
  2097     ## log.h: extern void ns3::LogComponentDisableAll(ns3::LogLevel level) [free function]
       
  2098     module.add_function('LogComponentDisableAll', 
       
  2099                         'void', 
       
  2100                         [param('ns3::LogLevel', 'level')])
  2052     ## breakpoint.h: extern void ns3::BreakpointFallback() [free function]
  2101     ## breakpoint.h: extern void ns3::BreakpointFallback() [free function]
  2053     module.add_function('BreakpointFallback', 
  2102     module.add_function('BreakpointFallback', 
  2054                         'void', 
  2103                         'void', 
  2055                         [])
  2104                         [])
  2056     ## random-variable.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeRandomVariableChecker() [free function]
  2105     ## random-variable.h: extern ns3::Ptr<ns3::AttributeChecker const> ns3::MakeRandomVariableChecker() [free function]
  2057     module.add_function('MakeRandomVariableChecker', 
  2106     module.add_function('MakeRandomVariableChecker', 
  2058                         'ns3::Ptr< ns3::AttributeChecker const >', 
  2107                         'ns3::Ptr< ns3::AttributeChecker const >', 
       
  2108                         [])
       
  2109     ## log.h: extern void ns3::LogSetTimePrinter(ns3::LogTimePrinter arg0) [free function]
       
  2110     module.add_function('LogSetTimePrinter', 
       
  2111                         'void', 
       
  2112                         [param('ns3::LogTimePrinter *', 'arg0')])
       
  2113     ## log.h: extern void ns3::LogComponentDisable(char const * name, ns3::LogLevel level) [free function]
       
  2114     module.add_function('LogComponentDisable', 
       
  2115                         'void', 
       
  2116                         [param('char *', 'name', transfer_ownership=False, is_const=True), param('ns3::LogLevel', 'level')])
       
  2117     ## log.h: extern void ns3::LogComponentEnable(char const * name, ns3::LogLevel level) [free function]
       
  2118     module.add_function('LogComponentEnable', 
       
  2119                         'void', 
       
  2120                         [param('char *', 'name', transfer_ownership=False, is_const=True), param('ns3::LogLevel', 'level')])
       
  2121     ## log.h: extern void ns3::LogComponentPrintList() [free function]
       
  2122     module.add_function('LogComponentPrintList', 
       
  2123                         'void', 
  2059                         [])
  2124                         [])
  2060     register_functions_ns3_internal(module.get_submodule('internal'), root_module)
  2125     register_functions_ns3_internal(module.get_submodule('internal'), root_module)
  2061     register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
  2126     register_functions_ns3_TimeStepPrecision(module.get_submodule('TimeStepPrecision'), root_module)
  2062     register_functions_ns3_Config(module.get_submodule('Config'), root_module)
  2127     register_functions_ns3_Config(module.get_submodule('Config'), root_module)
  2063     register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)
  2128     register_functions_ns3_olsr(module.get_submodule('olsr'), root_module)