New API, CppClass.set_post_instance_creation_function, to meet ns3::Object's needs.

This commit is contained in:
Gustavo J. A. M. Carneiro committed 2010-05-06 13:51:33 +01:00
1 parent f39b9a8a19
commit 9c3d5c1a25
3 files changed
+60

No files matched your search

+4
View File
@@ -617,6 +617,7 @@ class CppConstructor(ForwardWrapperBase):
#assert isinstance(class_, CppClass)
if class_.helper_class is None:
class_.write_create_instance(self.before_call, "self->obj", ", ".join(self.call_params))
class_.write_post_instance_creation_code(self.before_call, "self->obj", ", ".join(self.call_params))
else:
## We should only create a helper class instance when
## being called from a user python subclass.
@@ -628,6 +629,8 @@ class CppConstructor(ForwardWrapperBase):
class_.helper_class.name)
self.before_call.write_code('((%s*) self->obj)->set_pyobj((PyObject *)self);'
% class_.helper_class.name)
class_.write_post_instance_creation_code(self.before_call, "self->obj", ", ".join(self.call_params),
class_.helper_class.name)
self.before_call.unindent()
self.before_call.write_code("} else {")
@@ -644,6 +647,7 @@ class CppConstructor(ForwardWrapperBase):
self.before_call.write_code('return -1;')
else:
class_.write_create_instance(self.before_call, "self->obj", ", ".join(self.call_params))
class_.write_post_instance_creation_code(self.before_call, "self->obj", ", ".join(self.call_params))
self.before_call.unindent()
self.before_call.write_code("}")