Loading...
Searching...
No Matches
CoreManager.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith. All rights reserved.
2// Malena Framework — Proprietary Software. See LICENSE for terms.
3
4//
5// CoreManager.h (previously ComponentsManager.h)
6//
7
8#ifndef MALENA_COMPONENTSMANAGER_H
9#define MALENA_COMPONENTSMANAGER_H
10
11#pragma once
12
14#include <vector>
15#include <Malena/Core/Core.h>
17
18namespace ml
19{
54 template<typename T>
55 class CoreManager : public DeferredOperationsManager<CoreManager<T>>
56 {
57 std::vector<T*> _components;
58
59 public:
68 [[nodiscard]] const std::vector<T*>& getComponents() const;
69
78 void addComponent(T& component);
79
91 bool removeComponent(T& component);
92
102 bool removeComponent(T* component);
103
111 void clear();
112
113 virtual ~CoreManager();
114
115 private:
117 void doRemoveComponent(T* component);
119 };
120
121} // namespace ml
122
123#include "../../../src/Core/CoreManager.cpp"
124#endif // MALENA_COMPONENTSMANAGER_H
Static, type-safe collection manager for Core-derived objects.
Definition CoreManager.h:56
virtual ~CoreManager()
const std::vector< T * > & getComponents() const
Return a read-only view of all currently registered objects.
void clear()
Remove all registered objects.
void addComponent(T &component)
Register a T object with this manager.
bool removeComponent(T *component)
Unregister a T object by pointer.
bool removeComponent(T &component)
Unregister a T object by reference.
CRTP base that gives a manager safe deferred-operation support.
Definition Component.h:22