gcall.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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) 2018 Intel Corporation
  6. #ifndef OPENCV_GAPI_GCALL_HPP
  7. #define OPENCV_GAPI_GCALL_HPP
  8. #include "opencv2/gapi/garg.hpp" // GArg
  9. #include "opencv2/gapi/gmat.hpp" // GMat
  10. #include "opencv2/gapi/gscalar.hpp" // GScalar
  11. #include "opencv2/gapi/garray.hpp" // GArray<T>
  12. namespace cv {
  13. struct GKernel;
  14. // The whole idea of this class is to represent an operation
  15. // which is applied to arguments. This is part of public API,
  16. // since it is what users should use to define kernel interfaces.
  17. class GAPI_EXPORTS GCall final
  18. {
  19. public:
  20. class Priv;
  21. explicit GCall(const GKernel &k);
  22. ~GCall();
  23. template<typename... Ts>
  24. GCall& pass(Ts&&... args)
  25. {
  26. setArgs({cv::GArg(std::move(args))...});
  27. return *this;
  28. }
  29. // A generic yield method - obtain a link to operator's particular GMat output
  30. GMat yield (int output = 0);
  31. GScalar yieldScalar(int output = 0);
  32. template<class T> GArray<T> yieldArray(int output = 0)
  33. {
  34. return GArray<T>(yieldArray(output));
  35. }
  36. // Internal use only
  37. Priv& priv();
  38. const Priv& priv() const;
  39. protected:
  40. std::shared_ptr<Priv> m_priv;
  41. void setArgs(std::vector<GArg> &&args);
  42. // Public version returns a typed array, this one is implementation detail
  43. detail::GArrayU yieldArray(int output = 0);
  44. };
  45. } // namespace cv
  46. #endif // OPENCV_GAPI_GCALL_HPP