11# FILE: mcg_cc_component_converter.py
22#
33# DESCRIPTION:
4- # This module contains definition of ComponentConverter class, which is child
5- # class of Converter class and is responsible for conversion of component content
6- # into configuration file .
4+ # This module contains definition of ComponentConverter class, which is
5+ # responsible for conversion of component content into configuration file
6+ # format .
77#
88# COPYRIGHT: Copyright (C) 2021-2022 Kamil Deć github.com/deckamil
9- # DATE: 20 FEB 2022
9+ # DATE: 21 JUL 2022
1010#
1111# LICENSE:
1212# This file is part of Mod Code Generator (MCG).
3333from mcg_cc_logger import Logger
3434
3535
36- # Class:
37- # ComponentConverter()
38- #
3936# Description:
40- # This is child class responsible for converting of component content into configuration file.
37+ # This class allows to convert component content into configuration file format .
4138class ComponentConverter (Converter ):
4239
43- # Method:
44- # convert_action_interaction()
45- #
4640 # Description:
4741 # This method is responsible for conversion of action interaction into configuration file.
48- #
49- # Returns:
50- # This method does not return anything.
5142 def convert_action_interaction (self , sorted_node , math_symbol ):
5243
5344 # append interaction comment to configuration file
@@ -69,14 +60,11 @@ def convert_action_interaction(self, sorted_node, math_symbol):
6960 # append conversion line to configuration file
7061 self .configuration_file .append (conversion_line )
7162
72- # Method:
73- # convert_signal_assignment( )
74- #
63+ # record info
64+ Logger . save_in_log_file ( "Converter" , "Have converted to " + str ( conversion_line ) + " line" , False )
65+
7566 # Description:
7667 # This method is responsible for conversion of signal assignment into configuration file.
77- #
78- # Returns:
79- # This method does not return anything.
8068 def convert_signal_assignment (self , sorted_node ):
8169
8270 # find output signal name within sorted node
@@ -90,21 +78,15 @@ def convert_signal_assignment(self, sorted_node):
9078 # append conversion line to configuration file
9179 self .configuration_file .append (conversion_line )
9280
93- # Method:
94- # convert_component( )
95- #
81+ # record info
82+ Logger . save_in_log_file ( "Converter" , "Have converted to " + str ( conversion_line ) + " line" , False )
83+
9684 # Description:
9785 # This method is responsible for converting of component content into configuration file.
98- #
99- # Returns:
100- # This method does not return anything.
10186 def convert_component (self ):
10287
103- # component converter
104- Logger .save_in_log_file (">>>>>>>>>>>>>>>>>>>>>>>>>>>> COMPONENT CONVERTER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n " )
105-
106- # convert header
107- Logger .save_in_log_file ("*** convert header" )
88+ # record info
89+ Logger .save_in_log_file ("Converter" , "Converting module source and name into configuration file" , True )
10890
10991 # append start marker of new component section to configuration file
11092 self .configuration_file .append (str ("COMPONENT START" ))
@@ -115,14 +97,20 @@ def convert_component(self):
11597 # append component name to configuration file
11698 self .configuration_file .append (str ("COMPONENT NAME " ) + str (self .model_element_name ))
11799
100+ # record info
101+ Logger .save_in_log_file ("Converter" , "Have converted to "
102+ + str (self .configuration_file [len (self .configuration_file ) - 2 ]) + " line" , False )
103+ Logger .save_in_log_file ("Converter" , "Have converted to "
104+ + str (self .configuration_file [len (self .configuration_file ) - 1 ]) + " line" , False )
105+
118106 # convert interface details to configuration file
119- self .convert_interfaces ()
107+ self .convert_interfaces (str ( "COMPONENT" ) )
120108
121- # convert body
122- Logger .save_in_log_file ("*** convert body" )
109+ # record info
110+ Logger .save_in_log_file ("Converter" , "Converting module body into configuration file" , False )
123111
124112 # append start marker of function body section to configuration file
125- self .configuration_file .append (str ("BODY START" ))
113+ self .configuration_file .append (str ("COMPONENT BODY START" ))
126114
127115 # repeat for all nodes from sorted node list
128116 for sorted_node in self .sorted_node_list :
@@ -153,22 +141,14 @@ def convert_component(self):
153141 self .convert_signal_assignment (sorted_node )
154142
155143 # append end marker of function body section to configuration file
156- self .configuration_file .append (str ("BODY END" ))
144+ self .configuration_file .append (str ("COMPONENT BODY END" ))
157145
158146 # append end marker of new component section to configuration file
159147 self .configuration_file .append (str ("COMPONENT END" ))
160148
149+ # record info
150+ Logger .save_in_log_file ("Converter" , "Saving conversion results into configuration file" , False )
151+
161152 # save configuration file
162153 self .save_in_configuration_file ()
163154
164- # process completed
165- Logger .save_in_log_file ("PROCESS COMPLETED" )
166-
167- # display additional details after component conversion
168- Logger .save_in_log_file ("" )
169- Logger .save_in_log_file ("Configuration File:" )
170- for line in self .configuration_file :
171- Logger .save_in_log_file (" " + str (line ))
172-
173- # end of component converter
174- Logger .save_in_log_file ("\n >>>>>>>>>>>>>>>>>>>>>>>> END OF COMPONENT CONVERTER <<<<<<<<<<<<<<<<<<<<<<<<<<<" )
0 commit comments