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_PROFILER_HALHIDLPROFILERCODEGEN_H_ 18 #define VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_PROFILER_HALHIDLPROFILERCODEGEN_H_ 19 20 #include "code_gen/profiler/ProfilerCodeGenBase.h" 21 22 namespace android { 23 namespace vts { 24 /** 25 * Class that generates the profiler code for Hidl HAL. 26 */ 27 class HalHidlProfilerCodeGen : public ProfilerCodeGenBase { 28 public: HalHidlProfilerCodeGen(const std::string & input_vts_file_path)29 HalHidlProfilerCodeGen(const std::string& input_vts_file_path) 30 : ProfilerCodeGenBase(input_vts_file_path) {}; 31 32 protected: 33 virtual void GenerateProfilerForScalarVariable(Formatter& out, 34 const VariableSpecificationMessage& val, const std::string& arg_name, 35 const std::string& arg_value) override; 36 37 virtual void GenerateProfilerForStringVariable(Formatter& out, 38 const VariableSpecificationMessage& val, const std::string& arg_name, 39 const std::string& arg_value) override; 40 41 virtual void GenerateProfilerForEnumVariable(Formatter& out, 42 const VariableSpecificationMessage& val, const std::string& arg_name, 43 const std::string& arg_value) override; 44 45 virtual void GenerateProfilerForVectorVariable(Formatter& out, 46 const VariableSpecificationMessage& val, const std::string& arg_name, 47 const std::string& arg_value) override; 48 49 virtual void GenerateProfilerForArrayVariable(Formatter& out, 50 const VariableSpecificationMessage& val, const std::string& arg_name, 51 const std::string& arg_value) override; 52 53 virtual void GenerateProfilerForStructVariable(Formatter& out, 54 const VariableSpecificationMessage& val, const std::string& arg_name, 55 const std::string& arg_value) override; 56 57 virtual void GenerateProfilerForUnionVariable(Formatter& out, 58 const VariableSpecificationMessage& val, const std::string& arg_name, 59 const std::string& arg_value) override; 60 61 virtual void GenerateProfilerForHidlCallbackVariable(Formatter& out, 62 const VariableSpecificationMessage& val, const std::string& arg_name, 63 const std::string& arg_value) override; 64 65 virtual void GenerateProfilerForHidlInterfaceVariable(Formatter& out, 66 const VariableSpecificationMessage& val, const std::string& arg_name, 67 const std::string& arg_value) override; 68 69 virtual void GenerateProfilerForMaskVariable(Formatter& out, 70 const VariableSpecificationMessage& val, const std::string& arg_name, 71 const std::string& arg_value) override; 72 73 virtual void GenerateProfilerForHidlMemoryVariable(Formatter& out, 74 const VariableSpecificationMessage& val, const std::string& arg_name, 75 const std::string& arg_value) override; 76 77 virtual void GenerateProfilerForPointerVariable(Formatter& out, 78 const VariableSpecificationMessage& val, const std::string& arg_name, 79 const std::string& arg_value) override; 80 81 virtual void GenerateProfilerForFMQSyncVariable(Formatter& out, 82 const VariableSpecificationMessage& val, const std::string& arg_name, 83 const std::string& arg_value) override; 84 85 virtual void GenerateProfilerForFMQUnsyncVariable(Formatter& out, 86 const VariableSpecificationMessage& val, const std::string& arg_name, 87 const std::string& arg_value) override; 88 89 virtual void GenerateProfilerForMethod(Formatter& out, 90 const FunctionSpecificationMessage& method) override; 91 92 virtual void GenerateHeaderIncludeFiles(Formatter& out, 93 const ComponentSpecificationMessage& message) override; 94 virtual void GenerateSourceIncludeFiles(Formatter& out, 95 const ComponentSpecificationMessage& message) override; 96 void GenerateUsingDeclaration(Formatter& out, 97 const ComponentSpecificationMessage& message) override; 98 void GenerateMacros(Formatter& out, 99 const ComponentSpecificationMessage& message) override; 100 virtual void GenerateProfierSanityCheck(Formatter& out, 101 const ComponentSpecificationMessage& message) override; 102 virtual void GenerateLocalVariableDefinition(Formatter& out, 103 const ComponentSpecificationMessage& message) override; 104 105 private: 106 DISALLOW_COPY_AND_ASSIGN (HalHidlProfilerCodeGen); 107 }; 108 109 } // namespace vts 110 } // namespace android 111 #endif // VTS_COMPILATION_TOOLS_VTSC_CODE_GEN_PROFILER_HALHIDLPROFILERCODEGEN_H_ 112