Diarkis C++Client Library API Document
DiarkisFieldBase Class Reference

Base class that wraps the IDiarkisField class for easy use of Field functionality. More...

#include <DiarkisFieldBase.h>

Collaboration diagram for DiarkisFieldBase:

Public Member Functions

 DiarkisFieldBase ()
 DiarkisFieldBase constructor. More...
 
virtual ~DiarkisFieldBase ()
 DiarkisFieldBase destructor. More...
 
virtual void SetupTcpField (const std::shared_ptr< IDiarkisTcp > &tcp, const std::shared_ptr< LoggerFactory > &loggerFactory)
 Set up Field with TCP protocol. More...
 
virtual void SetupUdpField (const std::shared_ptr< IDiarkisUdp > &udp, const std::shared_ptr< LoggerFactory > &loggerFactory)
 Setup Field with UDP protocol. More...
 
virtual void SendFieldJoin (int64_t x, int64_t y, int64_t z, const uint8_t *payload, size_t payloadSize, uint32_t syncLimit, uint32_t customFilterID, bool reliable)
 Join field. More...
 
virtual void SendFieldJoin (int64_t x, int64_t y, int64_t z, const std::vector< uint8_t > &payload, uint32_t syncLimit, uint32_t customFilterID, bool reliable)
 Same as SendFieldJoin() More...
 
virtual void SendFieldSync (int64_t x, int64_t y, int64_t z, const uint8_t *payload, size_t payloadSize, uint32_t syncLimit, uint32_t customFilterID, bool reliable)
 Sends data to other clients in the field. More...
 
virtual void SendFieldSync (int64_t x, int64_t y, int64_t z, const std::vector< uint8_t > &payload, uint32_t syncLimit, uint32_t customFilterID, bool reliable)
 Same as SendFieldSync() More...
 
virtual void SendFieldDisappear ()
 Notifies that this client is no longer visible to other clients. More...
 
virtual void SendFieldLeave ()
 Notify that you are leaving the field. More...
 

Protected Member Functions

virtual void OnJoin (const DiarkisSuccessEventArgs &e)
 Callback event called when joined a field. More...
 
virtual void OnSync (const Diarkis::StdVector< uint8_t > &payload)
 Callback event called when synchronizing the position of nearby clients in the field. More...
 
virtual void OnDisappear (const Diarkis::StdString &remoteUid)
 Callback event called when Disappear is received. More...
 
virtual void OnLeave (const DiarkisSuccessEventArgs &e)
 Response callback event called when exiting the Field. More...
 

Protected Attributes

std::shared_ptr< IDiarkisTcptcp_
 Pointer to the IDiarkisTcp class. More...
 
std::shared_ptr< IDiarkisUdpudp_
 Pointer to the IDiarkisUdp class. More...
 
std::shared_ptr< IDiarkisFieldfield_
 Pointer to the IDiarkisField class. More...
 
std::shared_ptr< IDiarkisLoggerlogger_
 Pointer to the IDiarkisLogger class. More...
 
Diarkis::StdVector< std::function< void()> > eventUnsubscriptions_
 Lambda functions list. More...
 
ConnectState fieldConnect_
 Field status. More...
 

Detailed Description

Base class that wraps the IDiarkisField class for easy use of Field functionality.

Constructor & Destructor Documentation

◆ DiarkisFieldBase()

DiarkisFieldBase::DiarkisFieldBase ( )

DiarkisFieldBase constructor.

Here is the call graph for this function:

◆ ~DiarkisFieldBase()

DiarkisFieldBase::~DiarkisFieldBase ( )
virtual

DiarkisFieldBase destructor.

Member Function Documentation

◆ SetupTcpField()

void DiarkisFieldBase::SetupTcpField ( const std::shared_ptr< IDiarkisTcp > &  tcp,
const std::shared_ptr< LoggerFactory > &  loggerFactory 
)
virtual

Set up Field with TCP protocol.

Register loggers and callback functions.

Parameters
[in]tcpPointer to IDiarkisTcp class
[in]loggerFactoryPointer to logger class
Here is the call graph for this function:

◆ SetupUdpField()

void DiarkisFieldBase::SetupUdpField ( const std::shared_ptr< IDiarkisUdp > &  udp,
const std::shared_ptr< LoggerFactory > &  loggerFactory 
)
virtual

Setup Field with UDP protocol.

Register loggers and callback functions.

Parameters
[in]udpPointer to IDiarkisUdp class
[in]loggerFactoryPointer to logger class
Here is the call graph for this function:

◆ SendFieldJoin() [1/2]

void DiarkisFieldBase::SendFieldJoin ( int64_t  x,
int64_t  y,
int64_t  z,
const uint8_t *  payload,
size_t  payloadSize,
uint32_t  syncLimit,
uint32_t  customFilterID,
bool  reliable 
)
virtual

Join field.

Callback events registered with GetJoinEvent() (e.g. OnJoin) will be triggered.

Parameters
[in]xValue of X coordinate in x field (width)
[in]yValue of Y coordinate in y field (depth)
[in]zValue of Z coordinate in z field (difference in spatial level, not height)
[in]payloadArray of data to send to other clients
[in]payloadSizeLength of the payload
[in]syncLimitnumber of synchronizations
[in]customFilterIDIndicates the use of a filter function defined by the server during synchronization.
0 indicates that the filter function is not used.
[in]reliableDetermines whether to send via reliable communication (RUDP); ignored for TCP protocol.
Here is the caller graph for this function:

◆ SendFieldJoin() [2/2]

void DiarkisFieldBase::SendFieldJoin ( int64_t  x,
int64_t  y,
int64_t  z,
const std::vector< uint8_t > &  payload,
uint32_t  syncLimit,
uint32_t  customFilterID,
bool  reliable 
)
virtual

Same as SendFieldJoin()

Here is the call graph for this function:

◆ SendFieldSync() [1/2]

void DiarkisFieldBase::SendFieldSync ( int64_t  x,
int64_t  y,
int64_t  z,
const uint8_t *  payload,
size_t  payloadSize,
uint32_t  syncLimit,
uint32_t  customFilterID,
bool  reliable 
)
virtual

Sends data to other clients in the field.

Callback events registered with GetSyncEvent() (e.g. OnSync) will be triggered.

Parameters
[in]xValue of X coordinate in field (width)
[in]yValue of Y coordinate in field (depth)
[in]zValue of Z coordinate in field (spatial difference, not height)
[in]payloadArray of data to send to other clients
[in]payloadSizeLength of the payload
[in]syncLimitNumber of synchronizations
[in]customFilterIDIndicates the use of a filter function defined by the server during synchronization.
0 indicates that the filter function is not used.
[in]reliableDetermines whether to send with reliable communication (RUDP) or not (UDP); ignored for the TCP protocol.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendFieldSync() [2/2]

void DiarkisFieldBase::SendFieldSync ( int64_t  x,
int64_t  y,
int64_t  z,
const std::vector< uint8_t > &  payload,
uint32_t  syncLimit,
uint32_t  customFilterID,
bool  reliable 
)
virtual

Same as SendFieldSync()

Here is the call graph for this function:

◆ SendFieldDisappear()

void DiarkisFieldBase::SendFieldDisappear ( )
virtual

Notifies that this client is no longer visible to other clients.

Triggers a callback event (e.g. OnDisappear) registered with GetDisappearEvent().

◆ SendFieldLeave()

void DiarkisFieldBase::SendFieldLeave ( )
virtual

Notify that you are leaving the field.

◆ OnJoin()

void DiarkisFieldBase::OnJoin ( const DiarkisSuccessEventArgs e)
protectedvirtual

Callback event called when joined a field.

Here is the call graph for this function:

◆ OnSync()

void DiarkisFieldBase::OnSync ( const Diarkis::StdVector< uint8_t > &  payload)
protectedvirtual

Callback event called when synchronizing the position of nearby clients in the field.

Parameters
[in]payloadPayload data
Here is the call graph for this function:

◆ OnDisappear()

void DiarkisFieldBase::OnDisappear ( const Diarkis::StdString remoteUid)
protectedvirtual

Callback event called when Disappear is received.

Parameters
[in]remoteUidUser ID of the member who disappeared

◆ OnLeave()

void DiarkisFieldBase::OnLeave ( const DiarkisSuccessEventArgs e)
protectedvirtual

Response callback event called when exiting the Field.

Here is the call graph for this function:

Member Data Documentation

◆ tcp_

std::shared_ptr<IDiarkisTcp> DiarkisFieldBase::tcp_
protected

Pointer to the IDiarkisTcp class.

◆ udp_

std::shared_ptr<IDiarkisUdp> DiarkisFieldBase::udp_
protected

Pointer to the IDiarkisUdp class.

◆ field_

std::shared_ptr<IDiarkisField> DiarkisFieldBase::field_
protected

Pointer to the IDiarkisField class.

◆ logger_

std::shared_ptr<IDiarkisLogger> DiarkisFieldBase::logger_
protected

Pointer to the IDiarkisLogger class.

◆ eventUnsubscriptions_

Diarkis::StdVector<std::function<void()> > DiarkisFieldBase::eventUnsubscriptions_
protected

Lambda functions list.

◆ fieldConnect_

ConnectState DiarkisFieldBase::fieldConnect_
protected

Field status.


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