Skip to content

Commit

Permalink
add FD_C_CreateOneDimOCRResult/FD_C_DestroyOneDimOCRResult for capi
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoII committed Apr 19, 2024
1 parent 77dde5b commit 235cf56
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions c_api/fastdeploy_capi/vision/result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,20 @@ void FD_C_DestroyOCRResult(__fd_take FD_C_OCRResult* fd_c_ocr_result) {
delete fd_c_ocr_result;
}

FD_C_OneDimOCRResult* FD_C_CreateOneDimOCRResult() {
FD_C_OneDimOCRResult* fd_c_one_dim_ocr_result =
new FD_C_OneDimOCRResult();
return fd_c_one_dim_ocr_result;
}

void FD_C_DestroyOneDimOCRResult(
__fd_take FD_C_OneDimOCRResult* fd_c_one_dim_ocr_result) {
for (int i = 0; i < fd_c_one_dim_ocr_result->size; i++) {
FD_C_DestroyOCRResult(fd_c_one_dim_ocr_result->data + i);
}
delete[] fd_c_one_dim_ocr_result->data;
}

void FD_C_OCRResultWrapperToCResult(
__fd_keep FD_C_OCRResultWrapper* fd_c_ocr_result_wrapper,
__fd_keep FD_C_OCRResult* fd_c_ocr_result) {
Expand Down
14 changes: 14 additions & 0 deletions c_api/fastdeploy_capi/vision/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,25 @@ FD_C_CreateOCRResult();
FASTDEPLOY_CAPI_EXPORT extern void FD_C_DestroyOCRResult(
__fd_take FD_C_OCRResult* fd_c_ocr_result);

/** \brief Create a new FD_C_OneDimOCRResult object
*
* \return Return a pointer to FD_C_OneDimOCRResult object
*/
FASTDEPLOY_CAPI_EXPORT extern __fd_give FD_C_OneDimOCRResult* FD_C_CreateOneDimOCRResult();

/** \brief Destroy a FD_C_OneDimOCRResult object
*
* \param[in] fd_c_one_dim_ocr_result pointer to FD_C_OneDimOCRResult object
*/

FASTDEPLOY_CAPI_EXPORT extern void
FD_C_DestroyOneDimOCRResult(__fd_take FD_C_OneDimOCRResult* fd_c_one_dim_ocr_result);
/** \brief Get a FD_C_OCRResult object from FD_C_OCRResultWrapper object
*
* \param[in] fd_c_ocr_result_wrapper pointer to FD_C_OCRResultWrapper object
* \param[out] fd_c_ocr_result pointer to FD_C_OCRResult object used to store data
*/

FASTDEPLOY_CAPI_EXPORT extern __fd_give void
FD_C_OCRResultWrapperToCResult(
__fd_keep FD_C_OCRResultWrapper* fd_c_ocr_result_wrapper,
Expand Down

0 comments on commit 235cf56

Please sign in to comment.