PEL: SRC callouts subsection object

This Callouts class represents the optional subsection of an SRC PEL
section that contains FRU callouts.  It is only present in the SRC when
there are callouts, and it comes at the end of the section.

It is basically just a container for the Callout objects that represent
the actual callouts.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I1d4d95b82f9b4943728d7939e3bf89e4a7bcbb75
diff --git a/extensions/openpower-pels/callouts.hpp b/extensions/openpower-pels/callouts.hpp
new file mode 100644
index 0000000..430a5ae
--- /dev/null
+++ b/extensions/openpower-pels/callouts.hpp
@@ -0,0 +1,96 @@
+#pragma once
+
+#include "callout.hpp"
+#include "stream.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+namespace src
+{
+
+/**
+ * @class Callouts
+ *
+ * This is an optional subsection of the SRC section in a PEL
+ * that holds callouts (represented as Callout objects).
+ * It is at the end of the SRC section, and there can only be one
+ * of these present in the SRC.
+ *
+ * If an SRC doesn't have any callouts, this object won't be created.
+ */
+class Callouts
+{
+  public:
+    Callouts() = default;
+    ~Callouts() = default;
+    Callouts(const Callouts&) = delete;
+    Callouts& operator=(const Callouts&) = delete;
+    Callouts(Callouts&&) = delete;
+    Callouts& operator=(Callouts&&) = delete;
+
+    /**
+     * @brief Constructor
+     *
+     * Fills in this class's data fields from the stream.
+     *
+     * @param[in] pel - the PEL data stream
+     */
+    explicit Callouts(Stream& pel);
+
+    /**
+     * @brief Flatten the object into the stream
+     *
+     * @param[in] stream - The stream to write to
+     */
+    void flatten(Stream& pel);
+
+    /**
+     * @brief Returns the size of this object when flattened into a PEL
+     *
+     * @return size_t - The size of the section
+     */
+    size_t flattenedSize()
+    {
+        return _subsectionWordLength * 4;
+    }
+
+    /**
+     * @brief Returns the contained callouts
+     *
+     * @return const std::vector<std::unique_ptr<Callout>>&
+     */
+    const std::vector<std::unique_ptr<Callout>>& callouts() const
+    {
+        return _callouts;
+    }
+
+  private:
+    /**
+     * @brief The ID of this subsection, which is 0xC0.
+     */
+    uint8_t _subsectionID;
+
+    /**
+     * @brief Subsection flags.  Always 0.
+     */
+    uint8_t _subsectionFlags;
+
+    /**
+     * @brief Subsection length in 4B words.
+     *
+     * (Subsection is always a multiple of 4B)
+     */
+    uint16_t _subsectionWordLength;
+
+    /**
+     * @brief The contained callouts
+     */
+    std::vector<std::unique_ptr<Callout>> _callouts;
+};
+
+} // namespace src
+
+} // namespace pels
+} // namespace openpower