#ifndef COMPONENTMANAGER_HPP #define COMPONENTMANAGER_HPP #include #include #include #include "component.hpp" #include "componentarray.hpp" class ComponentManager { // Map from type string pointer to a component type std::unordered_map mComponentTypes{}; // Map from type string pointer to a component array std::unordered_map> mComponentArrays{}; // The component type to be assigned to the next registered component - // starting at 0 ComponentType mNextComponentType{}; // Convenience function to get the statically casted pointer to the // ComponentArray of type T. template std::shared_ptr> GetComponentArray(); public: template void RegisterComponent(); template ComponentType GetComponentType(); template void AddComponent(Entity entity, T component); template void RemoveComponent(Entity entity); template T &GetComponent(Entity entity); void EntityDestroyed(Entity entity); }; #endif // COMPONENTMANAGER_HPP