PCL
NetworkTransfer Event Handlers

Typedefs

using pcl::NetworkTransfer::download_event_handler = bool(Control::*)(NetworkTransfer &sender, const void *buffer, fsize_type size)
 
using pcl::NetworkTransfer::progress_event_handler = bool(Control::*)(NetworkTransfer &sender, fsize_type downloadTotal, fsize_type downloadCurrent, fsize_type uploadTotal, fsize_type uploadCurrent)
 
using pcl::NetworkTransfer::upload_event_handler = fsize_type(Control::*)(NetworkTransfer &sender, void *buffer, fsize_type maxSize)
 

Functions

void pcl::NetworkTransfer::OnDownloadDataAvailable (download_event_handler handler, Control &receiver)
 
void pcl::NetworkTransfer::OnTransferProgress (progress_event_handler handler, Control &receiver)
 
void pcl::NetworkTransfer::OnUploadDataRequested (upload_event_handler handler, Control &receiver)
 

Detailed Description

Typedef Documentation

◆ download_event_handler

using pcl::NetworkTransfer::download_event_handler = bool (Control::*)( NetworkTransfer& sender, const void* buffer, fsize_type size )

Defines the prototype of a download event handler.

A download event is generated when a NetworkTransfer instance receives data from a remote location, which is ready to be processed by the calling process.

Parameters
senderThe object that sends a download event.
bufferThe starting address of a contiguous block of data that has been downloaded. The handler function must not modify these data in any way.
sizeThe length in bytes of the buffer data block.

The handler returns true to continue the download operation. If it returns false, the operation will be aborted.

Definition at line 494 of file NetworkTransfer.h.

◆ progress_event_handler

using pcl::NetworkTransfer::progress_event_handler = bool (Control::*)( NetworkTransfer& sender, fsize_type downloadTotal, fsize_type downloadCurrent, fsize_type uploadTotal, fsize_type uploadCurrent )

Defines the prototype of a progress event handler.

A NetworkTransfer instance generates progress events at regular intervals during an active data transfer operation. Handling these events can be useful to provide feedback to the user during long download or upload procedures.

Parameters
senderThe object that sends a progress event.
downloadTotalTotal download size in bytes.
downloadCurrentSize of currently downloaded data in bytes.
uploadTotalTotal upload size in bytes.
uploadCurrentSize of currently uploaded data in bytes.

The handler returns true to continue the ongoing operation. If it returns false, the operation will be aborted.

Definition at line 551 of file NetworkTransfer.h.

◆ upload_event_handler

using pcl::NetworkTransfer::upload_event_handler = fsize_type (Control::*)( NetworkTransfer& sender, void* buffer, fsize_type maxSize )

Defines the prototype of an upload event handler.

An upload event is generated when a NetworkTransfer instance is ready to send new data to a remote location, which must be provided by the calling process.

Parameters
senderThe object that sends an upload event.
bufferThe starting address of a contiguous memory block where the data to be uploaded must be copied by the handler function.
maxSizeThe maximum length in bytes of the buffer data block. The handler function must not store more bytes than the value passed in this argument.

The handler returns an integer value, which will be interpreted as follows:

  • An integer greater than zero is the actual size in bytes of the contiguous block that has been copied back to the passed buffer. In this case the returned value must be less than or equal to maxSize.
  • Zero to finalize the upload operation.
  • A negative integer to abort the upload operation.

Definition at line 526 of file NetworkTransfer.h.

Function Documentation

◆ OnDownloadDataAvailable()

void pcl::NetworkTransfer::OnDownloadDataAvailable ( download_event_handler  handler,
Control receiver 
)

Sets the handler for download data available events generated by this NetworkTransfer object. These events are generated when the object receives data from a remote location, which is ready to be processed.

Parameters
handlerThe event handler. Must be a member function of the receiver object's class.
receiverThe control that will receive events from this object.

◆ OnTransferProgress()

void pcl::NetworkTransfer::OnTransferProgress ( progress_event_handler  handler,
Control receiver 
)

Sets the handler for transfer progress events generated by this NetworkTransfer object. These events are generated at regular intervals during an active data transfer operation.

Parameters
handlerThe event handler. Must be a member function of the receiver object's class.
receiverThe control that will receive events from this object.

◆ OnUploadDataRequested()

void pcl::NetworkTransfer::OnUploadDataRequested ( upload_event_handler  handler,
Control receiver 
)

Sets the handler for upload data requested events generated by this NetworkTransfer object. These events are generated when the object is ready to send new data to a remote location.

Parameters
handlerThe event handler. Must be a member function of the receiver object's class.
receiverThe control that will receive events from this object.