Pylon::CStreamGrabberProxyT#
Low Level API: The stream grabber class with parameter access methods. More…
#include <pylon/StreamGrabberProxy.h>
Inherits from Pylon::CNodeMapProxyT< TParams >, TParams
Public Functions#
Name | |
---|---|
virtual void | Attach(GenApi::INodeMap * pNodeMap, bool replace =false) Attach a pylon node map. |
virtual GenApi::INodeMap * | GetNodeMap() const Returns the pylon node map interface pointer. |
void | GetNodes(GenApi::NodeList_t & Nodes) const Retrieves all nodes in the node map. |
GenApi::INode * | GetNode(const GenICam::gcstring & Name) const Retrieves the node from the central map by Name. |
void | InvalidateNodes() const Invalidates all nodes. |
void | Poll(int64_t ElapsedTime) Fires nodes which have a polling time. |
CStreamGrabberProxyT() Creates a CStreamGrabberProxyT object that is not attached to a pylon stream grabber. Use the Attach() method to attach the pylon stream grabber. | |
CStreamGrabberProxyT(Pylon::IStreamGrabber * pStreamGrabber) Creates a CStreamGrabberProxyT object and attaches it to a pylon stream grabber. | |
virtual | ~CStreamGrabberProxyT() Destructor. |
virtual void | Attach(IStreamGrabber * pStreamGrabber) Attach a pylon stream grabber. |
virtual bool | IsAttached() const Checks if a pylon stream grabber is attached. |
virtual IStreamGrabber * | GetStreamGrabber() const Returns the pylon stream grabber interface pointer. |
void | Open() Opens the stream grabber. |
void | Close() Closes the stream grabber. |
bool | IsOpen() const Retrieve whether the stream grabber is open. |
StreamBufferHandle | RegisterBuffer(void * pBuffer, size_t bufferSize) Registers a buffer for subsequent use. |
const void * | DeregisterBuffer(StreamBufferHandle hStreamBuffer) Deregisters the buffer. |
void | PrepareGrab() Prepares grabbing. |
bool | IsStartAndStopStreamingMandatory() Returns true if the Stream Grabber requires calling StartStreamingIfMandatory() for operation. |
void | StartStreamingIfMandatory() Starts streaming for the stream grabber if this is mandatory for operation. |
void | StopStreamingIfMandatory() Stops streaming for the stream grabber if this is mandatory for operation. |
void | FinishGrab() Stops grabbing finally. |
void | QueueBuffer(StreamBufferHandle hStreamBuffer, const void * pContext =NULL) Enqueues a buffer in the input queue. |
void | FlushBuffersToOutput() Cancels grabbing the current buffer and flushes all buffers to the output queue. |
bool | RetrieveResult(GrabResult & Result) Retrieves one grab result from the output queue. |
WaitObject & | GetWaitObject() const Returns the result event object of the stream grabber. |
GenApi::INodeMap * | GetNodeMap() Returns the associated stream grabber parameters. |
Additional inherited members#
Public Functions inherited from Pylon::CNodeMapProxyT< TParams >
Name | |
---|---|
CNodeMapProxyT() Creates a CNodeMapProxyT object that is not attached to a node map. Use the Attach() method to attach the pylon node map. | |
CNodeMapProxyT(GenApi::INodeMap * pNodeMap) Creates a CNodeMapProxyT object and attaches it to a pylon node map. | |
virtual | ~CNodeMapProxyT() Destructor. |
Detailed Description#
Low Level API: The stream grabber class with parameter access methods.
Template Parameters:
- TParams The specific parameter class (auto generated from the parameter xml file)
See: [Accessing Parameters]
This is the base class for pylon stream grabber providing access to configuration parameters.
Public Functions Documentation#
function Attach#
Attach a pylon node map.
function GetNodeMap#
Returns the pylon node map interface pointer.
function GetNodes#
Retrieves all nodes in the node map.
function GetNode#
Retrieves the node from the central map by Name.
function InvalidateNodes#
Invalidates all nodes.
function Poll#
Fires nodes which have a polling time.
function CStreamGrabberProxyT#
Creates a CStreamGrabberProxyT object that is not attached to a pylon stream grabber. Use the Attach() method to attach the pylon stream grabber.
function CStreamGrabberProxyT#
Creates a CStreamGrabberProxyT object and attaches it to a pylon stream grabber.
function ~CStreamGrabberProxyT#
Destructor.
function Attach#
Attach a pylon stream grabber.
function IsAttached#
Checks if a pylon stream grabber is attached.
Reimplements: Pylon::CNodeMapProxyT::IsAttached
function GetStreamGrabber#
Returns the pylon stream grabber interface pointer.
function Open#
Opens the stream grabber.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The corresponding device is open.
- The stream grabber is closed.
Postcondition:
- The stream grabber is open.
- If the device is closed while the stream grabber is open, the stream grabber is closed automatically.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber is already open or prepared. The stream grabber remains in the same state after raising the exception in this case.
- Throws an exception if the stream grabber is closed and opening the stream grabber fails. The stream grabber remains closed after raising the exception.
function Close#
Closes the stream grabber.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Postcondition:
- Any running grab has been stopped by calling FinishGrab().
- The stream grabber is closed.
- All results waiting in the output queue are discarded.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
Does not throw C++ exceptions.
This method calls FinishGrab() automatically if needed.
function IsOpen#
Retrieve whether the stream grabber is open.
Return: Returns true if the stream grabber is open.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Thread Safety:
This method can be synchronized using an internal stream grabber lock.
Error Safety:
Does not throw C++ exceptions.
function RegisterBuffer#
Registers a buffer for subsequent use.
Parameters:
- pBuffer The pointer of the buffer that is to be used for grabbing e.g., for grabbing images.
- bufferSize The size of the provided buffer in bytes.
Return: Returns a handle for the registered buffer that can be used in subsequent calls.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- pBuffer must not be NULL.
- The buffer size must not exceed the value of the node map integer parameter MaxBufferSize specified when PrepareGrab was called.
- Less buffers are already registered than value of the node map integer parameter MaxNumBuffer specified when PrepareGrab was called.
- The stream grabber is prepared, see PrepareGrab().
- The buffer has not been registered already.
Postcondition:
- The buffer is registered.
- Transport Layer specific preparations have been executed e.g., locking the memory pages of the buffer.
- The buffer must not be freed while being registered.
- If the stream grabber requires the additional streaming state, streaming must not be started, see IsStartAndStopStreamingMandatory() and StartStreamingIfMandatory().
Thread Safety:
This method can be synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if registering the buffer fails. The buffer is not registered after raising an exception.
function DeregisterBuffer#
Deregisters the buffer.
Parameters:
- hStreamBuffer The handle of a buffer that has been provided by RegisterBuffer()
Return: Returns the pointer of the corresponding buffer.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The buffer is registered.
- The buffer is not queued. Either it has not been queued yet, see QueueBuffer(), or it has been retrieved after grabbing using RetrieveResult().
- FinishGrab() or Close() have not been called for the grab session yet.
- If the stream grabber requires the additional streaming state, streaming must not be started, see IsStartAndStopStreamingMandatory() and StartStreamingIfMandatory().
Postcondition:
- Transport layer-specific preparations have been reversed.
- The buffer is deregistered.
- The buffer can be freed if needed e.g., by calling delete.
Error Safety:
Throws an exception if deregistering the buffer fails.
function PrepareGrab#
Prepares grabbing.
Note
- Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
- pylon uses a pool of buffers with a fixed amount of buffers to grab images. This is required because certain preparations e.g., locking the buffer's memory pages, must be made by the driver to be able to grab images into a buffer. Thus, using a pool of buffers is much more efficient than allocating a new buffer for every grabbed image.
- There can be limitations depending on the transport layer technology used when using a large amount of buffers.
Precondition:
- The node map integer parameter MaxBufferSize is set, see GetNodeNap().
- The node map integer parameter MaxNumBuffer is set, see GetNodeNap().
- The stream grabber is open.
- No grab session is currently in progress.
Postcondition:
- Resources required for grabbing are allocated.
- The camera is set up for grabbing.
- Critical camera parameters, provided by IPylonDevice::GetNodeMap(), are locked.
- The stream grabber is prepared.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if preparing the stream grabber fails. The stream grabber is not prepared after raising the exception.
The node map integer parameters MaxBufferSize and MaxNumBuffer need to be set before calling PrepareGrab().
MaxNumBuffer should be set to the number of buffers you plan to use for grabbing. MaxBufferSize needs to be set according to the PayloadSize parameter of the camera device or the stream grabber. If the stream grabber provides a PayloadSize parameter, the MaxBufferSize must be at least the size reported by the stream grabber payload size. This is the case if for instance a frame grabber or additional preprocessing is used. If the stream grabber does not provide a PayloadSize parameter, the MaxBufferSize must be at least the size reported by the camera device PayloadSize parameter.
function IsStartAndStopStreamingMandatory#
Returns true if the Stream Grabber requires calling StartStreamingIfMandatory() for operation.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
Does not throw C++ exceptions.
function StartStreamingIfMandatory#
Starts streaming for the stream grabber if this is mandatory for operation.
Note
- Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
- This method has been added in pylon 6.0 for supporting CoaXPress. Prior implementations of pylon stream grabbers did not require calling start and stop streaming. The IsStartAndStopStreamingMandatory(), StartStreamingIfMandatory(), and StopStreamingIfMandatory() methods allow backward-compatible operation.
Precondition:
- The stream grabber is prepared.
Postcondition:
- If the stream grabber does not require StartStreamingIfMandatory(), nothing is done.
- Streaming is started. For GenTL-based stream grabbers DSStartAcquistion is called
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if start streaming fails. The stream grabber is not streaming after raising the exception.
Some stream grabbers e.g., some stream grabbers based on GenTL, have limitations on when buffers can be registered. For these stream grabbers it is mandatory to register all buffers first and call StartStreamingIfMandatory() aftwards. Between the StartStreamingIfMandatory() and StopStreamingIfMandatory() calls no buffers can be registered or deregistered if such a limitation exists.
function StopStreamingIfMandatory#
Stops streaming for the stream grabber if this is mandatory for operation.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The stream grabber is in streaming mode if start and stop streaming is mandatory.
Postcondition:
- If the stream grabber does not require StopStreamingIfMandatory(), nothing is done.
- Streaming is stopped. For GenTL-based stream grabbers DSStopAcquistion is called.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if stop streaming fails. The stream grabber is not streaming after raising the exception.
Some stream grabbers e.g., some stream grabbers based on GenTL, have limitations on when buffers can be registered. For these stream grabbers it is mandatory to call StopStreamingIfMandatory to be able to deregister buffer afterwards.
function FinishGrab#
Stops grabbing finally.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The stream grabber is prepared.
Postcondition:
- Resources required for grabbing are freed.
- The camera is not set up for grabbing anymore
- Critical camera parameters, provided by IPylonDevice::GetNodeMap(), are unlocked.
- The stream grabber is open.
- Queued buffers are available in the output queue of the stream grabber and can be retrieved calling RetrieveResult().
- All buffers are deregistered.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if finishing the grab fails. The stream grabber is in open state after raising the exception.
This method calls FlushBuffersToOutput() automatically if needed.
function QueueBuffer#
Enqueues a buffer in the input queue.
Parameters:
- hStreamBuffer The handle of a buffer that has been provided by RegisterBuffer().
- pContext A user-provided pointer passed along with buffer in the internal input and output queues.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The buffer is registered, see RegisterBuffer().
- The stream grabber is prepared.
- The buffer has not been queued for grabbing yet.
- The buffer is not waiting in the output queue of the stream grabber. The buffer can be queued again after it has been retrieved using RetrieveResult().
Postcondition:
- The buffer is queued to input queue of the stream grabber.
- The buffer cannot be deregistered until it has been retrieved using RetrieveResult().
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if queuing the buffer fails.
function FlushBuffersToOutput#
Cancels grabbing the current buffer and flushes all buffers to the output queue.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The stream grabber is prepared.
Postcondition:
- All queued buffers are placed in the output queue of the stream grabber and can be retrieved using RetrieveResult().
- Buffers that have not been grabbed completely before calling FlushBuffersToOutput are marked with the EGrabStatus Canceled.
- The stream grabber is prepared.
- Buffers can be queued again to continue grabbing.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if canceling the grab fails.
function RetrieveResult#
Retrieves one grab result from the output queue.
Return: Returns true when result was available.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Precondition:
- The stream grabber is open.
Postcondition:
- If a grab result was available, it has been removed from the ouput queue.
- The corresponding buffer can be queued again for grabbing.
Thread Safety:
This method is synchronized using an internal stream grabber lock.
Error Safety:
- Throws a LogicalErrorException if the stream grabber state does not match the preconditions.
- Throws an exception if retrieving the result fails. This does not change the stream grabber state.
param[out] grabResult The object the grab result data is returned in if true is returned. The grabResult
remains unchanged if false is returned.
function GetWaitObject#
Returns the result event object of the stream grabber.
Return: Returns the result event object of the stream grabber.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Thread Safety:
This method can be synchronized using an internal stream grabber lock.
Error Safety:
Does not throw C++ exceptions.
This object is associated with the output queue of the stream grabber. The event is signaled when output queue is non-empty.
function GetNodeMap#
Returns the associated stream grabber parameters.
Return: Returns the associated stream grabber parameters. The returned pointer is never NULL.
Note Basler recommends using one of the Instant Camera classes CBaslerUniversalInstantCamera or CInstantCamera for new projects. If you want to control which buffers are used for grabbing, you can use the Pylon::IBufferFactory.
Thread Safety:
This method can be synchronized using an internal stream grabber lock.
Error Safety:
Does not throw C++ exceptions.