From a4cee2462689cdb5bc602b601bc6c9bbe8a8f419 Mon Sep 17 00:00:00 2001 From: Francesco Cameli Date: Wed, 26 Oct 2022 13:03:22 +0100 Subject: [PATCH] Cleanup Engine.cpp --- .vscode/settings.json | 84 +++++++++++++++++++++++++++++++++++++++++ src/override/Engine.cpp | 29 +------------- 2 files changed, 86 insertions(+), 27 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9090ed5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,84 @@ +{ + "files.associations": { + "algorithm": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "csetjmp": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "any": "cpp", + "array": "cpp", + "atomic": "cpp", + "strstream": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cfenv": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "codecvt": "cpp", + "compare": "cpp", + "complex": "cpp", + "concepts": "cpp", + "condition_variable": "cpp", + "coroutine": "cpp", + "cstdint": "cpp", + "deque": "cpp", + "forward_list": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "regex": "cpp", + "source_location": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "future": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "ranges": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "stop_token": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "typeindex": "cpp", + "typeinfo": "cpp", + "valarray": "cpp", + "variant": "cpp", + "*.mm": "cpp", + "*.ipp": "cpp" + } +} \ No newline at end of file diff --git a/src/override/Engine.cpp b/src/override/Engine.cpp index e0a70d2..793b3be 100644 --- a/src/override/Engine.cpp +++ b/src/override/Engine.cpp @@ -324,37 +324,12 @@ static void Engine_updateConnected(Engine* that) { Engine_orderModules(that); } + template inline bool mapContains(std::unordered_map &id, T what) { return id.find(what) != id.end(); } -// Stores all Modules' and Cables' relationships -/* -struct ModulesNetwork { - std::unordered_map> inCables; - std::unordered_map> outCables; -}; - -inline ModulesNetwork Engine_buildModulesNetwork(Engine* that) { - Engine::Internal* internal = that->internal; - ModulesNetwork modulesNetwork; - for (Cable* cable : internal->cables) { - Module* inModule = cable->inputModule; - Module* outModule = cable->outputModule; - if (mapContains(modulesNetwork.inCables, inModule)) - modulesNetwork.inCables[inModule].push_back(cable); - else - modulesNetwork.inCables[inModule] = std::vector(); - if (mapContains(modulesNetwork.outCables, outModule)) - modulesNetwork.outCables[outModule].push_back(cable); - else - modulesNetwork.outCables[outModule] = std::vector(); - } - return modulesNetwork; -} -*/ - static bool Engine_resolveFeedbackCable(Module* startingModule, Cable* cable) { Module* outModule = cable->outputModule; if (outModule == startingModule) @@ -387,7 +362,7 @@ static void Engine_orderModule(Module* module, std::unordered_map