39 lines
984 B
C++
39 lines
984 B
C++
#pragma once
|
|
#include "ui/ui_app.h"
|
|
#include <vector>
|
|
|
|
/**
|
|
* @brief Registry for all available apps
|
|
*
|
|
* This singleton class maintains a list of all registered
|
|
* AppDescriptor instances, allowing the UIHandler or other
|
|
* components to query available apps.
|
|
*/
|
|
class AppRegistry {
|
|
public:
|
|
static AppRegistry& instance() {
|
|
static AppRegistry registry;
|
|
return registry;
|
|
}
|
|
|
|
AppRegistry(const AppRegistry&) = delete;
|
|
void operator=(const AppRegistry&) = delete;
|
|
AppRegistry(AppRegistry&&) = delete;
|
|
void operator=(AppRegistry&&) = delete;
|
|
|
|
|
|
// Register a new app descriptor
|
|
// The registry takes ownership of the descriptor pointer.
|
|
void register_app(AppDescriptor* app_descriptor) {
|
|
_app_descriptors.push_back(app_descriptor);
|
|
}
|
|
|
|
const std::vector<AppDescriptor*>& get_app_descriptors() const {
|
|
return _app_descriptors;
|
|
}
|
|
|
|
private:
|
|
AppRegistry() = default;
|
|
~AppRegistry() = default;
|
|
std::vector<AppDescriptor*> _app_descriptors = {};
|
|
}; |