Closed minacode closed 6 months ago
Build checks have not completed. Possible reasons for this are:
@minacode Thanks for your work on this topic! Since you created this PR, we merged #1894 which, I think, does mostly the same functionality at build time. Is this OK for you if we close this PR in favor of #1894 ?
Yes, absolutely :)
This PR stems from #1571 and is related to #1262. It is a draft, because there is work left to do (see the open problems below).
This PR implements an
AppController
class as a single place in the code where all non-core apps are registered. Short-term this allows us to implement optional apps (see #1408). Long-term this allows us to implement dynamically loadable apps.Currently the app
Twos
is handled by theAppController
as an example, mostly because it has no dependencies and is therefore simple to handle.The implementation uses the
Apps
enum (see also #1760), but removes all entries of apps that will be handled by theAppController
. Instead, the entryDynamic
is added to the enum. The ids of dynamic apps are then calculated byDynamic + <offset>
where<offset>
is the id of an app inside theAppController
(e.g. an array index). This leads to a lot ofstatic_cast
everywhere.All places, where the current apps where hardcoded before have to use the AppController now.
Apps that can be used with the
AppController
must implement aGet
method and its symbol like this:The
AppController
saves those contructors internally and can reference them via theDynamic + <offset>
ids described above.There are also already fragments of an
AppInterface
in the code that everyGet
method must receive. TheAppInterface
bundles all the controllers that apps can require.The current version runs with InfiniSim if you use my branch.
Feedback and ideas would be very apprechiated :blush:
Open Problems:
AppController
should be a component and live in the respective directory.AppController
as well or are we hardcoding them (for now)?AppInterface
.std::vector
in the code. Is it better to swap them forstd::array
? This is a tradeoff between dynamically allocating a collection when we know how many apps we have vs. hardcoding an array with reasonable bounds. Using only vectors seems to overflow the stack.