Diarkis C++Client Library API Document
DiarkisDirectMessageBase Class Reference

Base class that wraps the IDiarkisDirectMessage class for easy use of DirectMessage functionality. More...

#include <DiarkisDirectMessageBase.h>

Collaboration diagram for DiarkisDirectMessageBase:

Public Member Functions

 DiarkisDirectMessageBase ()
 DiarkisDirectMessagecBase constructor. More...
 
virtual ~DiarkisDirectMessageBase ()
 DiarkisDirectMessageBase destructor. More...
 
virtual void SetupTcp (const std::shared_ptr< IDiarkisTcp > &tcp, const std::shared_ptr< LoggerFactory > &loggerFactory)
 Set up DirectMessage with the TCP protocol. More...
 
virtual void SetupUdp (const std::shared_ptr< IDiarkisUdp > &udp, const std::shared_ptr< LoggerFactory > &loggerFactory)
 Set up DirectMessage with UDP protocol. More...
 
virtual void Disconnect (const char *uid, const uint8_t *message, size_t messageSize)
 Disconnects from the specified user via direct message and sends a custom message. More...
 
virtual void Disconnect (const std::string &uid, const std::vector< uint8_t > &message)
 Same as Diconnect() More...
 
virtual void Send (const char *uid, const uint8_t *message, size_t messageSize)
 Sends a direct message to the specified user. More...
 
virtual void Send (const std::string &uid, const std::vector< uint8_t > &message)
 Same as Send() More...
 
virtual void RSend (const char *uid, const uint8_t *message, size_t messageSize)
 Sends a direct message to the specified user using reliable communications. More...
 
virtual void RSend (const std::string &uid, const std::vector< uint8_t > &message)
 Same as RSend() More...
 

Protected Member Functions

virtual void OnDisconnect (const DiarkisDirectMessageEventArgs &e)
 Callback function called when a direct message is disconnected. More...
 
virtual void OnMessage (const DiarkisDirectMessageEventArgs &e)
 Callback function triggered when a direct message from another user is received. More...
 

Protected Attributes

std::shared_ptr< IDiarkisDirectMessagedm_
 Pointer to IDiarkisDirectMessage class. More...
 
std::shared_ptr< IDiarkisLoggerlogger_
 Pointer to IDiarkisLogger class. More...
 
Diarkis::StdVector< std::function< void()> > eventUnsubscriptions_
 Lambda functions list. More...
 

Detailed Description

Base class that wraps the IDiarkisDirectMessage class for easy use of DirectMessage functionality.

Constructor & Destructor Documentation

◆ DiarkisDirectMessageBase()

DiarkisDirectMessageBase::DiarkisDirectMessageBase ( )

DiarkisDirectMessagecBase constructor.

◆ ~DiarkisDirectMessageBase()

DiarkisDirectMessageBase::~DiarkisDirectMessageBase ( )
virtual

Member Function Documentation

◆ SetupTcp()

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

Set up DirectMessage with the TCP protocol.

Registers loggers and callback functions.

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

◆ SetupUdp()

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

Set up DirectMessage 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:

◆ Disconnect() [1/2]

void DiarkisDirectMessageBase::Disconnect ( const char *  uid,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Disconnects from the specified user via direct message and sends a custom message.

A callback event (e.g. OnDisconnect) registered with GetDisconnectEvent() will be triggered.
Connection information for direct messages with the specified user cached on the server will be deleted.

Parameters
[in]uidRemote client user ID
[in]messageMessage to be sent to remote client
[in]messageSizeLength of the message

◆ Disconnect() [2/2]

void DiarkisDirectMessageBase::Disconnect ( const std::string &  uid,
const std::vector< uint8_t > &  message 
)
virtual

Same as Diconnect()

◆ Send() [1/2]

void DiarkisDirectMessageBase::Send ( const char *  uid,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Sends a direct message to the specified user.

The first message may take some time because it needs to search for a remote client.
Messages are sent using the UDP protocol if you are using SetupUdp.
If you are using SetupTcp, messages will be sent using the TCP protocol.
After this function is executed, the callback event (e.g. OnMessageEvent) registered with GetMessageEvent() will be triggered.

Parameters
[in]uidUser ID of the target to which direct messages are sent
[in]messageMessage to be sent
[in]messageSizeLength of the message

◆ Send() [2/2]

void DiarkisDirectMessageBase::Send ( const std::string &  uid,
const std::vector< uint8_t > &  message 
)
virtual

Same as Send()

◆ RSend() [1/2]

void DiarkisDirectMessageBase::RSend ( const char *  uid,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Sends a direct message to the specified user using reliable communications.

The first message may take some time as it needs to search for a remote client.
Messages are sent using the RUDP protocol if SetupUdp is used.
If you are using SetupTcp, messages will be sent using the TCP protocol.
After this function is executed, the callback event (e.g. OnMessageEvent) registered with GetMessageEvent() will be triggered.

Parameters
[in]uidUser ID of the target to which direct messages are sent
[in]messageMessage to be sent
[in]messageSizeLength of the message

◆ RSend() [2/2]

void DiarkisDirectMessageBase::RSend ( const std::string &  uid,
const std::vector< uint8_t > &  message 
)
virtual

Same as RSend()

◆ OnDisconnect()

void DiarkisDirectMessageBase::OnDisconnect ( const DiarkisDirectMessageEventArgs e)
protectedvirtual

Callback function called when a direct message is disconnected.

Triggered when a DirectMessage Disconnect notification is received from the server.

Here is the call graph for this function:

◆ OnMessage()

void DiarkisDirectMessageBase::OnMessage ( const DiarkisDirectMessageEventArgs e)
protectedvirtual

Callback function triggered when a direct message from another user is received.

Triggered when a DirectMessage Message notification is received from the server.

Here is the call graph for this function:

Member Data Documentation

◆ dm_

std::shared_ptr<IDiarkisDirectMessage> DiarkisDirectMessageBase::dm_
protected

Pointer to IDiarkisDirectMessage class.

◆ logger_

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

Pointer to IDiarkisLogger class.

◆ eventUnsubscriptions_

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

Lambda functions list.


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