Commit b3f5cdff authored by gsamain's avatar gsamain Committed by Xavier Thompson

Cleaner construction of reifying classes

parent eeae4572
...@@ -1240,20 +1240,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1240,20 +1240,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
arg_codes.append(arg_constructor_code) arg_codes.append(arg_constructor_code)
arg_names.append(arg.name) arg_names.append(arg.name)
arg_cnames.append(arg.cname) arg_cnames.append(arg.cname)
# Putting them into constructor # Putting them into constructor
constructor_args_declaration = ", ".join(arg_codes) constructor_args_declaration = ", ".join(arg_codes)
initializer_list = ["%s(%s)" % (cname, name) initializer_list = ["%s(%s)" % (cname, name)
for name, cname in zip(arg_names, arg_cnames)] for name, cname in zip(arg_names, arg_cnames)]
constructor_initializer_list_declaration = ", ".join(initializer_list) constructor_initializer_list_declaration = ", ".join(initializer_list)
code.putln("%s(%s) : %s {" % ( code.putln("%s(%s) : ActhonMessageInterface(sync_method, result_object), %s {}" % (
constructor_name, constructor_name,
constructor_args_declaration, constructor_args_declaration,
constructor_initializer_list_declaration constructor_initializer_list_declaration
)) ))
# FIXME: it would be cleaner to be able to have a bare C++ two-args constructor for ActhonMessageInterface
code.putln("this->_sync_method = sync_method;")
code.putln("this->_result = result_object;")
code.putln("}")
code.putln("int activate() {") code.putln("int activate() {")
code.putln("/* Activate only if its sync object agrees to do so */") code.putln("/* Activate only if its sync object agrees to do so */")
code.putln("if (this->_sync_method != NULL and !this->_sync_method->isActivable()) {") code.putln("if (this->_sync_method != NULL and !this->_sync_method->isActivable()) {")
......
...@@ -96,6 +96,10 @@ ...@@ -96,6 +96,10 @@
ActhonSyncInterface* _sync_method; ActhonSyncInterface* _sync_method;
ActhonResultInterface* _result; ActhonResultInterface* _result;
virtual int activate() = 0; virtual int activate() = 0;
ActhonMessageInterface(
ActhonSyncInterface* sync_method,
ActhonResultInterface* result_object
) : _sync_method(sync_method), _result(result_object) {}
}; };
struct ActhonQueueInterface : CyObject { struct ActhonQueueInterface : CyObject {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment