• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_DRIVER_HALCODEGEN_H_
18 #define VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_DRIVER_HALCODEGEN_H_
19 
20 #include <fstream>
21 #include <iostream>
22 #include <sstream>
23 #include <string>
24 
25 #include "test/vts/proto/ComponentSpecificationMessage.pb.h"
26 
27 #include "code_gen/driver/DriverCodeGenBase.h"
28 
29 using namespace std;
30 
31 namespace android {
32 namespace vts {
33 
34 
35 class HalCodeGen : public DriverCodeGenBase {
36  public:
HalCodeGen(const char * input_vts_file_path,const string & vts_name)37   HalCodeGen(const char* input_vts_file_path, const string& vts_name)
38       : DriverCodeGenBase(input_vts_file_path, vts_name) {}
39 
40  protected:
41   void GenerateCppBodyFuzzFunction(Formatter& out,
42       const ComponentSpecificationMessage& message,
43       const string& fuzzer_extended_class_name) override;
44 
45   void GenerateCppBodyGetAttributeFunction(Formatter& out,
46       const ComponentSpecificationMessage& message,
47       const string& fuzzer_extended_class_name) override;
48 
49   void GenerateCppBodyCallbackFunction(Formatter& out,
50       const ComponentSpecificationMessage& message,
51       const string& fuzzer_extended_class_name) override;
52 
53   void GenerateClassConstructionFunction(Formatter& out,
54       const ComponentSpecificationMessage& message,
55       const string& fuzzer_extended_class_name) override;
56 
57   void GenerateSubStructFuzzFunctionCall(Formatter& out,
58       const StructSpecificationMessage& message, const string& parent_path);
59 
60   void GenerateSubStructGetAttributeFunctionCall(Formatter& out,
61       const StructSpecificationMessage& message, const string& parent_path);
62 
63   void GenerateCppBodyFuzzFunction(Formatter& out,
64       const StructSpecificationMessage& message,
65       const string& fuzzer_extended_class_name,
66       const string& original_data_structure_name, const string& parent_path);
67 
68   void GenerateCppBodyGetAttributeFunction(Formatter& out,
69       const StructSpecificationMessage& message,
70       const string& fuzzer_extended_class_name,
71       const string& original_data_structure_name, const string& parent_path);
72 
73   // instance variable name (e.g., device_);
74   static const char* const kInstanceVariableName;
75 };
76 
77 }  // namespace vts
78 }  // namespace android
79 
80 #endif  // VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_DRIVER_HALCODEGEN_H_
81