Yong Hong | cc48189 | 2019-05-16 20:26:05 +0800 | [diff] [blame] | 1 | /* 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 Hong | 85a4dff | 2019-05-25 04:22:47 +0800 | [diff] [blame] | 11 | #include <string> |
| 12 | #include <vector> |
| 13 | |
| 14 | #include <google/protobuf/descriptor.h> |
| 15 | |
Yong Hong | cc48189 | 2019-05-16 20:26:05 +0800 | [diff] [blame] | 16 | namespace hardware_verifier { |
| 17 | |
| 18 | class VerifierImpl : public Verifier { |
| 19 | public: |
Yong Hong | 85a4dff | 2019-05-25 04:22:47 +0800 | [diff] [blame] | 20 | VerifierImpl(); |
| 21 | |
Yong Hong | cc48189 | 2019-05-16 20:26:05 +0800 | [diff] [blame] | 22 | base::Optional<HwVerificationReport> Verify( |
| 23 | const runtime_probe::ProbeResult& probe_result, |
| 24 | const HwVerificationSpec& hw_verification_spec) const override; |
Yong Hong | 85a4dff | 2019-05-25 04:22:47 +0800 | [diff] [blame] | 25 | |
| 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 Hong | cc48189 | 2019-05-16 20:26:05 +0800 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | } // namespace hardware_verifier |
| 56 | |
| 57 | #endif // HARDWARE_VERIFIER_VERIFIER_IMPL_H_ |