PEL: Make PEL::flatten() const
This includes making the flatten() method const in the PEL section base
class and in all of its derived classes.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6be787962c6d7dfa01bdced2f9024564e6ac1b08
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp
index 885caed..babc61b 100644
--- a/extensions/openpower-pels/pel.cpp
+++ b/extensions/openpower-pels/pel.cpp
@@ -122,7 +122,7 @@
_ph->setID(generatePELID());
}
-void PEL::flatten(std::vector<uint8_t>& pelBuffer)
+void PEL::flatten(std::vector<uint8_t>& pelBuffer) const
{
Stream pelData{pelBuffer};
@@ -141,7 +141,7 @@
}
}
-std::vector<uint8_t> PEL::data()
+std::vector<uint8_t> PEL::data() const
{
std::vector<uint8_t> pelData;
flatten(pelData);
@@ -202,7 +202,8 @@
}
} // namespace util
-void PEL::printSectionInJSON(Section& section, std::string& buf) const
+
+void PEL::printSectionInJSON(const Section& section, std::string& buf) const
{
char tmpB[5];
if (section.valid())
@@ -227,7 +228,7 @@
}
}
-void PEL::toJSON()
+void PEL::toJSON() const
{
std::string buf = "{";
printSectionInJSON(*(_ph.get()), buf);