1/* 2 * Copyright (c) 2023 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 OHOS_HDI_NNRT_V2_0_PREPAREDMODELSTUB_H 17#define OHOS_HDI_NNRT_V2_0_PREPAREDMODELSTUB_H 18 19#include <ipc_object_stub.h> 20#include <message_option.h> 21#include <message_parcel.h> 22#include <object_collector.h> 23#include <refbase.h> 24#include "v2_0/iprepared_model.h" 25 26namespace OHOS { 27namespace HDI { 28namespace Nnrt { 29namespace V2_0 { 30 31using namespace OHOS; 32class PreparedModelStub : public IPCObjectStub { 33public: 34 explicit PreparedModelStub(const sptr<IPreparedModel> &impl); 35 virtual ~PreparedModelStub(); 36 37 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 38 39 static int32_t PreparedModelStubExportModelCache_(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption, sptr<OHOS::HDI::Nnrt::V2_0::IPreparedModel> impl); 40 41 static int32_t PreparedModelStubGetInputDimRanges_(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption, sptr<OHOS::HDI::Nnrt::V2_0::IPreparedModel> impl); 42 43 static int32_t PreparedModelStubRun_(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption, sptr<OHOS::HDI::Nnrt::V2_0::IPreparedModel> impl); 44 45 static int32_t PreparedModelStubGetVersion_(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption, sptr<OHOS::HDI::Nnrt::V2_0::IPreparedModel> impl); 46 47private: 48 int32_t PreparedModelStubExportModelCache(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption); 49 50 int32_t PreparedModelStubGetInputDimRanges(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption); 51 52 int32_t PreparedModelStubRun(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption); 53 54 int32_t PreparedModelStubGetVersion(MessageParcel& preparedModelData, MessageParcel& preparedModelReply, MessageOption& preparedModelOption); 55 56 57 static inline ObjectDelegator<OHOS::HDI::Nnrt::V2_0::PreparedModelStub, OHOS::HDI::Nnrt::V2_0::IPreparedModel> objDelegator_; 58 sptr<OHOS::HDI::Nnrt::V2_0::IPreparedModel> impl_; 59}; 60} // V2_0 61} // Nnrt 62} // HDI 63} // OHOS 64 65#endif // OHOS_HDI_NNRT_V2_0_PREPAREDMODELSTUB_H 66 67