Plasma Engine  2.0
Loading...
Searching...
No Matches
plDataTransfer Class Reference

A 'data transfer' is a blob of data that an application can send to connected tools such as plInspector upon request. More...

#include <DataTransfer.h>

Public Member Functions

 plDataTransfer ()
 By default the data transfer is deactivated.
 
virtual ~plDataTransfer ()
 Deactivates the data transfer (sends this info via plTelemetry).
 
void DisableDataTransfer ()
 Disables the data transfer. It will not show up in plInspector anymore and calling Transfer() on it will be ignored.
 
void EnableDataTransfer (plStringView sDataName)
 Enables the data transfer. It will show up with the given name in plInspector.
 
void RequestDataTransfer ()
 Sets the IsTransferRequested() state to true. Ignored if the data transfer is disabled.
 
bool IsTransferRequested (bool bReset=true)
 Returns whether the data transfer has been requested. Always returns false while the data transfer is disabled.
 

Friends

class plDataTransferObject
 

Detailed Description

A 'data transfer' is a blob of data that an application can send to connected tools such as plInspector upon request.

Data transfers can be used to allow an application to send large amounts of data to tools such as plInspector, which can then display or process them somehow. An example usage is to send a screenshot or the different textures of the G-Buffer for analysis. Or an application could send the current game state as one large text or binary document. The data transfer can contain any kind of data, however depending on its type, the connected tools may be able to display the data directly, or not. The plDataTransfer object represents one logical group of data that will be sent all together. Each piece of data is represented by an plDataTransferObject. E.g. each texture of a G-Buffer (diffuse, normals, depth) should be sent via one instance of plDataTransferObject. Those instances of plDataTransferObject are just created on demand and destroyed directly after, they do not need to be kept around.

The plDataTransfer instance, however, needs to be created once and then kept around as long as the data transfer should be possible. It is additionally necessary to enable the data transfer by calling EnableDataTransfer() once, which also specifies under which name the transfer appears in the connected tools.

At runtime the application needs to check every plDataTransfer object regularly whether IsTransferRequested() returns true. If so, the application should prepare all data by putting it into instances of plDataTransferObject and then transferring them through the plDataTransfer object via plDataTransfer::Transfer().

The tools can request a data transfer at any time, however they will not block for the result. Thus whether an application 'answers' or not, is not a problem, the application may just ignore the request. Similarly, the application may also 'push' out a data transfer, even when no data was requested. However, this can overload the network bandwidth or the computer that runs plInspector, if not done carefully.

Member Function Documentation

◆ IsTransferRequested()

bool plDataTransfer::IsTransferRequested ( bool bReset = true)

Returns whether the data transfer has been requested. Always returns false while the data transfer is disabled.

If bReset is set to false, the request state will not be reset, which can be used to 'peek' at the current state. By default the request state is reset to false afterwards, the application should answer the request.


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