CVB++ 14.0
SingleStreamHandler Class Reference

Handler object for a single stream. More...

#include <cvb/async/single_stream_handler.hpp>

Inherits MultiStreamHandler.

Static Public Member Functions

static std::unique_ptr< SingleStreamHandlerCreate (const Driver::StreamPtr &stream)
 Create a stream handler object. More...
 
- Static Public Member Functions inherited from MultiStreamHandler
static std::unique_ptr< MultiStreamHandlerCreate (const std::vector< Driver::StreamPtr > &streamVector)
 Create a stream handler object. More...
 

Protected Member Functions

virtual void HandleAsyncStream (const Driver::StreamPtr &stream)
 Asynchronously called for the registered stream. More...
 
virtual void HandleAsyncWaitResult (const Driver::StreamImagePtr &streamImage, WaitStatus waitStatus)
 Asynchronously called for an acquired images. More...
 
virtual void Setup (const Driver::StreamPtr &stream)
 Setup the stream for acquisition. More...
 
virtual void TearDown (const Driver::StreamPtr &stream) noexcept
 Tear down the stream after acquisition. More...
 
 SingleStreamHandler (const Driver::StreamPtr &stream)
 Creates a stream handler object. More...
 
StreamPtr Stream () const noexcept
 Get the stream associated with this handler. More...
 
- Protected Member Functions inherited from MultiStreamHandler
virtual void HandleAsyncStream (const std::vector< Driver::StreamPtr > &streamVector)
 Asynchronously called for all registered streams. More...
 
virtual void HandleAsyncWaitResult (const std::vector< Driver::WaitResult< Driver::StreamImage > > &waitResultVector)
 Asynchronously called for all acquired images. More...
 
virtual void Setup (const std::vector< Driver::StreamPtr > streamVector)
 Setup the streams for acquisition. More...
 
virtual void TearDown (const std::vector< Driver::StreamPtr > streamVector) noexcept
 Tear down the streams after acquisition. More...
 
virtual void HandleError (const std::exception &error) noexcept
 Handles standard exceptions in the acquisition thread. More...
 
virtual void Begin () noexcept
 Performs custom operations at the beginning of the acquisition thread. More...
 
virtual void End () noexcept
 Performs custom operations just before the end of the acquisition thread. More...
 
 MultiStreamHandler (const std::vector< Driver::StreamPtr > &streamVector)
 Creates a stream handler object. More...
 
std::vector< StreamPtr > StreamVector () const noexcept
 Get the streams associated with this handler. More...
 

Additional Inherited Members

- Public Member Functions inherited from MultiStreamHandler
void Run ()
 Start the handler. More...
 
bool TryFinish () noexcept
 Stop the handler. More...
 
void Finish ()
 Stop the handler. More...
 
bool IsActive () const noexcept
 Check if the acquisition thread is running. More...
 

Detailed Description

Handler object for a single stream.

This handler provides a convenient way to acquire images from a single stream within a dedicated thread.

For a multiple synchronous stream see MultiStreamHandler.

Examples
Cvb/QmlStreamDisplay Cvb/QtStreamDisplay
Examples
Cvb/QtStreamDisplayPair, Minos/QmlMinos, Movie2/QtMovie2, and ShapeFinder2/QtShapeFinder2.

Constructor & Destructor Documentation

◆ SingleStreamHandler()

SingleStreamHandler ( const Driver::StreamPtr stream)
inlineprotected

Creates a stream handler object.

Parameters
[in]streamStream to handle.
Exceptions
Anyexception derived from std::exception including CvbException.

Call this in a customized subclass to setup the handler.

Member Function Documentation

◆ Create()

static std::unique_ptr< SingleStreamHandler > Create ( const Driver::StreamPtr stream)
inlinestatic

Create a stream handler object.

Parameters
[in]streamStream to handle.
Returns
A stream handler object.
Exceptions
Anyexception derived from std::exception including CvbException.
Note
You must not destroy a stream handler that is currently running. In order to prevent that you may use a StreamHandlerGuard.
Examples
Cvb/QmlStreamDisplay, Cvb/QtStatisticsDisplay, and Cvb/QtStreamDisplay.

◆ HandleAsyncStream()

void HandleAsyncStream ( const Driver::StreamPtr stream)
inlineprotectedvirtual

Asynchronously called for the registered stream.

Parameters
[in]streamStream to handle (provided at creation).
Exceptions
Anyexception derived from std::exception including CvbException.

The default implementation just waits for the next image.

Attention
This method is called on a dedicated thread!
Examples
Minos/QmlMinos.

◆ HandleAsyncWaitResult()

void HandleAsyncWaitResult ( const Driver::StreamImagePtr streamImage,
WaitStatus  waitStatus 
)
inlineprotectedvirtual

Asynchronously called for an acquired images.

Parameters
[in]streamImageThe image if wait was successful.
[in]waitStatusStatus for the wait operation.
Exceptions
Anyexception derived from std::exception including CvbException. The default implementation does nothing.
Attention
This method is called on a dedicated thread!

◆ Setup()

void Setup ( const Driver::StreamPtr stream)
inlineprotectedvirtual

Setup the stream for acquisition.

Parameters
[in]streamStream to handle (provided at creation).
Exceptions
Anyexception derived from std::exception including CvbException.

The default implementation just calls Stream::Start().

◆ Stream()

StreamPtr Stream ( ) const
inlineprotectednoexcept

Get the stream associated with this handler.

Returns
Associated stream.
Exceptions
Doesnot throw any exception.

◆ TearDown()

void TearDown ( const Driver::StreamPtr stream)
inlineprotectedvirtualnoexcept

Tear down the stream after acquisition.

Parameters
[in]streamStream to handle (provided at creation).
Exceptions
Anyexception derived from std::exception including CvbException.

The default implemntation just calls Stream::TryAbort().