1 /* 2 * Copyright (c) Qualcomm Innovation Center, Inc. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 #pragma once 9 10 #include <executorch/backends/qualcomm/runtime/Logging.h> 11 12 #include <string> 13 #include <utility> 14 15 #include "QnnTypes.h" 16 namespace executorch { 17 namespace backends { 18 namespace qnn { 19 20 using executorch::runtime::Error; 21 22 class ParamWrapper { 23 public: 24 // Populate Qnn_Param_t. Return an error code Error::Ok if succeeded, 25 // Error::Internal if failed 26 virtual executorch::runtime::Error PopulateQnnParam() = 0; 27 virtual ~ParamWrapper() = default; 28 29 ParamWrapper(const ParamWrapper& rhs) = default; 30 ParamWrapper(ParamWrapper&& rhs) = default; 31 ParamWrapper& operator=(const ParamWrapper& rhs) = default; 32 ParamWrapper& operator=(ParamWrapper&& rhs) = default; 33 34 // Return value to internal Qnn param struct that will be 35 // populated with the parameter information GetQnnParam()36 Qnn_Param_t GetQnnParam() { 37 return qnn_param_; 38 } 39 GetName()40 const std::string& GetName() const { 41 return name_; 42 } 43 44 protected: ParamWrapper(Qnn_ParamType_t type,std::string name)45 explicit ParamWrapper(Qnn_ParamType_t type, std::string name) 46 : name_(std::move(name)) { 47 qnn_param_.paramType = type; 48 qnn_param_.name = name_.c_str(); 49 } 50 Qnn_Param_t qnn_param_ = QNN_PARAM_INIT; 51 52 private: 53 std::string name_; 54 }; 55 } // namespace qnn 56 } // namespace backends 57 } // namespace executorch 58