Unverified Commit 002cb5cb authored by Robin Mueller's avatar Robin Mueller
Browse files

added function to generate header file

parent af383e7f
......@@ -31,7 +31,7 @@ def export_object_file(filename, object_list, file_separator: str = ","):
file.close()
def write_translation_file(filename, list_of_entries, date_string_full: str):
def write_translation_file(filename: str, list_of_entries, date_string_full: str):
outputfile = open(filename, "w")
print('ObjectParser: Writing translation file ' + filename)
definitions = ""
......@@ -51,6 +51,17 @@ def write_translation_file(filename, list_of_entries, date_string_full: str):
outputfile.close()
def write_translation_header_file(filename: str = "translateObjects.h"):
file = open(filename, "w")
file.write(
f"#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_\n"
f"#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_\n\n"
f"#include <fsfw/objectmanager/SystemObjectIF.h>\n\n"
f"const char * translateObject(object_id_t object);\n\n"
f"#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */\n"
)
def sql_object_exporter(object_table: list, delete_cmd: str, create_cmd: str, insert_cmd: str, sql_table: str):
sql_writer = SqlWriter(sql_table)
sql_writer.delete(delete_cmd)
......@@ -60,4 +71,4 @@ def sql_object_exporter(object_table: list, delete_cmd: str, create_cmd: str, in
insert_cmd, (entry[0], entry[1][0])
)
sql_writer.commit()
sql_writer.close()
\ No newline at end of file
sql_writer.close()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment