as2fm.scxml_converter.scxml_entries.scxml_if.ScxmlIf
- class as2fm.scxml_converter.scxml_entries.scxml_if.ScxmlIf(conditional_executions: List[Tuple[str, List[ScxmlExecutableEntry]]], else_execution: List[ScxmlExecutableEntry] | None = None)
Bases:
ScxmlExecutableEntryThis class represents SCXML conditionals.
- __init__(conditional_executions: List[Tuple[str, List[ScxmlExecutableEntry]]], else_execution: List[ScxmlExecutableEntry] | None = None)
Class representing a conditional execution in SCXML.
- Parameters:
conditional_executions – List of (condition - exec. body) pairs. Min n. pairs is one.
else_execution – Execution to be done if no condition is met.
Methods
__init__(conditional_executions[, ...])Class representing a conditional execution in SCXML.
add_events_targets(events_to_models)Add the events targets to the execution bodies in the If statement.
as_plain_scxml(struct_declarations, ...)Convert the object to its plain SCXML version.
as_xml()Convert the object to an XML element.
Check if the object is valid.
from_xml_tree(xml_tree, custom_data_types, ...)External interface to create a ScxmlBase object from an XML tree.
from_xml_tree_impl(xml_tree, custom_data_types)Create a ScxmlIf object from an XML tree.
Get the conditional executions.
Extract and validate the request-receive event from the 'if' block.
Get the container with custom data types.
Get the else execution.
Get the tag name of the XML element.
Get the xml_element this object was made from.
is_plain_scxml([verbose])Check if the object is compatible with the plain SCXML standard.
Replace all string literals in the contained expressions.
set_callback_prefixes(cb_prefixes)Set the cb type for this entry and its children.
set_custom_data_types(custom_data_types)Save container with custom data types.
set_xml_origin(xml_origin)Set the xml_element this object was made from.
update_configurable_entry(ascxml_declarations)Update the content of all execution bodies in the ScxmlIf statement.
- add_events_targets(events_to_models: Dict[str, Set[str]])
Add the events targets to the execution bodies in the If statement.
- as_plain_scxml(struct_declarations: ScxmlStructDeclarationsContainer, ascxml_declarations: List[AscxmlDeclaration], **kwargs) List[ScxmlBase]
Convert the object to its plain SCXML version.
- Parameters:
struct_declarations – List of custom structures defined in the model
ascxml_declarations – Additional declarations, like ROS or BT specific ones
kwargs – Additional framework specific entries, e.g. the BT plugin ID.
- as_xml() _Element
Convert the object to an XML element.
- check_validity() bool
Check if the object is valid.
- classmethod from_xml_tree(xml_tree: _Element, custom_data_types: Dict[str, StructDefinition], **kwargs) Self
External interface to create a ScxmlBase object from an XML tree.
- classmethod from_xml_tree_impl(xml_tree: _Element, custom_data_types: Dict[str, StructDefinition]) ScxmlIf
Create a ScxmlIf object from an XML tree.
- Parameters:
xml_tree – The XML tree to create the object from.
cb_type – The kind of callback executing this SCXML entry.
- get_conditional_executions() List[Tuple[str, List[ScxmlExecutableEntry]]]
Get the conditional executions.
- get_config_request_receive_events() Tuple[str, str] | None
Extract and validate the request-receive event from the ‘if’ block.
- get_custom_data_types() Dict[str, StructDefinition]
Get the container with custom data types.
- get_else_execution() List[ScxmlExecutableEntry]
Get the else execution.
- static get_tag_name() str
Get the tag name of the XML element.
- get_xml_origin() _Element | None
Get the xml_element this object was made from.
- is_plain_scxml(verbose: bool = False) bool
Check if the object is compatible with the plain SCXML standard.
- replace_strings_types_with_integer_arrays() ScxmlIf
Replace all string literals in the contained expressions.
- set_callback_prefixes(cb_prefixes: List[str]) None
Set the cb type for this entry and its children.
- set_custom_data_types(custom_data_types: Dict[str, StructDefinition])
Save container with custom data types.
- set_xml_origin(xml_origin: _Element)
Set the xml_element this object was made from.
- update_configurable_entry(ascxml_declarations: List[AscxmlDeclaration])
Update the content of all execution bodies in the ScxmlIf statement.