diff --git a/src/imports/import_base.hpp b/src/imports/import_base.hpp index c69d751..44b6241 100644 --- a/src/imports/import_base.hpp +++ b/src/imports/import_base.hpp @@ -17,7 +17,6 @@ class ImportBase { protected: Parts *prts; ///< Pointer to the Parts object. - Signals *sigs; ///< Pointer to the Signals object. std::fstream file_lines; ///< File stream for reading the input file. public: @@ -31,7 +30,6 @@ public: ImportBase(std::string file_name) : file_lines(std::fstream(file_name)) { prts = new Parts(); - sigs = new Signals(); }; /** @@ -52,15 +50,6 @@ public: return prts; } - /** - * @brief Retrieves the Signals object. - * @return Pointer to the Signals object. - */ - Signals * signals() - { - return sigs; - } - /** * @brief Virtual destructor for ImportBase. * diff --git a/src/system/system.cpp b/src/system/system.cpp index a92fb4a..242750c 100644 --- a/src/system/system.cpp +++ b/src/system/system.cpp @@ -22,25 +22,26 @@ void System::Load(std::string module_name, std::string file_name, ImportType typ ImportBase *imp; Module *mod = nullptr; Parts *prts = nullptr; - if (!mods->exists(module_name)) + + // Creation or retrieval of the module. + mod = mods->merge(module_name); + + // Parsing of the file based on the import type. + if (type == ImportType::IMPORT_MENTOR) { - mod = new Module(module_name); - mods->add(mod); + imp = new ImportMentor(file_name); + } else if (type == ImportType::IMPORT_ALTIUM) + { + // imp = new ImportAltium(file_name); + } else if (type == ImportType::IMPORT_ODS) + { + // imp = new ImportOds(file_name); } else { - mod = mods->get(module_name); - } - switch (type) - { - case ImportType::IMPORT_MENTOR: - imp = new ImportMentor(file_name); - imp->parse(mod->signals); - prts = imp->parts(); - mod->add(prts); - break; - - default: - break; + throw std::runtime_error("Unknown import type"); } + imp->parse(mod->signals); + prts = imp->parts(); + mod->add(prts); } \ No newline at end of file