This commit is contained in:
2025-04-21 23:07:35 +02:00
parent d0bf09aa63
commit 8b1de63849
2 changed files with 17 additions and 27 deletions

View File

@@ -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.
*

View File

@@ -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);
}