ezEngine  Milestone 7
ezDataTransfer Class Reference

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

#include <DataTransfer.h>

Public Member Functions

 ezDataTransfer ()
 By default the data transfer is deactivated.
 
 ~ezDataTransfer ()
 Deactivates the data transfer (sends this info via ezTelemetry).
 
void DisableDataTransfer ()
 Disables the data transfer. It will not show up in ezInspector anymore and calling Transfer() on it will be ignored.
 
void EnableDataTransfer (const char *szDataName)
 Enables the data transfer. It will show up with the given name in ezInspector.
 
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. More...
 

Private Member Functions

virtual void OnTransferRequest ()
 
void SendStatus ()
 
void Transfer (ezDataTransferObject &Object)
 The data in the given ezDataTransferObject is sent via ezTelemetry to all connected tools, which can then display or process it.
 

Static Private Member Functions

static void TelemetryMessage (void *pPassThrough)
 
static void TelemetryEventsHandler (const ezTelemetry::TelemetryEventData &e)
 
static void Initialize ()
 
static void SendAllDataTransfers ()
 

Private Attributes

bool m_bEnabled
 
bool m_bTransferRequested
 
ezString m_sDataName
 

Static Private Attributes

static bool s_bInitialized = false
 
static ezSet< ezDataTransfer * > s_AllTransfers
 

Friends

class ezDataTransferObject
 

Detailed Description

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

Data transfers can be used to allow an application to send large amounts of data to tools such as ezInspector, 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 ezDataTransfer object represents one logical group of data that will be sent all together. Each piece of data is represented by an ezDataTransferObject. E.g. each texture of a G-Buffer (diffuse, normals, depth) should be sent via one instance of ezDataTransferObject. Those instances of ezDataTransferObject are just created on demand and destroyed directly after, they do not need to be kept around.

The ezDataTransfer 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 ezDataTransfer object regularly whether IsTransferRequested() returns true. If so, the application should prepare all data by putting it into instances of ezDataTransferObject and then transferring them through the ezDataTransfer object via ezDataTransfer::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 ezInspector, if not done carefully.

Member Function Documentation

bool ezDataTransfer::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: