Find an entry in the policy table

Find the policy details entry based on the error message
and a modifier string.

Not all details entries have a modifier, and if it is empty
it will match on anything.

Change-Id: I86c2901cc8e2172959d8e8c674f0082b7c8f91d9
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/policy_table.hpp b/policy_table.hpp
index b6fade3..a44bf0b 100644
--- a/policy_table.hpp
+++ b/policy_table.hpp
@@ -1,5 +1,6 @@
 #pragma once
 
+#include <experimental/optional>
 #include <map>
 #include <vector>
 #include "config.h"
@@ -26,8 +27,12 @@
 };
 
 using DetailsList = std::vector<Details>;
+using DetailsReference = std::reference_wrapper<const Details>;
+
 using PolicyMap = std::map<std::string, DetailsList>;
 
+namespace optional_ns = std::experimental;
+
 /**
  * @class Table
  *
@@ -64,6 +69,20 @@
             return loaded;
         }
 
+        /**
+         * Finds an entry in the policy table based on the
+         * error and the search modifier.
+         *
+         * @param[in] error - the error, like xyz.openbmc_project.Error.X
+         * @param[in] modifier - the search modifier, used to find the entry
+         *                   when multiple ones share the same error
+         *
+         * @return optional<DetailsReference> - the details entry
+         */
+        optional_ns::optional<DetailsReference> find(
+                const std::string& error,
+                const std::string& modifier) const;
+
     private:
 
         /**