diff --git a/resource/planner/c++/planner_multi.cpp b/resource/planner/c++/planner_multi.cpp index 695af53e4..d6b51ad4c 100644 --- a/resource/planner/c++/planner_multi.cpp +++ b/resource/planner/c++/planner_multi.cpp @@ -285,6 +285,14 @@ const char *planner_multi::get_resource_type_at (size_t i) const return m_types_totals_planners.at (i).resource_type.c_str (); } +size_t planner_multi::get_resource_type_idx (const char *type) const +{ + std::string rtype = std::string (type); + auto by_res = m_types_totals_planners.get ().find (rtype); + auto curr_idx = m_types_totals_planners.get ().iterator_to (*by_res); + return curr_idx - m_types_totals_planners.begin (); +} + struct request_multi &planner_multi::get_iter () { return m_iter; diff --git a/resource/planner/c++/planner_multi.hpp b/resource/planner/c++/planner_multi.hpp index 80639550d..0cfdd71a3 100644 --- a/resource/planner/c++/planner_multi.hpp +++ b/resource/planner/c++/planner_multi.hpp @@ -87,6 +87,7 @@ class planner_multi { int64_t get_resource_total_at (size_t i) const; int64_t get_resource_total_at (const char *type) const; const char *get_resource_type_at (size_t i) const; + size_t get_resource_type_idx (const char *type) const; struct request_multi &get_iter (); // Span lookup functions std::map> &get_span_lookup ();