github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/opencv4/include/opencv2/gapi/gasync_context.hpp (about)

     1  // This file is part of OpenCV project.
     2  // It is subject to the license terms in the LICENSE file found in the top-level directory
     3  // of this distribution and at http://opencv.org/license.html.
     4  //
     5  // Copyright (C) 2019 Intel Corporation
     6  
     7  #ifndef OPENCV_GAPI_GASYNC_CONTEXT_HPP
     8  #define OPENCV_GAPI_GASYNC_CONTEXT_HPP
     9  
    10  #if !defined(GAPI_STANDALONE)
    11  #  include <opencv2/core/cvdef.h>
    12  #else   // Without OpenCV
    13  #  include <opencv2/gapi/own/cvdefs.hpp>
    14  #endif // !defined(GAPI_STANDALONE)
    15  
    16  #include <opencv2/gapi/own/exports.hpp>
    17  
    18  namespace cv {
    19  namespace gapi{
    20  
    21  /**
    22   * @brief This namespace contains experimental G-API functionality,
    23   * functions or structures in this namespace are subjects to change or
    24   * removal in the future releases. This namespace also contains
    25   * functions which API is not stabilized yet.
    26   */
    27  namespace wip {
    28  
    29  /**
    30   * @brief A class to group async requests to cancel them in a single shot.
    31   *
    32   * GAsyncContext is passed as an argument to async() and async_apply() functions
    33   */
    34  
    35  class GAPI_EXPORTS GAsyncContext{
    36      std::atomic<bool> cancelation_requested = {false};
    37  public:
    38      /**
    39       * @brief Start cancellation process for an associated request.
    40       *
    41       * User still has to wait for each individual request (either via callback or according std::future object) to make sure it actually canceled.
    42       *
    43       * @return true if it was a first request to cancel the context
    44       */
    45      bool cancel();
    46  
    47      /**
    48      * @brief Returns true if cancellation was requested for this context.
    49      *
    50      * @return true if cancellation was requested for this context
    51      */
    52      bool isCanceled() const;
    53  };
    54  
    55  class GAPI_EXPORTS GAsyncCanceled : public std::exception {
    56  public:
    57      virtual const char* what() const noexcept CV_OVERRIDE;
    58  };
    59  } // namespace wip
    60  } // namespace gapi
    61  } // namespace cv
    62  
    63  #endif //OPENCV_GAPI_GASYNC_CONTEXT_HPP