Userspace Resource Manager
Loading...
Searching...
No Matches
ComponentRegistry.h
1// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef COMPONENT_REGISTRY_H
5#define COMPONENT_REGISTRY_H
6
7#include <unordered_map>
8
9#include "Utils.h"
10
11typedef struct {
12 EventCallback mInit;
13 EventCallback mTear;
14} ModuleInfo;
15
21class ComponentRegistry {
22private:
23 static std::unordered_map<ModuleID, ModuleInfo> mModuleRegistry;
24
25public:
26 ComponentRegistry(ModuleID moduleID,
27 EventCallback registrationCallback,
28 EventCallback terardownCallback);
29
30 static int8_t isModuleEnabled(ModuleID moduleID);
31 static ModuleInfo getModuleInfo(ModuleID moduleID);
32};
33
34#define URM_REGISTER_MODULE(identifier, registration, teardown) \
35 static ComponentRegistry CONCAT(_module, identifier)(identifier, registration, teardown);
36
37
38#endif