Loading...
Searching...
No Matches
CoreManager.h
Go to the documentation of this file.
1//
2// CoreManager.h (previously ComponentsManager.h)
3//
4
5#ifndef COMPONENTSMANAGER_H
6#define COMPONENTSMANAGER_H
7
8#pragma once
9
10#include <vector>
11#include <Malena/Core/Core.h>
13
14namespace ml
15{
51 template<typename T>
52 class CoreManager : public DeferredOperationsManager<CoreManager<T>>
53 {
54 inline static std::vector<T*> _components;
55
56 public:
65 [[nodiscard]] static const std::vector<T*>& getComponents();
66
75 static void addComponent(T& component);
76
88 static bool removeComponent(T& component);
89
99 static bool removeComponent(T* component);
100
108 static void clear();
109
110 virtual ~CoreManager();
111
112 private:
114 static void doRemoveComponent(T* component);
116 };
117
118} // namespace ml
119
120#include "../../../src/Core/CoreManager.cpp"
121#endif // COMPONENTSMANAGER_H
Static, type-safe collection manager for Core-derived objects.
Definition CoreManager.h:53
virtual ~CoreManager()
static void clear()
Remove all registered objects.
static void addComponent(T &component)
Register a T object with this manager.
static const std::vector< T * > & getComponents()
Return a read-only view of all currently registered objects.
static bool removeComponent(T *component)
Unregister a T object by pointer.
static bool removeComponent(T &component)
Unregister a T object by reference.
CRTP base that gives a manager safe deferred-operation support.
Definition Component.h:18