1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

refactor make

Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
Pascal Bauer 2024-06-17 13:18:26 +00:00 committed by Niklas Eiling
parent 7d37c56947
commit f79f7f4ca7

View file

@ -289,6 +289,27 @@ void CoreFactory::initIps(std::list<std::shared_ptr<Core>> configuredIps,
}
}
std::list<std::shared_ptr<Core>> CoreFactory::make(Card *card,
json_t *json_ips) {
// We only have this logger until we know the factory to build an IP with
auto loggerStatic = getStaticLogger();
if (!card->ips.empty()) {
loggerStatic->error("IP list of card {} already contains IPs.", card->name);
throw RuntimeError("IP list of card {} already contains IPs.", card->name);
}
std::list<IpIdentifier> allIps =
parseVLNV(json_ips); // All IPs available in config
std::list<IpIdentifier> orderedIps =
reorderIps(allIps); // IPs ordered in initialization order
std::list<std::shared_ptr<Core>> configuredIps =
configureIps(orderedIps, json_ips, card); // Successfully configured IPs
(void) initIps(configuredIps, card);
return card->ips;
}