CVB++ 15.0
Loading...
Searching...
No Matches
Stream Class Reference

The stream to send Images or other data. More...

#include <cvb/gevserver/stream.hpp>

Inherits StreamBase, and enable_shared_from_this< Stream >.

Public Member Functions

 Stream (const ServerBasePtr &parent)
 Creates the stream from the given parent server.
 
void Send (const ImagePtr &image, std::function< void(const ImagePtr &)> imageReleased)
 Sends the given image to the remote client.
 
bool TrySend (const ImagePtr &image, std::function< void(const ImagePtr &)> imageReleased)
 Tries to send the given image to the remote client.
 
void Send (const Image &image)
 Sends the given image to the remote client.
 
bool TrySend (const Image &image)
 Tries to sends the given image to the remote client.
 
void Send (const ImageBufferDescription &bufferDescription, void *basePtr, const std::size_t &bufferSize, std::function< void(void *)> bufferReleased)
 Sends the image at the given basePtr .
 
bool TrySend (const ImageBufferDescription &bufferDescription, void *basePtr, const std::size_t &bufferSize, std::function< void(void *)> bufferReleased)
 Tries to send the image at the given basePtr .
 
- Public Member Functions inherited from StreamBase
virtual bool IsRunning () const
 Gets whether this stream is running.
 
virtual std::int64_t ResendBuffersCount () const
 Gets the number of resend buffers.
 
virtual void SetResendBuffersCount (const std::int64_t &numBuffers)
 Sets the number of resend buffers.
 

Additional Inherited Members

- Protected Member Functions inherited from StreamBase
 StreamBase (const ServerBasePtr &parent)
 Creates the stream from the given parent server.
 

Detailed Description

The stream to send Images or other data.

Constructor & Destructor Documentation

◆ Stream()

Stream ( const ServerBasePtr & parent)
inlineexplicit

Creates the stream from the given parent server.

Parameters
parentParent server object.

Member Function Documentation

◆ Send() [1/3]

void Send ( const Image & image)
inline

Sends the given image to the remote client.

The given image must fit into the payload size set at creation/State::Configuration state.

Packet resend must be disabled (ResendBuffersCount is zero).

Parameters
imageImage to be sent.

The image will be copied to the resend buffer.

◆ Send() [2/3]

void Send ( const ImageBufferDescription & bufferDescription,
void * basePtr,
const std::size_t & bufferSize,
std::function< void(void *)> bufferReleased )
inline

Sends the image at the given basePtr .

The given image buffer must fit into the payload size set at creation/GevServerState::Configuration state.

If packet resend is enabled (ResendBuffersCount larger than zero), then the given image buffer must remain unchanged until bufferReleased has been called! In case packet resend is disabled bufferReleased will be called immediately.

Parameters
bufferDescriptionDescription of the image at basePtr .
basePtrAddress of the image buffer to send.
bufferSizeLength in bytes of the buffer at basePtr .
bufferReleasedMandatory delegate to be called when the given image buffer is not needed anymore for packet resend.

◆ Send() [3/3]

void Send ( const ImagePtr & image,
std::function< void(const ImagePtr &)> imageReleased )
inline

Sends the given image to the remote client.

The given image must fit into the payload size set at creation/GevServerState.Configuration state.

If packet resend is enabled (ResendBuffersCount larger than zero), then the given image must remain unchanged until imageReleased has been called! In case packet resend is disabled imageReleased will be called immediately.

Parameters
imageImage to be sent.
imageReleasedDelegate to be called when the given image is not needed anymore for packet resend. If null the image will be copied to the resend buffer.

◆ TrySend() [1/3]

bool TrySend ( const Image & image)
inline

Tries to sends the given image to the remote client.

The given image must fit into the payload size set at creation/State::Configuration state.

Packet resend must be disabled (ResendBuffersCount is zero).

Parameters
imageImage to be sent.

The image will be copied to the resend buffer.

Returns
true if successfully sent; false on any error. Parameter errors and disposed exception will still be thrown.

◆ TrySend() [2/3]

bool TrySend ( const ImageBufferDescription & bufferDescription,
void * basePtr,
const std::size_t & bufferSize,
std::function< void(void *)> bufferReleased )
inline

Tries to send the image at the given basePtr .

Parameters
bufferDescriptionDescription of the image at basePtr .
basePtrAddress of the image buffer to send.
bufferSizeLength in bytes of the buffer at basePtr .
bufferReleasedDelegate to be called when the given image buffer is not needed anymore for packet resend.
Returns
true if successfully sent; false on any error. Parameter errors and disposed exception will still be thrown.

◆ TrySend() [3/3]

bool TrySend ( const ImagePtr & image,
std::function< void(const ImagePtr &)> imageReleased )
inline

Tries to send the given image to the remote client.

The given image must fit into the payload size set at creation/GevServerState::Configuration state.

If packet resend is enabled (ResendBuffersCount larger than zero), then the given image must remain unchanged until imageReleased has been called! In case packet resend is disabled imageReleased will be called immediately.

Parameters
imageImage to be sent.
imageReleasedDelegate to be called when the given image is not needed anymore for packet resend. If null the image will be copied to the resend buffer.
Returns
true if successfully sent; false on any error. Parameter errors and disposed exception will still be thrown.