blob: cee24e5282352dc998ee3bc3e95ccf6a24cfe16c [file] [log] [blame]
Yong Hongcc481892019-05-16 20:26:05 +08001/* Copyright 2019 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6#ifndef HARDWARE_VERIFIER_VERIFIER_IMPL_H_
7#define HARDWARE_VERIFIER_VERIFIER_IMPL_H_
8
9#include "hardware_verifier/verifier.h"
10
Yong Hong85a4dff2019-05-25 04:22:47 +080011#include <string>
12#include <vector>
13
14#include <google/protobuf/descriptor.h>
15
Yong Hongcc481892019-05-16 20:26:05 +080016namespace hardware_verifier {
17
18class VerifierImpl : public Verifier {
19 public:
Yong Hong85a4dff2019-05-25 04:22:47 +080020 VerifierImpl();
21
Yong Hongcc481892019-05-16 20:26:05 +080022 base::Optional<HwVerificationReport> Verify(
23 const runtime_probe::ProbeResult& probe_result,
24 const HwVerificationSpec& hw_verification_spec) const override;
Yong Hong85a4dff2019-05-25 04:22:47 +080025
26 private:
27 struct CompCategoryInfo {
28 // Enum value of of this category.
29 int enum_value;
30
31 // Enum name of this category.
32 std::string enum_name;
33
34 // The field descriptor of the component list in
35 // |runtime_probe::ProbeResult|.
36 const google::protobuf::FieldDescriptor* probe_result_comp_field;
37
38 // The field descriptor of the component name in
39 // |runtime_probe::ProbeResult|.
40 const google::protobuf::FieldDescriptor* probe_result_comp_name_field;
41
42 // The field descriptor of the component values in
43 // |runtime_probe::ProbeResult|.
44 const google::protobuf::FieldDescriptor* probe_result_comp_values_field;
45
46 // The field descriptor of the component values in |HwVerificationReport|.
47 const google::protobuf::FieldDescriptor* report_comp_values_field;
48 };
49
50 // An array that records each component category's related info like enum
51 // value and name.
52 std::vector<CompCategoryInfo> comp_category_infos_;
Yong Hongcc481892019-05-16 20:26:05 +080053};
54
55} // namespace hardware_verifier
56
57#endif // HARDWARE_VERIFIER_VERIFIER_IMPL_H_