Refactor: move registries functions to their file

There were same functions from namespace 'registries' in
event_service_manager.hpp. Move them to registries.cpp/hpp.

Tested:
- Using Redfish Event Listener, test subscriptions and eventing.
- Redfish Service Validator passes

Change-Id: Id0912f6581637bb4117e67b138122c355256b561
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/src/registries.cpp b/redfish-core/src/registries.cpp
index a852f24..9ed261a 100644
--- a/redfish-core/src/registries.cpp
+++ b/redfish-core/src/registries.cpp
@@ -1,8 +1,6 @@
 #include "registries.hpp"
 
-#include "registries/base_message_registry.hpp"
-#include "registries/openbmc_message_registry.hpp"
-#include "registries/telemetry_message_registry.hpp"
+#include "registries_selector.hpp"
 #include "str_utility.hpp"
 
 #include <algorithm>
@@ -39,26 +37,18 @@
     std::vector<std::string> fields;
     fields.reserve(4);
     bmcweb::split(fields, messageID, '.');
+    if (fields.size() != 4)
+    {
+        return nullptr;
+    }
+
     const std::string& registryName = fields[0];
     const std::string& messageKey = fields[3];
 
     // Find the right registry and check it for the MessageKey
-    if (std::string(base::header.registryPrefix) == registryName)
-    {
-        return getMessageFromRegistry(
-            messageKey, std::span<const MessageEntry>(base::registry));
-    }
-    if (std::string(openbmc::header.registryPrefix) == registryName)
-    {
-        return getMessageFromRegistry(
-            messageKey, std::span<const MessageEntry>(openbmc::registry));
-    }
-    if (std::string(telemetry::header.registryPrefix) == registryName)
-    {
-        return getMessageFromRegistry(
-            messageKey, std::span<const MessageEntry>(telemetry::registry));
-    }
-    return nullptr;
+    // Find the right registry and check it for the MessageKey
+    return getMessageFromRegistry(messageKey,
+                                  getRegistryFromPrefix(registryName));
 }
 
 } // namespace redfish::registries