#include "modules.hpp"

#include "signals.hpp"

Module::Module(std::string name) : SystemElementContainer<Part>(name), prnt(nullptr) {
    signals = new Signals();
}

Module::~Module() {
    for (const auto& [key, value] : content) {
        delete value;
    }
    delete signals;
}

Modules::Modules(void): SystemElementContainer<Module>("modules") {}

Modules::Modules(std::vector<Module *> modules): SystemElementContainer<Module>("modules", modules) {}

void Modules::add(Module *module)
{
    SystemElementContainer<Module>::add(module);
    module->prnt = this;
}

Modules::~Modules() {
    for (const auto& [key, value] : content) {
        delete value;
    }
}