summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/private_header.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-10-29 11:34:03 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-11-04 16:18:29 -0600
commit97d19b4806101161c5a97c1cc4daab6b95c89984 (patch)
tree4205a872c25082902a25cec74524aae58b7cf7de /extensions/openpower-pels/private_header.hpp
parentda031717543b48a75e193d5e4d846a80279ca90b (diff)
downloadphosphor-logging-97d19b4806101161c5a97c1cc4daab6b95c89984.tar.gz
phosphor-logging-97d19b4806101161c5a97c1cc4daab6b95c89984.zip
PEL: Const accessors for Private/UserHeader
Change the combined non-const accessor/setter functions for the PrivateHeader and UserHeader fields to the standard const accessors, and have separate setters for the fields that need to be modified. In addition, make the 'get PrivateHeader' and 'get UserHeader' functions on the PEL class return a const reference. This allows const enforcement on the PEL class, for things like: void func(const PEL& pel) { auto id = pel.privateHeader().id(); } Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I840170e72b41e9e2465f716617500269244de6d9
Diffstat (limited to 'extensions/openpower-pels/private_header.hpp')
-rw-r--r--extensions/openpower-pels/private_header.hpp72
1 files changed, 56 insertions, 16 deletions
diff --git a/extensions/openpower-pels/private_header.hpp b/extensions/openpower-pels/private_header.hpp
index 9c522a2..7d6a53d 100644
--- a/extensions/openpower-pels/private_header.hpp
+++ b/extensions/openpower-pels/private_header.hpp
@@ -75,9 +75,9 @@ class PrivateHeader : public Section
/**
* @brief Returns the creation timestamp
*
- * @return BCDTime& - the timestamp
+ * @return const BCDTime& - the timestamp
*/
- BCDTime& createTimestamp()
+ const BCDTime& createTimestamp() const
{
return _createTimestamp;
}
@@ -85,19 +85,29 @@ class PrivateHeader : public Section
/**
* @brief Returns the commit time timestamp
*
- * @return BCDTime& - the timestamp
+ * @return const BCDTime& - the timestamp
*/
- BCDTime& commitTimestamp()
+ const BCDTime& commitTimestamp() const
{
return _commitTimestamp;
}
/**
+ * @brief Sets the commit timestamp
+ *
+ * @param[in] time - the new timestamp
+ */
+ void setCommitTimestamp(const BCDTime& time)
+ {
+ _commitTimestamp = time;
+ }
+
+ /**
* @brief Returns the creator ID field
*
- * @return uint8_t& - the creator ID
+ * @return uint8_t - the creator ID
*/
- uint8_t& creatorID()
+ uint8_t creatorID() const
{
return _creatorID;
}
@@ -105,9 +115,9 @@ class PrivateHeader : public Section
/**
* @brief Returns the log type field
*
- * @return uint8_t& - the log type
+ * @return uint8_t - the log type
*/
- uint8_t& logType()
+ uint8_t logType() const
{
return _logType;
}
@@ -115,27 +125,47 @@ class PrivateHeader : public Section
/**
* @brief Returns the section count field
*
- * @return uint8_t& - the section count
+ * @return uint8_t - the section count
*/
- uint8_t& sectionCount()
+ uint8_t sectionCount() const
{
return _sectionCount;
}
/**
+ * @brief Sets the section count field
+ *
+ * @param[in] count - the new section count
+ */
+ void setSectionCount(uint8_t count)
+ {
+ _sectionCount = count;
+ }
+
+ /**
* @brief Returns the OpenBMC log ID field
*
* This is the ID the OpenBMC event log that corresponds
* to this PEL.
*
- * @return uint32_t& - the OpenBMC event log ID
+ * @return uint32_t - the OpenBMC event log ID
*/
- uint32_t& obmcLogID()
+ uint32_t obmcLogID() const
{
return _obmcLogID;
}
/**
+ * @brief Sets the OpenBMC log ID field
+ *
+ * @param[in] id - the new ID
+ */
+ void setOBMCLogID(uint32_t id)
+ {
+ _obmcLogID = id;
+ }
+
+ /**
* @brief Returns the Creator Version field
*
* @return CreatorVersion& - the creator version
@@ -148,19 +178,29 @@ class PrivateHeader : public Section
/**
* @brief Returns the error log ID field
*
- * @return uint32_t& - the error log ID
+ * @return uint32_t - the error log ID
*/
- uint32_t& id()
+ uint32_t id() const
{
return _id;
}
/**
+ * @brief Sets the ID field
+ *
+ * @param[in] id - the new ID
+ */
+ void setID(uint32_t id)
+ {
+ _id = id;
+ }
+
+ /**
* @brief Returns the platform log ID field
*
- * @return uint32_t& - the platform log ID
+ * @return uint32_t - the platform log ID
*/
- uint32_t& plid()
+ uint32_t plid() const
{
return _plid;
}
OpenPOWER on IntegriCloud