mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
plugin/ComponentManager: Support lookup by EnumValPtr
This commit is contained in:
parent
4aca6290a7
commit
bf2ba626b1
1 changed files with 15 additions and 1 deletions
|
@ -136,7 +136,7 @@ public:
|
||||||
C* Lookup(const zeek::Tag& tag, bool consider_remappings = true) const;
|
C* Lookup(const zeek::Tag& tag, bool consider_remappings = true) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name A component's enum value.
|
* @param val A component's enum value.
|
||||||
* @param consider_remappings If true, component mappings will be honored
|
* @param consider_remappings If true, component mappings will be honored
|
||||||
* if the original component is disabled.
|
* if the original component is disabled.
|
||||||
* @return The component associated with the value or a null pointer if no
|
* @return The component associated with the value or a null pointer if no
|
||||||
|
@ -144,6 +144,15 @@ public:
|
||||||
*/
|
*/
|
||||||
C* Lookup(EnumVal* val, bool consider_remappings = true) const;
|
C* Lookup(EnumVal* val, bool consider_remappings = true) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param val A component's enum value.
|
||||||
|
* @param consider_remappings If true, component mappings will be honored
|
||||||
|
* if the original component is disabled.
|
||||||
|
* @return The component associated with the value or a null pointer if no
|
||||||
|
* such component exists.
|
||||||
|
*/
|
||||||
|
C* Lookup(const EnumValPtr& val, bool consider_remappings = true) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a mapping of a component to another one that will be honored
|
* Registers a mapping of a component to another one that will be honored
|
||||||
* by the `Lookup()` methods if (and only if) the original is currently
|
* by the `Lookup()` methods if (and only if) the original is currently
|
||||||
|
@ -347,6 +356,11 @@ C* ComponentManager<C>::Lookup(EnumVal* val, bool consider_remappings) const {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class C>
|
||||||
|
C* ComponentManager<C>::Lookup(const EnumValPtr& val, bool consider_remappings) const {
|
||||||
|
return Lookup(val.get(), consider_remappings);
|
||||||
|
}
|
||||||
|
|
||||||
template<class C>
|
template<class C>
|
||||||
void ComponentManager<C>::RegisterComponent(C* component, const std::string& prefix) {
|
void ComponentManager<C>::RegisterComponent(C* component, const std::string& prefix) {
|
||||||
std::string cname = component->CanonicalName();
|
std::string cname = component->CanonicalName();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue