bindings/python/ns3modulegen_core_customizations.py
changeset 3574 b6804efbe16b
parent 3573 352cfe96e593
child 3753 a84a48233eb3
equal deleted inserted replaced
3573:352cfe96e593 3574:b6804efbe16b
    58             raise AssertionError
    58             raise AssertionError
    59 
    59 
    60         ## fix the ctype, add ns3:: namespace
    60         ## fix the ctype, add ns3:: namespace
    61         orig_ctype, is_const = self._get_untransformed_type_traits(args[0])
    61         orig_ctype, is_const = self._get_untransformed_type_traits(args[0])
    62         if is_const:
    62         if is_const:
    63             kwargs['is_const'] = True
       
    64             correct_ctype = 'ns3::Ptr< %s const >' % orig_ctype[:-2]
    63             correct_ctype = 'ns3::Ptr< %s const >' % orig_ctype[:-2]
    65         else:
    64         else:
    66             correct_ctype = 'ns3::Ptr< %s >' % orig_ctype[:-2]
    65             correct_ctype = 'ns3::Ptr< %s >' % orig_ctype[:-2]
    67         args = tuple([correct_ctype] + list(args[1:]))
    66         args = tuple([correct_ctype] + list(args[1:]))
    68 
    67 
    69         handler = type_handler(*args, **kwargs)
    68         handler = type_handler(*args, **kwargs)
    70         handler.set_tranformation(self, orig_ctype)
    69         handler.set_tranformation(self, orig_ctype)
    71         return handler
    70         return handler
    72 
    71 
    73     def untransform(self, type_handler, declarations, code_block, expression):
    72     def untransform(self, type_handler, declarations, code_block, expression):
    74         return 'ns3::PeekPointer (%s)' % (expression,)
    73         return 'const_cast<%s> (ns3::PeekPointer (%s))' % (type_handler.untransformed_ctype, expression)
    75 
    74 
    76     def transform(self, type_handler, declarations, code_block, expression):
    75     def transform(self, type_handler, declarations, code_block, expression):
    77         assert type_handler.untransformed_ctype[-1] == '*'
    76         assert type_handler.untransformed_ctype[-1] == '*'
    78         return 'ns3::Ptr< %s > (%s)' % (type_handler.untransformed_ctype[:-1], expression)
    77         return 'ns3::Ptr< %s > (%s)' % (type_handler.untransformed_ctype[:-1], expression)
    79 
    78