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
7
#include "
componentSystemRegistry.h
"
8
#include "
framework/components/componentSystem.h
"
9
10
namespace
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
24
IComponentSystem
*
ComponentSystemRegistry::getById
(
const
std::string&
id
)
const
25
{
26
const
auto
it = _systems.find(
id
);
27
return
it != _systems.end() ? it->second :
nullptr
;
28
}
29
}
visutwin::canvas::ComponentSystemRegistry::getById
IComponentSystem * getById(const std::string &id) const
Definition
componentSystemRegistry.cpp:24
visutwin::canvas::ComponentSystemRegistry::add
void add(std::unique_ptr< IComponentSystem > system)
Definition
componentSystemRegistry.cpp:12
visutwin::canvas::IComponentSystem
Definition
componentSystem.h:19
visutwin::canvas::IComponentSystem::componentType
virtual const std::type_info & componentType() const =0
visutwin::canvas::IComponentSystem::id
const std::string & id() const
Definition
componentSystem.h:26
componentSystem.h
componentSystemRegistry.h
visutwin::canvas
Definition
eventHandler.cpp:9
framework
components
componentSystemRegistry.cpp
Generated by
1.16.1