blob: 465f41480a7f4d98204a71804c5159f3055ccad2 [file] [log] [blame]
SunnySrivastava1984c743d822020-04-27 05:49:22 -05001#pragma once
2
SunnySrivastava1984bca5aaa2020-04-21 05:31:04 -05003#include "types.hpp"
4
SunnySrivastava1984c743d822020-04-27 05:49:22 -05005namespace openpower
6{
7namespace vpd
8{
9namespace manager
10{
11namespace reader
12{
13
14/** @class ReaderImpl
15 * @brief Implements functionalities related to reading of VPD related data
16 * from the system.
SunnySrivastava1984c743d822020-04-27 05:49:22 -050017 */
18class ReaderImpl
19{
20 public:
21 ReaderImpl() = default;
22 ReaderImpl(const ReaderImpl&) = delete;
23 ReaderImpl& operator=(const ReaderImpl&) = delete;
24 ReaderImpl(ReaderImpl&&) = delete;
25 ReaderImpl& operator=(ReaderImpl&&) = delete;
26 ~ReaderImpl() = default;
SunnySrivastava1984bca5aaa2020-04-21 05:31:04 -050027
28 /** @brief An API to expand a given unexpanded location code.
29 * @param[in] locationCode - unexpanded location code.
30 * @param[in] nodeNumber - node on which we are looking for location code.
31 * @param[in] frusLocationCode - mapping of inventory path and location
32 * code.
33 * @return Expanded location code.
34 */
35 std::string getExpandedLocationCode(
36 const std::string& locationCode, const uint16_t& nodeNumber,
37 const inventory::LocationCodeMap& frusLocationCode) const;
38
SunnySrivastava19841356d7e2020-04-24 04:29:35 -050039 /** @brief An api to get list of all the FRUs at the given location code
40 * @param[in] - location code in unexpanded format
41 * @param[in] - node number
42 * @param[in] - mapping of location code and Inventory path
43 * @return list of Inventory paths at the given location
44 */
45 inventory::ListOfPaths getFrusAtLocation(
46 const std::string& locationCode, const uint16_t& nodeNumber,
47 const inventory::LocationCodeMap& frusLocationCode) const;
48
49 private:
50 /** @brief An api to check validity of location code
51 * @param[in] - location code
52 * @return true/false based on validity check
53 */
54 bool isValidLocationCode(const std::string& locationCode) const;
55
SunnySrivastava1984c743d822020-04-27 05:49:22 -050056}; // class ReaderImpl
57
58} // namespace reader
59} // namespace manager
60} // namespace vpd
SunnySrivastava19841356d7e2020-04-24 04:29:35 -050061} // namespace openpower