libvisiontransfer  5.2.0
Classes | Public Member Functions | List of all members
AsyncTransfer Class Reference

Class for asynchronous transfer of image pairs. More...

#include <visiontransfer/asynctransfer.h>


class  Pimpl

Public Member Functions

 AsyncTransfer (ImageTransfer::OperationMode mode, const char *remoteAddress, const char *remoteService, const char *localAddress, const char *localService, int bufferSize=1048576, int maxUdpPacketSize=1472)
 Creates a new transfer object. More...
void sendImagePairAsync (const ImagePair &imagePair, bool deleteData)
 Starts an asynchronous transmission of the given image pair. More...
bool collectReceivedImagePair (ImagePair &imagePair, double timeout=-1)
 Collects the asynchronously received image. More...

Detailed Description

Class for asynchronous transfer of image pairs.

This class opens a network socket for delivering or receiving image pairs. All operations are performed asynchronously, which means that they do not block. The class encapsulates ImageTransfer.

Definition at line 29 of file asynctransfer.h.

Constructor & Destructor Documentation

AsyncTransfer::AsyncTransfer ( ImageTransfer::OperationMode  mode,
const char *  remoteAddress,
const char *  remoteService,
const char *  localAddress,
const char *  localService,
int  bufferSize = 1048576,
int  maxUdpPacketSize = 1472 

Creates a new transfer object.

modeThe transfer mode. This determines which network protocol to use, and whether to operate in server or client mode.
remoteAddressAddress of the remote host. In TCP server mode this parameter can be set to a null pointer.
remoteServiceThe remote port number as string or as textual service name. In TCP server mode this parameter can be set to a null pointer.
localAddressLocal interface address that is used for communication. If set to a null pointer, the default interface is used.
localServiceThe local port number as string or a textual service name. If set to a null pointer an automatically assigned port number is used.
bufferSizeBuffer size for sending / receiving network data.
maxUdpPacketSizeMaximum allowed size of a UDP packet when sending data.

Please see ImageTransfer::ImageTransfer() for further details.

Definition at line 96 of file asynctransfer.cpp.

Member Function Documentation

bool AsyncTransfer::collectReceivedImagePair ( ImagePair imagePair,
double  timeout = -1 

Collects the asynchronously received image.

imagePairThe received image pair.
timeoutThe maximum time in seconds for which to wait if no image pair has been received yet.
True if an image pair has been received before the timeout.

If no image pair has been received, this method might block or return false. Otherwise the returned image pair is valid until the next call.

If timeout is set to a value < 0, the function will block indefinitely. If timeout = 0, the function will return immediately, and if timeout is > 0 then the function will block for the given amount of time in seconds. The received image pair is only valid until the next call of collectReceivedImagePair().

Definition at line 109 of file asynctransfer.cpp.

void AsyncTransfer::sendImagePairAsync ( const ImagePair imagePair,
bool  deleteData 

Starts an asynchronous transmission of the given image pair.

imagePairThe image pair that shall be transmitted.
deleteDataIf set to true, the pointers to the pixel data that are contained in imagePair, will be deleted after the image pair has been transmitted.

If deleteData is set to false, the pixel data contained in imagePair must not be freed before the data has been transmitted. As transmission happens asynchronously, it is recommended to let AsyncTransfer delete the data pointers.

Definition at line 105 of file asynctransfer.cpp.

The documentation for this class was generated from the following files:
Nerian Vision Technologies