diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-12-18 13:45:05 -0600 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2020-02-14 19:15:42 +0000 |
commit | 7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5 (patch) | |
tree | 833e3a29e9fe024b618b88b4fa4b44ecd6265b9e /extensions/openpower-pels | |
parent | 6aae6a0caee074b65f4eb935677f207bf9acb841 (diff) | |
download | phosphor-logging-7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5.tar.gz phosphor-logging-7ae2fa69f2bd15cbd22be54aeefbb49d3ad06fc5.zip |
PEL: Allow adding to AdditionalData
Add an interface to add a key/value pair to the data stored in
the AdditionalData class. Also add an interface to get to the
raw underlying map of data.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I61200f92b45be8e86992d3f4888698d6a5bbe251
Diffstat (limited to 'extensions/openpower-pels')
-rw-r--r-- | extensions/openpower-pels/additional_data.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/extensions/openpower-pels/additional_data.hpp b/extensions/openpower-pels/additional_data.hpp index f133e0f..ca4a47d 100644 --- a/extensions/openpower-pels/additional_data.hpp +++ b/extensions/openpower-pels/additional_data.hpp @@ -37,7 +37,7 @@ class AdditionalData * @param[in] ad - the AdditionalData property vector with * entries of "KEY=VALUE" */ - AdditionalData(const std::vector<std::string>& ad) + explicit AdditionalData(const std::vector<std::string>& ad) { for (auto& item : ad) { @@ -101,6 +101,27 @@ class AdditionalData return j; } + /** + * @brief Returns the underlying map of data + * + * @return const std::map<std::string, std::string>& - The data + */ + const std::map<std::string, std::string>& getData() const + { + return _data; + } + + /** + * @brief Adds a key/value pair to the object + * + * @param[in] key - The key + * @param[in] value - The value + */ + void add(const std::string& key, const std::string& value) + { + _data.emplace(key, value); + } + private: /** * @brief a map of keys to values |