12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #ifndef OPENCV_GAPI_STREAMING_SOURCE_HPP
- #define OPENCV_GAPI_STREAMING_SOURCE_HPP
- #include <memory> // shared_ptr
- #include <type_traits> // is_base_of
- #include <opencv2/gapi/gmetaarg.hpp> // GMetaArg
- namespace cv {
- namespace gapi {
- namespace wip {
- struct Data;
- class IStreamSource: public std::enable_shared_from_this<IStreamSource>
- {
- public:
- using Ptr = std::shared_ptr<IStreamSource>;
- Ptr ptr() { return shared_from_this(); }
- virtual bool pull(Data &data) = 0;
- virtual GMetaArg descr_of() const = 0;
- virtual void halt() {
-
-
-
- };
- virtual ~IStreamSource() = default;
- };
- template<class T, class... Args>
- IStreamSource::Ptr inline make_src(Args&&... args)
- {
- static_assert(std::is_base_of<IStreamSource, T>::value,
- "T must implement the cv::gapi::IStreamSource interface!");
- auto src_ptr = std::make_shared<T>(std::forward<Args>(args)...);
- return src_ptr->ptr();
- }
- }
- }
- }
- #endif
|