3#include "../../point_cloud.hpp"
4#include "../../driver/image_stream.hpp"
16 template <
class STREAMTYPE>
17 struct IsValidStreamImpl
19 static auto check(STREAMTYPE *) ->
decltype(std::is_base_of<CompositeStreamBase, STREAMTYPE>::value
20 || std::is_same<Stream, STREAMTYPE>::value,
22 static auto check(...) -> std::false_type;
25 template <
class STREAMTYPE>
26 struct IsValidStream :
public decltype(IsValidStreamImpl<STREAMTYPE>::check(nullptr)){};
31 template <class STREAMTYPE, typename std::enable_if_t<IsValidStream<STREAMTYPE>::value> * =
nullptr>
32 struct DeliverableTraits;
35 struct DeliverableTraits<ImageStream>
37 using type = MultiPartImage;
41 struct DeliverableTraits<CompositeStream>
43 using type = Composite;
47 struct DeliverableTraits<PointCloudStream>
49 using type = PointCloud;
53 struct DeliverableTraits<
Stream>
55 using type = StreamImage;
61 template <class STREAMTYPE, typename std::enable_if_t<IsValidStream<STREAMTYPE>::value> * =
nullptr>
65 using type = Driver::GenICamDevice;
69 struct DeviceTraits<
Stream>
76 template <class STREAMTYPE, typename std::enable_if_t<IsValidStream<STREAMTYPE>::value> * =
nullptr>
77 struct TpedStreamHandlerTraits
89 template <
class STREAMTYPE>
90 class StreamHandlerBase
241 const std::vector<
WaitResult<
typename Internal::DeliverableTraits<STREAMTYPE>::type>> &waitResultVector);
323 virtual void End() noexcept {}
353 return streamVector_;
90 class StreamHandlerBase {
…};
378 template <
class STREAMTYPE>
393 : streamHandler_(streamHandler)
395 assert((
"streamHandler must not be NULL", streamHandler));
396 if (!streamHandler->IsActive() && autoRun ==
AutoRun::Yes)
397 streamHandler->Run();
413 streamHandler_->TryFinish();
422 using Async::StreamHandlerBase;
425 using Async::StreamHandlerGuard;
Stream handler for synchronous streams.
Definition decl_stream_handler_base.hpp:91
std::shared_ptr< StreamType > StreamPtrType
Shorthand notation of the shared pointer of the specified stream.
Definition decl_stream_handler_base.hpp:98
bool TryFinish() noexcept
Stop the handler.
Definition detail_stream_handler_base.hpp:61
virtual void TearDown(const StreamVectorType streamVector) noexcept
Tear down the streams after acquisition.
Definition detail_stream_handler_base.hpp:172
std::vector< DeliverablePtrType > DeliverablePtrVectorType
Shorthand notation of the container of the stream deliverable shared pointers.
Definition decl_stream_handler_base.hpp:110
std::vector< StreamPtrType > StreamVector() const noexcept
Get the streams associated with this handler.
Definition decl_stream_handler_base.hpp:351
std::shared_ptr< typename Internal::DeliverableTraits< STREAMTYPE >::type > DeliverablePtrType
Shorthand notation of the shared pointer of the stream deliverable.
Definition decl_stream_handler_base.hpp:107
virtual void Begin() noexcept
Performs custom operations at the beginning of the acquisition thread.
Definition decl_stream_handler_base.hpp:312
virtual void HandleAsyncWaitResult(const std::vector< WaitResult< typename Internal::DeliverableTraits< STREAMTYPE >::type > > &waitResultVector)
Asynchronously called for all acquired images.
Definition detail_stream_handler_base.hpp:151
virtual void HandleAsyncWaitResult(const std::vector< WaitResultTuple< typename Internal::DeliverableTraits< STREAMTYPE >::type > > &waitResultVector)
Asynchronously called for all acquired images.
Definition detail_stream_handler_base.hpp:158
virtual void Setup(const StreamVectorType streamVector)
Setup the streams for acquisition.
Definition detail_stream_handler_base.hpp:165
std::vector< StreamPtrType > StreamVectorType
Shorthand notation of the container of the stream shared pointer.
Definition decl_stream_handler_base.hpp:101
StreamHandlerBase(const StreamPtrType &stream)
Creates a stream handler object.
Definition detail_stream_handler_base.hpp:185
static std::unique_ptr< StreamHandlerBase > Create(const StreamVectorType &streamVector)
Create a stream handler object.
Definition decl_stream_handler_base.hpp:128
void Run()
Start the handler.
Definition detail_stream_handler_base.hpp:48
virtual void End() noexcept
Performs custom operations just before the end of the acquisition thread.
Definition decl_stream_handler_base.hpp:323
std::vector< EventHandlerType > EventHandlerVectorType
Shorthand notation of the container of the event handler.
Definition decl_stream_handler_base.hpp:116
std::function< void(DeliverablePtrType, Cvb::WaitStatus)> EventHandlerType
Shorthand notation of the event handler, a callable, type.
Definition decl_stream_handler_base.hpp:113
StreamHandlerBase(const StreamVectorType &streamVector)
Creates a stream handler object.
Definition detail_stream_handler_base.hpp:194
bool IsActive() const noexcept
Definition decl_stream_handler_base.hpp:205
typename Internal::DeliverableTraits< STREAMTYPE >::type DeliverableType
Shorthand notation of the stream deliverable type of the specified stream.
Definition decl_stream_handler_base.hpp:104
virtual void HandleError(const std::exception &error) noexcept
Handles standard exceptions in the acquisition thread.
Definition detail_stream_handler_base.hpp:179
static std::unique_ptr< StreamHandlerBase > Create(const StreamPtrType &stream)
Create a stream handler object.
Definition decl_stream_handler_base.hpp:146
STREAMTYPE StreamType
Shorthand notation of the stream type.
Definition decl_stream_handler_base.hpp:95
virtual void HandleAsyncStream(const StreamVectorType &streamVector)
Asynchronously called for all registered streams.
Definition detail_stream_handler_base.hpp:131
Handler guard object to safely run and finish stream handlers.
Definition decl_stream_handler_base.hpp:380
StreamHandlerGuard(StreamHandlerBasePtr streamHandler, AutoRun autoRun=AutoRun::No) noexcept
Creates a stream handler guard object.
Definition decl_stream_handler_base.hpp:392
std::shared_ptr< StreamHandlerBase< STREAMTYPE > > StreamHandlerBasePtr
Shared pointer of the stream handler.
Definition decl_stream_handler_base.hpp:383
~StreamHandlerGuard()
Finishes the shared stream handler .
Definition decl_stream_handler_base.hpp:411
std::shared_ptr< StreamType > StreamPtrType
Definition decl_stream_handler_base.hpp:98
std::vector< StreamPtrType > StreamVectorType
Definition decl_stream_handler_base.hpp:101
Convenience classes for asynchronous image acquisition.
Definition decl_multi_stream_handler.hpp:11
AutoRun
Defines the auto run mode for the handler guard.
Definition async.hpp:63
@ Yes
Definition async.hpp:67
@ No
Definition async.hpp:71
std::shared_ptr< StreamHandlerBase< STREAMTYPE > > StreamHandlerBasePtr
Convenience shared pointer for GenericMultiStreamHandler.
Definition async.hpp:33
@ Stream
Definition driver.hpp:430
std::tuple< std::shared_ptr< T >, WaitStatus, NodeMapEnumerator > WaitResultTuple
Tuple holding multiple return values after waiting for a specific payload data.
Definition driver.hpp:577
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
WaitStatus
Status after waiting for an image to be returned.
Definition global.hpp:396
A combined result returned after waiting for a image.
Definition driver.hpp:391