Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 by
Dynamic + <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 😊
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.