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_ENGINE_MANAGER_H
17 #define I_ENGINE_MANAGER_H
18 
19 #include <memory>
20 
21 #include "protocol/retcode_inner/aie_retcode_inner.h"
22 #include "protocol/struct_definition/aie_info_define.h"
23 #include "utils/aie_macros.h"
24 #include "utils/constants/constants.h"
25 #include "utils/log/aie_log.h"
26 
27 namespace OHOS {
28 namespace AI {
29 class IEngineManager {
30 public:
31     virtual ~IEngineManager() = default;
32 
33     /**
34      * Start engine.
35      *
36      * @param [in] transactionId Transaction ID.
37      * @param [in] algoInfo Algorithm information.
38      * @param [in] inputInfo Input parameters for starting the engine.
39      * @param [out] outputInfo Result information for starting the engine.
40      * @return Returns 0 if the operation is successful, returns a non-zero value otherwise.
41      */
42     virtual int StartEngine(long long transactionId, const AlgorithmInfo &algoInfo, const DataInfo &inputInfo,
43         DataInfo &outputInfo) = 0;
44 
45     /**
46      * Stop engine.
47      *
48      * @param [in] transactionId Transaction ID.
49      * @param [in] inputInfo Input parameters for stopping the engine.
50      * @return Returns 0 if the operation is successful, returns a non-zero value otherwise.
51      */
52     virtual int StopEngine(long long transactionId, const DataInfo &inputInfo) = 0;
53 
54     /**
55      * Set the configuration parameters of the plugin algorithm.
56      *
57      * @param [in] transactionId Transaction ID.
58      * @param [in] optionType The type of setting option.
59      * @param [in] inputInfo Configuration parameter needed to set up the plugin.
60      * @return Returns 0 if the operation is successful, returns a non-zero value otherwise.
61      */
62     virtual int SetOption(long long transactionId, int optionType, const DataInfo &inputInfo) = 0;
63 
64     /**
65      * Get the configuration parameters of the plugin algorithm.
66      *
67      * @param [in] transactionId Transaction ID.
68      * @param [in] optionType The type of getting option.
69      * @param [in] inputInfo Parameter information for getting options.
70      * @param [out] outputInfo The configuration parameter information.
71      * @return Returns 0 if the operation is successful, returns a non-zero value otherwise.
72      */
73     virtual int GetOption(long long transactionId, int optionType, const DataInfo &inputInfo,
74         DataInfo &outputInfo) = 0;
75 };
76 
77 IEngineManager *GetEngineManager();
78 
79 void ReleaseEngineManager();
80 } // namespace AI
81 } // namespace OHOS
82 
83 #endif // I_ENGINE_MANAGER_H