Bug 786 - Make Ipv4Address hashable from Python
This commit is contained in:
@@ -95,6 +95,7 @@ def main():
|
|||||||
ns3modulegen_core_customizations.CommandLine_customizations(root_module)
|
ns3modulegen_core_customizations.CommandLine_customizations(root_module)
|
||||||
ns3modulegen_core_customizations.TypeId_customizations(root_module)
|
ns3modulegen_core_customizations.TypeId_customizations(root_module)
|
||||||
ns3modulegen_core_customizations.add_std_ofstream(root_module)
|
ns3modulegen_core_customizations.add_std_ofstream(root_module)
|
||||||
|
ns3modulegen_core_customizations.add_ipv4_address_tp_hash(root_module)
|
||||||
|
|
||||||
|
|
||||||
for local_module in LOCAL_MODULES:
|
for local_module in LOCAL_MODULES:
|
||||||
|
|||||||
@@ -572,3 +572,14 @@ def add_std_ofstream(module):
|
|||||||
Parameter.new("::std::ofstream::openmode", 'mode', default_value="std::ios_base::out")])
|
Parameter.new("::std::ofstream::openmode", 'mode', default_value="std::ios_base::out")])
|
||||||
ofstream.add_method('close', None, [])
|
ofstream.add_method('close', None, [])
|
||||||
|
|
||||||
|
def add_ipv4_address_tp_hash(module):
|
||||||
|
module.body.writeln('''
|
||||||
|
long
|
||||||
|
_ns3_Ipv4Address_tp_hash (PyObject *obj)
|
||||||
|
{
|
||||||
|
PyNs3Ipv4Address *addr = reinterpret_cast<PyNs3Ipv4Address *> (obj);
|
||||||
|
return static_cast<long> (ns3::Ipv4AddressHash () (*addr->obj));
|
||||||
|
}
|
||||||
|
''')
|
||||||
|
module.header.writeln('long _ns3_Ipv4Address_tp_hash (PyObject *obj);')
|
||||||
|
module['Ipv4Address'].pytype.slots['tp_hash'] = "_ns3_Ipv4Address_tp_hash"
|
||||||
|
|||||||
Reference in New Issue
Block a user