blob: 3d47144dc9b3d58c903946bd9329bc0c85aec64a [file] [log] [blame]
#pragma once
#include "impl.hpp"
#include "parser_interface.hpp"
#include "types.hpp"
namespace openpower
{
namespace vpd
{
namespace memory
{
namespace parser
{
using ParserInterface = openpower::vpd::parser::interface::ParserInterface;
using kwdVpdMap = openpower::vpd::inventory::KeywordVpdMap;
class memoryVpdParser : public ParserInterface
{
public:
memoryVpdParser() = delete;
memoryVpdParser(const memoryVpdParser&) = delete;
memoryVpdParser& operator=(const memoryVpdParser&) = delete;
memoryVpdParser(memoryVpdParser&&) = delete;
memoryVpdParser& operator=(memoryVpdParser&&) = delete;
~memoryVpdParser() = default;
/**
* @brief Constructor
*
* Move kwVpdVector to parser object's kwVpdVector
*/
memoryVpdParser(Binary&& VpdVector) : memVpd(std::move(VpdVector))
{
}
/**
* @brief Parse the memory VPD binary data.
* Collects and emplace the keyword-value pairs in map.
*
* @return map of keyword:value
*/
std::variant<kwdVpdMap, Store> parse();
/**
* @brief An api to return interface name with respect to
* publish data on cache
*
* @return - Interface name for that vpd type.
*/
std::string getInterfaceName() const;
private:
/**
* @brief An api to read keywords.
*
* @return- map of kwd:value
*/
kwdVpdMap readKeywords(Binary::const_iterator iterator);
// vdp file to be parsed
Binary memVpd;
};
} // namespace parser
} // namespace memory
} // namespace vpd
} // namespace openpower