Skip to content
Snippets Groups Projects
Commit e8d99dd0 authored by angloth's avatar angloth
Browse files

Add deep copying with call

parent be07babe
No related branches found
No related tags found
4 merge requests!31Resolve "Specify internal input/output dependencies of an Operation",!25Resolve "System tests iteration 1",!24Resolve "System tests iteration 1",!23Resolve "Simulate SFG"
Pipeline #12278 passed
...@@ -133,21 +133,23 @@ class SFG(AbstractOperation): ...@@ -133,21 +133,23 @@ class SFG(AbstractOperation):
for sig, input_index in self._original_input_signals_indexes.items(): for sig, input_index in self._original_input_signals_indexes.items():
# Check if already added destination. # Check if already added destination.
new_sig = self._added_components_mapping[sig] new_sig = self._added_components_mapping[sig]
if new_sig.destination is not None and new_sig.destination.operation in output_operations_set: if new_sig.destination is None:
# Add directly connected input to output to dfs order list if sig.destination is None:
self._components_in_dfs_order.extend([ raise ValueError(
new_sig.source.operation, new_sig, new_sig.destination.operation]) f"Input signal #{input_index} is missing destination in SFG")
elif sig.destination is None: elif sig.destination.operation not in self._added_components_mapping:
raise ValueError( self._copy_structure_from_operation_dfs(
f"Input signal #{input_index} is missing destination in SFG") sig.destination.operation)
elif sig.destination.operation not in self._added_components_mapping: else:
self._copy_structure_from_operation_dfs( if new_sig.destination.operation in output_operations_set:
sig.destination.operation) # Add directly connected input to output to dfs order list
self._components_in_dfs_order.extend([
new_sig.source.operation, new_sig, new_sig.destination.operation])
# Search the graph inwards from each output signal. # Search the graph inwards from each output signal.
for sig, output_index in self._original_output_signals_indexes.items(): for sig, output_index in self._original_output_signals_indexes.items():
# Check if already added source. # Check if already added source.
mew_sig = self._added_components_mapping[sig] new_sig = self._added_components_mapping[sig]
if new_sig.source is None: if new_sig.source is None:
if sig.source is None: if sig.source is None:
raise ValueError( raise ValueError(
...@@ -156,6 +158,9 @@ class SFG(AbstractOperation): ...@@ -156,6 +158,9 @@ class SFG(AbstractOperation):
self._copy_structure_from_operation_dfs( self._copy_structure_from_operation_dfs(
sig.source.operation) sig.source.operation)
def __call__(self):
return self.deep_copy()
@property @property
def type_name(self) -> TypeName: def type_name(self) -> TypeName:
return "sfg" return "sfg"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment