Browse Source

Send instance_created to every instance as it is created

Yentl Van Tendeloo 8 years ago
parent
commit
09be521b8c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      models/SCCD_execute.alc

+ 8 - 0
models/SCCD_execute.alc

@@ -193,6 +193,12 @@ String function start_class(model : Element, data : Element, class : String, par
 
 	execute_actions(model, init, set_copy(class_handle["states"]), data, "")
 
+	// Notify this class itself of its ID
+	Element lst
+	lst = list_create()
+	list_append(lst, identifier)
+	set_add_node(data["current_class_handle"]["new_events"], create_tuple("instance_created", lst))
+
 	dict_overwrite(data, "current_class", prev_class)
 	dict_overwrite(data, "current_class_handle", data["classes"][prev_class])
 
@@ -302,6 +308,8 @@ Void function process_raised_event(model : Element, event : Element, parameter_a
 			class = set_pop(filter(model, allInstances(model, "SCCD/Class"), "name", list_read(parameter_action, 1)))
 			parameters = list_read(parameter_action, 2)
 			identifier = start_class(model, data, class, parameters)
+
+			// Notify the creator of the ID of the created instance
 			Element lst
 			lst = list_create()
 			list_append(lst, identifier)