11bd4fe43Sopenharmony_ci/*
21bd4fe43Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
31bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
41bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License.
51bd4fe43Sopenharmony_ci * You may obtain a copy of the License at
61bd4fe43Sopenharmony_ci *
71bd4fe43Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
81bd4fe43Sopenharmony_ci *
91bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
101bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
111bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and
131bd4fe43Sopenharmony_ci * limitations under the License.
141bd4fe43Sopenharmony_ci */
151bd4fe43Sopenharmony_ci
161bd4fe43Sopenharmony_ci#ifndef NNIE_ADAPTER_H
171bd4fe43Sopenharmony_ci#define NNIE_ADAPTER_H
181bd4fe43Sopenharmony_ci
191bd4fe43Sopenharmony_ci#include <cstdint>
201bd4fe43Sopenharmony_ci#include <cstdlib>
211bd4fe43Sopenharmony_ci
221bd4fe43Sopenharmony_ci#include "engine_adapter.h"
231bd4fe43Sopenharmony_ci
241bd4fe43Sopenharmony_cinamespace OHOS {
251bd4fe43Sopenharmony_cinamespace AI {
261bd4fe43Sopenharmony_ciclass NNIEAdapter : public EngineAdapter {
271bd4fe43Sopenharmony_cipublic:
281bd4fe43Sopenharmony_ci    NNIEAdapter();
291bd4fe43Sopenharmony_ci    virtual ~NNIEAdapter();
301bd4fe43Sopenharmony_ci
311bd4fe43Sopenharmony_ci    /* Initializes the algorithm and get the algorithm execution handle. */
321bd4fe43Sopenharmony_ci    int32_t Init(const char *modelPath, intptr_t &handle) override;
331bd4fe43Sopenharmony_ci
341bd4fe43Sopenharmony_ci    /* De-Initializes all the algorithms. */
351bd4fe43Sopenharmony_ci    int32_t Deinit() override;
361bd4fe43Sopenharmony_ci
371bd4fe43Sopenharmony_ci    /* Makes the model based on the given handle Inference once. */
381bd4fe43Sopenharmony_ci    int32_t Invoke(intptr_t handle) override;
391bd4fe43Sopenharmony_ci
401bd4fe43Sopenharmony_ci    /* Gets the inputBuffer and inputSize after the handle related model is initialized. */
411bd4fe43Sopenharmony_ci    int32_t GetInputAddr(intptr_t handle, uint16_t nodeId, uintptr_t &inputBuffer, size_t &inputSize) override;
421bd4fe43Sopenharmony_ci
431bd4fe43Sopenharmony_ci    /* Gets the outputBuffer and outputSize after the handle related model is initialized. */
441bd4fe43Sopenharmony_ci    int32_t GetOutputAddr(intptr_t handle, uint16_t nodeId, uintptr_t &outputBuffer, size_t &outputSize) override;
451bd4fe43Sopenharmony_ci
461bd4fe43Sopenharmony_ci    /* Releases the algorithm based on the given handle. */
471bd4fe43Sopenharmony_ci    int32_t ReleaseHandle(intptr_t handle) override;
481bd4fe43Sopenharmony_ci};
491bd4fe43Sopenharmony_ci} // namespace AI
501bd4fe43Sopenharmony_ci} // namespace OHOS
511bd4fe43Sopenharmony_ci#endif // NNIE_ADAPTER_H