Home | History | Annotate | Download | only in driver
      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 <string>
     21 
     22 #include "code_gen/driver/DriverCodeGenBase.h"
     23 #include "test/vts/proto/ComponentSpecificationMessage.pb.h"
     24 
     25 using namespace std;
     26 
     27 namespace android {
     28 namespace vts {
     29 
     30 
     31 class HalCodeGen : public DriverCodeGenBase {
     32  public:
     33   HalCodeGen(const char* input_vts_file_path)
     34       : DriverCodeGenBase(input_vts_file_path) {}
     35 
     36  protected:
     37   void GenerateCppBodyFuzzFunction(Formatter& out,
     38       const ComponentSpecificationMessage& message,
     39       const string& fuzzer_extended_class_name) override;
     40 
     41   void GenerateCppBodyGetAttributeFunction(Formatter& out,
     42       const ComponentSpecificationMessage& message,
     43       const string& fuzzer_extended_class_name) override;
     44 
     45   void GenerateCppBodyInterfaceImpl(
     46       Formatter& out, const ComponentSpecificationMessage& message,
     47       const string& fuzzer_extended_class_name) override;
     48 
     49   void GenerateClassConstructionFunction(Formatter& out,
     50       const ComponentSpecificationMessage& message,
     51       const string& fuzzer_extended_class_name) override;
     52 
     53   void GenerateSubStructFuzzFunctionCall(Formatter& out,
     54       const StructSpecificationMessage& message, const string& parent_path);
     55 
     56   void GenerateSubStructGetAttributeFunctionCall(Formatter& out,
     57       const StructSpecificationMessage& message, const string& parent_path);
     58 
     59   void GenerateCppBodyFuzzFunction(Formatter& out,
     60       const StructSpecificationMessage& message,
     61       const string& fuzzer_extended_class_name,
     62       const string& original_data_structure_name, const string& parent_path);
     63 
     64   void GenerateCppBodyGetAttributeFunction(Formatter& out,
     65       const StructSpecificationMessage& message,
     66       const string& fuzzer_extended_class_name,
     67       const string& original_data_structure_name, const string& parent_path);
     68 
     69   // instance variable name (e.g., device_);
     70   static const char* const kInstanceVariableName;
     71 };
     72 
     73 }  // namespace vts
     74 }  // namespace android
     75 
     76 #endif  // VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_DRIVER_HALCODEGEN_H_
     77