summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-11-06 13:02:23 -0600
committerMatt Spinler <spinler@us.ibm.com>2019-11-25 08:59:43 -0600
commit19e89ce419499cb9a8e0f67a66896bc69f360b5c (patch)
tree3807c323163b0ef962d425f48f0cd2b326cbeecb /extensions/openpower-pels
parentd4ffb656bb312c38d73a8afbc4d834f6d1d2fc24 (diff)
downloadphosphor-logging-19e89ce419499cb9a8e0f67a66896bc69f360b5c.tar.gz
phosphor-logging-19e89ce419499cb9a8e0f67a66896bc69f360b5c.zip
PEL: Move some functionality into DataIfaceBase
Refactor DataInterface to hold the data members in the base class, and use the derived class for calculating them. This will make it consistent with functionality that will be added in the future. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: If6f2ba1890df296cb612c8a64dd60db72c70c46d
Diffstat (limited to 'extensions/openpower-pels')
-rw-r--r--extensions/openpower-pels/data_interface.hpp59
1 files changed, 23 insertions, 36 deletions
diff --git a/extensions/openpower-pels/data_interface.hpp b/extensions/openpower-pels/data_interface.hpp
index 34bb173..14acd70 100644
--- a/extensions/openpower-pels/data_interface.hpp
+++ b/extensions/openpower-pels/data_interface.hpp
@@ -19,8 +19,8 @@ using DBusPropertyMap = std::map<DBusProperty, DBusValue>;
/**
* @class DataInterface
*
- * An abstract interface class for gathering data about the system
- * for use in PELs. Implemented this way to facilitate mocking.
+ * A base class for gathering data about the system for use
+ * in PELs. Implemented this way to facilitate mocking.
*/
class DataInterfaceBase
{
@@ -33,18 +33,35 @@ class DataInterfaceBase
DataInterfaceBase& operator=(DataInterfaceBase&&) = default;
/**
- * @brief Pure virtual for returning the MTM
+ * @brief Returns the machine Type/Model
*
* @return string - The machine Type/Model string
*/
- virtual std::string getMachineTypeModel() const = 0;
+ virtual std::string getMachineTypeModel() const
+ {
+ return _machineTypeModel;
+ }
/**
- * @brief Pure virtual for returning the machine SN
+ * @brief Returns the machine serial number
*
* @return string - The machine serial number
*/
- virtual std::string getMachineSerialNumber() const = 0;
+ virtual std::string getMachineSerialNumber() const
+ {
+ return _machineSerialNumber;
+ }
+
+ protected:
+ /**
+ * @brief The machine type-model. Always kept up to date
+ */
+ std::string _machineTypeModel;
+
+ /**
+ * @brief The machine serial number. Always kept up to date
+ */
+ std::string _machineSerialNumber;
};
/**
@@ -69,26 +86,6 @@ class DataInterface : public DataInterfaceBase
*/
explicit DataInterface(sdbusplus::bus::bus& bus);
- /**
- * @brief Returns the machine type/model value
- *
- * @return string - The machine Type/Model string
- */
- std::string getMachineTypeModel() const override
- {
- return _machineTypeModel;
- }
-
- /**
- * @brief Returns the machine SN
- *
- * @return string - The machine serial number
- */
- std::string getMachineSerialNumber() const override
- {
- return _machineSerialNumber;
- }
-
private:
/**
* @brief Reads the machine type/model and SN from D-Bus.
@@ -131,16 +128,6 @@ class DataInterface : public DataInterfaceBase
void sysAssetPropChanged(sdbusplus::message::message& msg);
/**
- * @brief The machine type-model. Always kept up to date
- */
- std::string _machineTypeModel;
-
- /**
- * @brief The machine serial number. Always kept up to date
- */
- std::string _machineSerialNumber;
-
- /**
* @brief The match object for the system path's properties
*/
std::unique_ptr<sdbusplus::bus::match_t> _sysInventoryPropMatch;
OpenPOWER on IntegriCloud