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_HANDLER_H 17 #define I_HANDLER_H 18 19 #include "plugin/i_plugin.h" 20 #include "protocol/data_channel/include/i_request.h" 21 #include "protocol/data_channel/include/i_response.h" 22 #include "server_executor/include/task.h" 23 #include "utils/aie_macros.h" 24 25 namespace OHOS { 26 namespace AI { 27 class IHandler { 28 public: 29 virtual ~IHandler() = default; 30 31 /** 32 * Interface to process task, override by sync and async message handler. 33 * 34 * @param [in] task Task info need to be processed. 35 * @return Returns RETCODE_SUCCESS(0) if the operation is successful, returns a non-zero value otherwise. 36 */ 37 virtual int Process(const Task &task) = 0; 38 39 /** 40 * Set plugin algorithm, override by sync and async message handler. 41 * 42 * @param [in] pluginAlgorithm Algorithm handler. 43 */ 44 virtual void SetPluginAlgorithm(IPlugin *pluginAlgorithm) = 0; 45 }; 46 } // namespace AI 47 } // namespace OHOS 48 49 #endif // IHANDLER_H