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