Template Function easynav::get_perceptions
Defined in File Perceptions.hpp
Function Documentation
-
template<typename T = PerceptionBase>
inline std::vector<std::shared_ptr<T>> easynav::get_perceptions(const std::vector<PerceptionPtr> &src) Extracts a homogeneous collection of perceptions of type
Tfrom a heterogeneous vector.This helper iterates the input vector of PerceptionPtr and:
If
Tis exactly PerceptionBase, returns all stored pointers without casting (heterogeneous view).Otherwise, attempts a
std::dynamic_pointer_cast<T>and includes only those perceptions that match (homogeneous view).
- Template Parameters:
T – Target perception type. Must inherit from PerceptionBase. Defaults to PerceptionBase.
- Parameters:
src – Source vector containing heterogeneous perceptions and their subscriptions.
- Returns:
A vector of
std::shared_ptr<T>containing the matching perceptions, in the same order assrc.