VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
componentSystemRegistry.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis on 01.10.2025.
5//
6
9
10namespace visutwin::canvas
11{
12 void ComponentSystemRegistry::add(std::unique_ptr<IComponentSystem> system)
13 {
14 if (!system) {
15 return;
16 }
17
18 IComponentSystem* rawSystem = system.get();
19 _systems[rawSystem->id()] = rawSystem;
20 _systemsByComponentType[std::type_index(rawSystem->componentType())] = rawSystem;
21 _ownedSystems.push_back(std::move(system));
22 }
23
25 {
26 const auto it = _systems.find(id);
27 return it != _systems.end() ? it->second : nullptr;
28 }
29}
IComponentSystem * getById(const std::string &id) const
void add(std::unique_ptr< IComponentSystem > system)
virtual const std::type_info & componentType() const =0
const std::string & id() const