|
@@ -127,9 +127,13 @@ Void function delete_class(model : Element, data : Element, identifier : String)
|
|
|
// Stop a specific class instance, with attached statechart, from executing
|
|
|
dict_delete(data["classes"], identifier)
|
|
|
|
|
|
-Void function start_class(model : Element, data : Element, class : String, identifier : String, parameters : Element):
|
|
|
+String function start_class(model : Element, data : Element, class : String, parameters : Element):
|
|
|
// Start up the class and assign its initial state to it
|
|
|
|
|
|
+ // First find an empty identifier
|
|
|
+ String identifier
|
|
|
+ identifier = cast_i2s(dict_len(data["classes"]))
|
|
|
+
|
|
|
// Create the data structure for a running class
|
|
|
Element class_handle
|
|
|
class_handle = dict_create()
|
|
@@ -192,7 +196,7 @@ Void function start_class(model : Element, data : Element, class : String, ident
|
|
|
dict_overwrite(data, "current_class", prev_class)
|
|
|
dict_overwrite(data, "current_class_handle", data["classes"][prev_class])
|
|
|
|
|
|
- return!
|
|
|
+ return identifier!
|
|
|
|
|
|
Element function get_enabled_transitions(model : Element, state : String, data : Element):
|
|
|
// Returns all enabled transitions
|
|
@@ -295,16 +299,20 @@ Void function process_raised_event(model : Element, event : Element, parameter_a
|
|
|
String class
|
|
|
String identifier
|
|
|
Element parameters
|
|
|
- class = set_pop(filter(model, allInstances(model, "SCCD/Class"), "name", list_read(parameter_action, 0)))
|
|
|
- identifier = list_read(parameter_action, 1)
|
|
|
+ class = set_pop(filter(model, allInstances(model, "SCCD/Class"), "name", list_read(parameter_action, 1)))
|
|
|
parameters = list_read(parameter_action, 2)
|
|
|
- start_class(model, data, class, identifier, parameters)
|
|
|
+ identifier = start_class(model, data, class, parameters)
|
|
|
+ Element lst
|
|
|
+ lst = list_create()
|
|
|
+ list_append(lst, identifier)
|
|
|
+ set_add_node(data["current_class_handle"]["new_events"], create_tuple("instance_created", lst))
|
|
|
|
|
|
elif (operation == "delete_instance"):
|
|
|
// Delete the requested class
|
|
|
String identifier
|
|
|
identifier = list_read(parameter_action, 0)
|
|
|
delete_class(model, data, identifier)
|
|
|
+ set_add_node(data["current_class_handle"]["new_events"], create_tuple("instance_deleted", parameter_action))
|
|
|
elif (scope == "broad"):
|
|
|
// Send to all classes
|
|
|
Element classes
|
|
@@ -714,7 +722,7 @@ Boolean function main(model : Element):
|
|
|
default_class = set_pop(filter(model, allInstances(model, "SCCD/Class"), "default", True))
|
|
|
|
|
|
// Start up the default class
|
|
|
- start_class(model, data, default_class, "main", read_root())
|
|
|
+ start_class(model, data, default_class, read_root())
|
|
|
|
|
|
Float timeout
|
|
|
Element interrupt
|