Add component API to transparently remap one component to another one.

When a specific component is requested through its tag or name, one
can now have the component manager transparently return a different
one that has been registered to replace the original one. We limit
this to disabled components to avoid unnecessary confusion. That also
means that remappings are currently only supported for analyzers
(because other types of components cannot be disabled for now, per the
previous change).
This commit is contained in:
Robin Sommer 2024-04-30 08:29:54 +02:00
parent ac1a7508ee
commit 5d0c61e68b
No known key found for this signature in database
GPG key ID: D8187293B3FFE5D0
7 changed files with 123 additions and 32 deletions

View file

@ -82,14 +82,14 @@ AnalyzerPtr Manager::GetAnalyzer(const std::string& name) {
}
bool Manager::EnableAnalyzer(EnumVal* tag) {
Component* c = Lookup(tag);
Component* c = Lookup(tag, false);
c->SetEnabled(true);
return true;
}
bool Manager::DisableAnalyzer(EnumVal* tag) {
Component* c = Lookup(tag);
Component* c = Lookup(tag, false);
c->SetEnabled(false);
return true;