1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef I_REQUEST_H 17 #define I_REQUEST_H 18 19 #include "protocol/retcode_inner/aie_retcode_inner.h" 20 #include "protocol/struct_definition/aie_info_define.h" 21 #include "utils/aie_macros.h" 22 23 namespace OHOS { 24 namespace AI { 25 class IRequest { 26 FORBID_COPY_AND_ASSIGN(IRequest); 27 FORBID_CREATE_BY_SELF(IRequest); 28 public: 29 /** 30 * Plugins prohibit the use of new, so add a create method here. 31 * 32 * @return A request object. 33 */ 34 static IRequest *Create(); 35 36 /** 37 * Destroy request method. 38 * 39 * @param [in,out] request Destroyed request object. 40 */ 41 static void Destroy(IRequest *&request); 42 43 /** 44 * Get request Id. 45 * 46 * @return Request Id. 47 */ 48 int GetRequestId() const; 49 50 /** 51 * Set request Id. 52 * 53 * @param [in] requestId Request Id. 54 */ 55 void SetRequestId(int requestId); 56 57 /** 58 * Get request operation Id. 59 * Operation Id indicates which plugin algorithm function to operate. 60 * 61 * @return Request operation Id. 62 */ 63 int GetOperationId() const; 64 65 /** 66 * Set request operation Id. 67 * 68 * @param [in] OperationId Operation Id. 69 */ 70 void SetOperationId(int OperationId); 71 72 /** 73 * Get client uid. 74 * 75 * @return Client uid. 76 */ 77 uid_t GetClientUid() const; 78 79 /** 80 * Set client uid. 81 * 82 * @param [in] Client uid. 83 */ 84 void SetClientUid(const uid_t clientUid); 85 86 /** 87 * Get request transaction Id. 88 * The transaction Id indicates which client the task is from. 89 * 90 * @return Request transaction Id. 91 */ 92 long long GetTransactionId() const; 93 94 /** 95 * Set request transaction Id. 96 * 97 * @param [in] transactionId Transaction Id. 98 */ 99 void SetTransactionId(long long transactionId); 100 101 /** 102 * Get algorithm plugin type. 103 * 104 * @return Algorithm plugin type. 105 */ 106 int GetAlgoPluginType() const; 107 108 /** 109 * Set algorithm plugin type. 110 * 111 * @param [in] type Algorithm plugin type. 112 */ 113 void SetAlgoPluginType(int type); 114 115 /** 116 * Get the message body carried by this request. 117 * 118 * @return Message. 119 */ 120 const DataInfo &GetMsg() const; 121 122 /** 123 * Get the message body carried by this request. 124 * 125 * @param [in] msg Message. 126 */ 127 void SetMsg(const DataInfo &msg); 128 }; 129 } // namespace AI 130 } // namespace OHOS 131 132 #endif // I_REQUEST_H 133