@@ -79,7 +79,8 @@ void deviceStateTable(DataProcessingStates const& states)
7979 }
8080}
8181
82- void deviceInfoTable (char const * label, ProcessingStateId id, DataProcessingStates const & states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>> routes, DeviceMetricsInfo const & metrics)
82+ template <typename Routes>
83+ void deviceInfoTable (char const * label, ProcessingStateId id, DataProcessingStates const & states, Routes const & routes, DeviceMetricsInfo const & metrics)
8384{
8485 // Find the state spec associated to data_queries
8586 auto & view = states.statesViews [(int )id];
@@ -95,17 +96,10 @@ void deviceInfoTable(char const* label, ProcessingStateId id, DataProcessingStat
9596 if ((end - input) == 0 ) {
9697 continue ;
9798 }
98- auto getLifetime = [&routes, &i]() -> Lifetime {
99- if (std::get_if<std::vector<InputRoute>>(&routes)) {
100- return std::get<std::vector<InputRoute>>(routes)[i].matcher .lifetime ;
101- } else {
102- return std::get<std::vector<OutputRoute>>(routes)[i].matcher .lifetime ;
103- }
104- };
105- ImGui::Text (" %zu: %.*s (%s)" , i, int (end - input), input, InspectorHelpers::getLifeTimeStr (getLifetime ()).c_str ());
99+ ImGui::Text (" %zu: %.*s (%s)" , i, int (end - input), input, InspectorHelpers::getLifeTimeStr (routes[i].matcher .lifetime ));
106100 if (ImGui::IsItemHovered ()) {
107101 ImGui::BeginTooltip ();
108- ImGui::Text (" %zu: %.*s (%s)" , i, int (end - input), input, InspectorHelpers::getLifeTimeStr (getLifetime ()). c_str ( ));
102+ ImGui::Text (" %zu: %.*s (%s)" , i, int (end - input), input, InspectorHelpers::getLifeTimeStr (routes[i]. matcher . lifetime ));
109103 ImGui::EndTooltip ();
110104 }
111105 input = end + 1 ;
@@ -346,8 +340,8 @@ void displayDeviceInspector(DeviceSpec const& spec,
346340 }
347341
348342 deviceStateTable (states);
349- deviceInfoTable (" Inputs:" , ProcessingStateId::DATA_QUERIES, states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>>( spec.inputs ) , metrics);
350- deviceInfoTable (" Outputs:" , ProcessingStateId::OUTPUT_MATCHERS, states, std::variant<std::vector<InputRoute>, std::vector<OutputRoute>>( spec.outputs ) , metrics);
343+ deviceInfoTable (" Inputs:" , ProcessingStateId::DATA_QUERIES, states, spec.inputs , metrics);
344+ deviceInfoTable (" Outputs:" , ProcessingStateId::OUTPUT_MATCHERS, states, spec.outputs , metrics);
351345 configurationTable (info.currentConfig , info.currentProvenance );
352346 optionsTable (" Workflow Options" , metadata.workflowOptions , control);
353347 if (ImGui::CollapsingHeader (" Labels" , ImGuiTreeNodeFlags_DefaultOpen)) {
0 commit comments