probe: Change FoundProbeTypeT to point to the optional enum

`findProbeType` return is only ever used for the returned
enumeration rather than the iterator. Having it return the
iterator has additional complications since the original
code had the map be a local variable and we were playing
with undefined behavior. Looking further, none of the
callers seem to want the iterator and the return type
is making them perform more work.

Change-Id: I81b73d5b1555abfbe07569bcf0fcdd14b031704d
Signed-off-by: Amithash Prasad <amithash@meta.com>
diff --git a/src/entity_manager/perform_probe.cpp b/src/entity_manager/perform_probe.cpp
index 20e9d65..b98f357 100644
--- a/src/entity_manager/perform_probe.cpp
+++ b/src/entity_manager/perform_probe.cpp
@@ -93,7 +93,7 @@
         probe::FoundProbeTypeT probeType = probe::findProbeType(probe);
         if (probeType)
         {
-            switch ((*probeType)->second)
+            switch (*probeType)
             {
                 case probe::probe_type_codes::FALSE_T:
                 {
@@ -189,8 +189,7 @@
             ret = cur;
             first = false;
         }
-        lastCommand = probeType ? (*probeType)->second
-                                : probe::probe_type_codes::FALSE_T;
+        lastCommand = probeType.value_or(probe::probe_type_codes::FALSE_T);
     }
 
     // probe passed, but empty device
@@ -249,7 +248,7 @@
     {
         if (probe.find(probeType->first) != std::string::npos)
         {
-            return probeType;
+            return probeType->second;
         }
     }
 
diff --git a/src/entity_manager/perform_probe.hpp b/src/entity_manager/perform_probe.hpp
index f979c52..4edbe35 100644
--- a/src/entity_manager/perform_probe.hpp
+++ b/src/entity_manager/perform_probe.hpp
@@ -29,8 +29,7 @@
     MATCH_ONE
 };
 
-using FoundProbeTypeT = std::optional<boost::container::flat_map<
-    const char*, probe_type_codes, CmpStr>::const_iterator>;
+using FoundProbeTypeT = std::optional<probe_type_codes>;
 
 FoundProbeTypeT findProbeType(const std::string& probe);