summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/section_factory.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/openpower-pels/section_factory.hpp')
-rw-r--r--extensions/openpower-pels/section_factory.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/extensions/openpower-pels/section_factory.hpp b/extensions/openpower-pels/section_factory.hpp
new file mode 100644
index 0000000..8807eba
--- /dev/null
+++ b/extensions/openpower-pels/section_factory.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "section.hpp"
+#include "stream.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+namespace section_factory
+{
+
+/**
+ * @brief Create a PEL section based on its data
+ *
+ * This creates the appropriate PEL section object based on the section ID in
+ * the first 2 bytes of the stream, but returns the base class Section pointer.
+ *
+ * If there isn't a class specifically for that section, it defaults to
+ * creating an instance of the 'Generic' class.
+ *
+ * @param[in] pelData - The PEL data stream
+ *
+ * @return std::unique_ptr<Section> - class of the appropriate type
+ */
+std::unique_ptr<Section> create(Stream& pelData);
+
+} // namespace section_factory
+} // namespace pels
+} // namespace openpower
OpenPOWER on IntegriCloud