Class Stream

Inheritance Relationships

Base Type

  • public std::enable_shared_from_this< Stream >

Class Documentation

class Stream : public std::enable_shared_from_this<Stream>

The stream class encapsulates a Genicam stream.

NOTE: A GenTLException is thrown in case of a severe error.

Public Functions

Stream(const std::shared_ptr<Device> &parent, const std::shared_ptr<const GenTLWrapper> &gentl, const char *id)

Constructs a stream class. Streams must only be created by the device class.

~Stream()
std::shared_ptr<Device> getParent() const

Returns the pointer to the parent device object.

Returns:

Pointer to parent device object.

const std::string &getID() const

Get the internal ID of this stream.

Returns:

ID.

void open()

Opens the stream for working with it. The stream may be opened multiple times. However, for each open(), the close() method must be called as well.

void close()

Closes the stream. Each call of open() must be followed by a call to close() at some point in time.

void attachBuffers(bool enable)

Enabling or disabling attaching the grabbed buffer to the remote device nodemap. This only has an effect if chunks are enabled (i.e. ChunkModeActive=true).

Parameters:

enable – Enables or disables attaching grabbed buffers to the nodemap.

void startStreaming(int nacquire = -1)

Allocates four buffers, registers internal events and starts streaming of nacquire buffers.

Parameters:

na – Number of buffers to acquire. Set <= 0 for infinity.

void startStreaming(int nacquire, int min_buffers)

Allocates the given minimum number of buffers, registers internal events and starts streaming of nacquire buffers.

Parameters:
  • na – Number of buffers to acquire. Set <= 0 for infinity.

  • min_buffers – Miminum number of buffers to allocate.

void stopStreaming()

Stops streaming.

int getAvailableBufferCount()

Returns the number ob buffers that are currently available for grabbing.

Returns:

Number of buffers, available for immediate grabbing.

const Buffer *grab(int64_t timeout = -1)

Wait for the next image or data and return it in a buffer object. The buffer is valid until the next call to grab.

Parameters:

timeout – Timeout in ms. A value < 0 sets waiting time to infinite.

Returns:

Pointer to received buffer or 0 in case of an error or interrupt.

uint64_t getNumDelivered()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of delivered buffers since last acquisition start.

uint64_t getNumUnderrun()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of lost buffers due to queue underrun.

size_t getNumAnnounced()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of announced buffers.

size_t getNumQueued()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of buffers in the input pool.

size_t getNumAwaitDelivery()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of buffers in the output queue.

uint64_t getNumStarted()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Number of buffers started in the acquisition engine.

size_t getPayloadSize()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Size of the expected data in bytes.

bool getIsGrabbing()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Flag indicating whether the acquisition engine is started or not.

bool getDefinesPayloadsize()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Flag that indicated that this data stream defines a payload size independent from the remote device.

std::string getTLType()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Transport layer technology that is supported.

size_t getNumChunksMax()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Max number of chunks in a buffer, if known.

size_t getBufAnnounceMin()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Min number of buffers to announce before acq can start, if known.

size_t getBufAlignment()

Returns some information about the stream.

NOTE: open() must have called before calling this method.

Returns:

Buffer alignment in bytes.

std::shared_ptr<GenApi::CNodeMapRef> getNodeMap()

Returns the node map of this object.

NOTE: open() must be called before calling this method. The returned pointer remains valid until close() of this object is called.

Returns:

Node map of this object.

void *getHandle() const

Get internal stream handle.

Returns:

Internal handle.