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 /** 17 * @addtogroup ic_sdk 18 * @{ 19 * 20 * @brief Defines the development tool functions, constants, and error codes for image classification (IC). 21 * 22 * @since 2.2 23 * @version 1.0 24 */ 25 26 /** 27 * @file ic_callback.h 28 * 29 * @brief Defines the callback for processing errors and prediction results of image classification. 30 * 31 * @since 2.2 32 * @version 1.0 33 */ 34 35 #ifndef IC_CALLBACK_H 36 #define IC_CALLBACK_H 37 38 #include "ic_constants.h" 39 #include "ic_retcode.h" 40 41 namespace OHOS { 42 namespace AI { 43 class IcCallback { 44 public: 45 /** 46 * @brief Defines the destructor for the callback. 47 * 48 * @since 2.2 49 * @version 1.0 50 */ 51 virtual ~IcCallback() = default; 52 53 /** 54 * @brief Defines the callback for processing errors. 55 * 56 * @param errorCode Indicates the error code defined by {@link IcRetCode} for the image classification task. 57 * 58 * @since 2.2 59 * @version 1.0 60 */ 61 virtual void OnError(const IcRetCode errorCode) = 0; 62 63 /** 64 * @brief Defines the callback for prediction results. 65 * 66 * @param result Indicates the prediction result. 67 * 68 * @since 2.2 69 * @version 1.0 70 */ 71 virtual void OnResult(const IcOutput &result) = 0; 72 }; 73 } // namespace AI 74 } // namespace OHOS 75 76 #endif // IC_CALLBACK_H 77 /** @} */