Diarkis C++Client Library API Document
DiarkisSessionBase Class Reference

Base class that wraps the IDiarkisSession class for easy use of Session functionality. More...

#include <DiarkisSessionBase.h>

Collaboration diagram for DiarkisSessionBase:

Public Member Functions

 DiarkisSessionBase ()
 DiarkisSessionBase constructor. More...
 
virtual ~DiarkisSessionBase ()
 DiarkisSessionBase destructor. More...
 
virtual void SetupUdpSession (const std::shared_ptr< IDiarkisUdp > &udp, const std::shared_ptr< LoggerFactory > &loggerFactory, bool bRetry)
 Set up Session with UDP protocol. More...
 
virtual void SetupTcpSession (const std::shared_ptr< IDiarkisTcp > &tcp, const std::shared_ptr< LoggerFactory > &loggerFactory, bool bRetry)
 Set up Session with TCP protocol. More...
 
bool HasSession (uint8_t sessionType) const
 Check if you are joining at least one Session. More...
 
virtual void SendCreate (uint8_t sessionType, uint8_t maxMembers, uint8_t ttl)
 Create a new Session. More...
 
virtual void SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount)
 Invite a user to the Session your are currently in. More...
 
virtual void SendInvite (uint8_t sessionType, const std::vector< std::string > &uids)
 Same as SendInvite(uint8_t, const char**, size_t) More...
 
virtual void SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount, const uint8_t *message, size_t messageSize)
 Invite a user to the Session you are currently in. More...
 
virtual void SendInvite (uint8_t sessionType, const std::vector< std::string > &uids, const std::string &message)
 Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t) More...
 
virtual void SendInvite (uint8_t sessionType, const char **uids, size_t uidsCount, const char *message)
 Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t) More...
 
virtual void SendBroadcast (uint8_t sessionType, const uint8_t *message, size_t messageSize)
 Broadcast a message. More...
 
virtual void SendBroadcast (uint8_t sessionType, const std::string &message)
 Same as SendBroadcast() More...
 
virtual void SendBroadcast (uint8_t sessionType, const char *message)
 Same as SendBroadcast() More...
 
virtual void SendMessageTo (uint8_t sessionType, const char **uids, size_t uidsCount, const uint8_t *message, size_t messageSize)
 Send a message to particular membbers. More...
 
virtual void SendMessageTo (uint8_t sessionType, const char **uids, size_t uidsCount, const char *message)
 Same as SendMessageTo() More...
 
virtual void SendMessageTo (uint8_t sessionType, const std::vector< std::string > &memberIDs, const std::string &message)
 Same as SendMessageTo() More...
 
virtual void SendGetSessionInfoBySessionType (uint8_t sessionType)
 Obtain information about the specified Session. More...
 
virtual void SendGetSessionInfoBySessionID (const char *sessionID)
 Obtain information about the specified Session. More...
 
virtual void SendGetSessionInfoBySessionID (const std::string &sessionID)
 Same as SendGetSessionInfoBySessionID() More...
 
Diarkis::StdString GetSessionID (uint8_t sessionType) const
 Get the Session ID. More...
 
virtual void SendKick (uint8_t sessionType, const char *userID)
 Kick a Session member. More...
 
virtual void SendKick (uint8_t sessionType, const std::string &userID)
 Same as SendKick() More...
 
virtual void SendJoin (uint8_t sessionType, const char *sessionID)
 Join a Session. More...
 
virtual void SendJoin (uint8_t sessionType, const std::string &sessionID)
 Same as SendJoin() More...
 
virtual void SendLeave (uint8_t sessionType)
 Leave a Session. More...
 
void SetUserID (const char *userID)
 Set user ID. More...
 
void SetUserID (const std::string &userID)
 Same as SendUserID() More...
 
Diarkis::StdString GetUserID () const
 Get user ID. More...
 

Protected Member Functions

virtual void OnSessionCreateResponse (const DiarkisSessionCreateResponseEventArgs &e)
 Callback event called when the Session is created, event content is the Session ID. More...
 
virtual void OnSessionInvite (const DiarkisSessionInviteEventArgs &e)
 Callback event called when a user is invited to the Session, event content is the Session ID. More...
 
virtual void OnSessionJoin (const DiarkisSessionNotificationEventArgs &e)
 Callback event when an a member join the Session, event content is the user ID. More...
 
virtual void OnSessionLeave (const DiarkisSessionNotificationEventArgs &e)
 Callback event when an a member leave the Session, event content is the user ID. More...
 
virtual void OnSessionBroadcast (const DiarkisSessionNotificationEventArgs &e)
 Callback event when an a broadcast is received. More...
 
virtual void OnSessionMessageTo (const DiarkisSessionNotificationEventArgs &e)
 Callback event when an a message is received. More...
 
virtual void OnSessionInfo (const DiarkisSessionInfoEventArgs &e)
 Callback event called when acquiring information of a participating Session. More...
 
virtual void OnSessionKick (const DiarkisSessionNotificationEventArgs &e)
 Callback event when kicked out of the Session. More...
 
virtual void OnSessionInviteResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendInvite is sent. More...
 
virtual void OnSessionKickResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendKick is sent. More...
 
virtual void OnSessionJoinResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendJoin is sent. More...
 
virtual void OnSessionMessageToResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendMessageTo is sent. More...
 
virtual void OnSessionBroadcastResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendBroadcast is sent. More...
 
virtual void OnSessionLeaveResponse (const DiarkisSessionResponseEventArgs &e)
 Callback event when a response is received from the server when SendLeave is sent. More...
 

Protected Attributes

std::shared_ptr< IDiarkisUdpudp_
 IDiarkisUdpクラスへのポインタ More...
 
std::shared_ptr< IDiarkisTcptcp_
 Pointer to IDiarkisTcp class. More...
 
std::shared_ptr< IDiarkisSessionsession_
 Pointer to IDiarkisSession class. More...
 
std::shared_ptr< IDiarkisLoggerlogger_
 Pointer to IDiarkisLogger class. More...
 
Diarkis::StdVector< std::function< void()> > eventUnsubscriptions_
 List of lambda functions. More...
 

Detailed Description

Base class that wraps the IDiarkisSession class for easy use of Session functionality.

Constructor & Destructor Documentation

◆ DiarkisSessionBase()

DiarkisSessionBase::DiarkisSessionBase ( )

DiarkisSessionBase constructor.

Here is the call graph for this function:

◆ ~DiarkisSessionBase()

DiarkisSessionBase::~DiarkisSessionBase ( )
virtual

DiarkisSessionBase destructor.

Member Function Documentation

◆ SetupUdpSession()

void DiarkisSessionBase::SetupUdpSession ( const std::shared_ptr< IDiarkisUdp > &  udp,
const std::shared_ptr< LoggerFactory > &  loggerFactory,
bool  bRetry 
)
virtual

Set up Session with UDP protocol.

Register loggers and callback functions.

Parameters
[in]udpPointer to IDiarkisUdp class
[in]loggerFactoryPointer to logger class
[in]bRetryCall this function with true when reconnecting after a failed attempt. The first call to this function must be false.
Here is the call graph for this function:

◆ SetupTcpSession()

void DiarkisSessionBase::SetupTcpSession ( const std::shared_ptr< IDiarkisTcp > &  tcp,
const std::shared_ptr< LoggerFactory > &  loggerFactory,
bool  bRetry 
)
virtual

Set up Session with TCP protocol.

Register loggers and callback functions.

Parameters
[in]tcpPointer to IDiarkisTcp class
[in]loggerFactoryPointer to logger class
[in]bRetryCall this function with true when reconnecting after a failed attempt. The first call to this function must be false.
Here is the call graph for this function:

◆ HasSession()

bool DiarkisSessionBase::HasSession ( uint8_t  sessionType) const

Check if you are joining at least one Session.

◆ SendCreate()

void DiarkisSessionBase::SendCreate ( uint8_t  sessionType,
uint8_t  maxMembers,
uint8_t  ttl 
)
virtual

Create a new Session.

Callback events registered with GetCreateEvent() (e.g. OnSessionCreate) will be triggered.

Parameters
[in]sessionTypeSession type
[in]maxMembersMaximum number of participants in the Session
[in]ttlDuration of the Session in seconds after it is empty.
Here is the call graph for this function:

◆ SendInvite() [1/5]

void DiarkisSessionBase::SendInvite ( uint8_t  sessionType,
const char **  uids,
size_t  uidsCount 
)
virtual

Invite a user to the Session your are currently in.

OnSessionInvite is triggered by the invited user.

Parameters
[in]sessionTypeType of Session to invite.
[in]uidsList of user IDs to send the invite to
[in]uidsCountNumber of UIDs
Here is the caller graph for this function:

◆ SendInvite() [2/5]

void DiarkisSessionBase::SendInvite ( uint8_t  sessionType,
const std::vector< std::string > &  uids 
)
virtual

Same as SendInvite(uint8_t, const char**, size_t)

Here is the call graph for this function:

◆ SendInvite() [3/5]

void DiarkisSessionBase::SendInvite ( uint8_t  sessionType,
const char **  uids,
size_t  uidsCount,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Invite a user to the Session you are currently in.

OnSessionInvite is triggered by the invited user.

Parameters
[in]sessionTypeType of Session to invite.
[in]uidsList of user IDs to send the invite to
[in]uidsCountNumber of UIDs
[in]messageMessage to be sent
[in]messageSizeLength of the message
Here is the call graph for this function:

◆ SendInvite() [4/5]

void DiarkisSessionBase::SendInvite ( uint8_t  sessionType,
const std::vector< std::string > &  uids,
const std::string &  message 
)
virtual

Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t)

Here is the call graph for this function:

◆ SendInvite() [5/5]

void DiarkisSessionBase::SendInvite ( uint8_t  sessionType,
const char **  uids,
size_t  uidsCount,
const char *  message 
)
virtual

Same as SendInvite(uint8_t, const char**, size_t, const uint8_t*, size_t)

Here is the call graph for this function:

◆ SendBroadcast() [1/3]

void DiarkisSessionBase::SendBroadcast ( uint8_t  sessionType,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Broadcast a message.

The message is delivered to all members of the Session, including yourself.

Parameters
[in]sessionTypeType of Session to send.
[in]messageMessage to be sent
[in]messageSizeLength of the message
Here is the caller graph for this function:

◆ SendBroadcast() [2/3]

void DiarkisSessionBase::SendBroadcast ( uint8_t  sessionType,
const std::string &  message 
)
virtual

Same as SendBroadcast()

Here is the call graph for this function:

◆ SendBroadcast() [3/3]

void DiarkisSessionBase::SendBroadcast ( uint8_t  sessionType,
const char *  message 
)
virtual

Same as SendBroadcast()

◆ SendMessageTo() [1/3]

void DiarkisSessionBase::SendMessageTo ( uint8_t  sessionType,
const char **  uids,
size_t  uidsCount,
const uint8_t *  message,
size_t  messageSize 
)
virtual

Send a message to particular membbers.

The message is delivered to particular members of the Session.

Parameters
[in]sessionTypeis the type of the sessionl
[in]uidsis the list of user IDs the message will be sent to
[in]uidsCountNumber of UIDs
[in]messagepayload data
[in]messageSizeLength of the message

◆ SendMessageTo() [2/3]

void DiarkisSessionBase::SendMessageTo ( uint8_t  sessionType,
const char **  uids,
size_t  uidsCount,
const char *  message 
)
virtual

Same as SendMessageTo()

◆ SendMessageTo() [3/3]

void DiarkisSessionBase::SendMessageTo ( uint8_t  sessionType,
const std::vector< std::string > &  memberIDs,
const std::string &  message 
)
virtual

Same as SendMessageTo()

Here is the call graph for this function:

◆ SendGetSessionInfoBySessionType()

void DiarkisSessionBase::SendGetSessionInfoBySessionType ( uint8_t  sessionType)
virtual

Obtain information about the specified Session.

The callback event registered with GetSessionInfoEvent (e.g. OnSessionInfo) is triggered.

Parameters
[in]sessionTypeType of the Session
Here is the call graph for this function:

◆ SendGetSessionInfoBySessionID() [1/2]

void DiarkisSessionBase::SendGetSessionInfoBySessionID ( const char *  sessionID)
virtual

Obtain information about the specified Session.

The callback event registered with GetSessionInfoEvent (e.g. OnSessionInfo) is triggered.

Parameters
[in]sessionIDID of the Session
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendGetSessionInfoBySessionID() [2/2]

void DiarkisSessionBase::SendGetSessionInfoBySessionID ( const std::string &  sessionID)
virtual

Same as SendGetSessionInfoBySessionID()

Here is the call graph for this function:

◆ GetSessionID()

Diarkis::StdString DiarkisSessionBase::GetSessionID ( uint8_t  sessionType) const

Get the Session ID.

If no Session has been joined the ID is empty.

Parameters
[in]sessionTypetype of the Session to get ID

◆ SendKick() [1/2]

void DiarkisSessionBase::SendKick ( uint8_t  sessionType,
const char *  userID 
)
virtual

Kick a Session member.

Parameters
[in]sessionTypeSession type
[in]userIDID of the user to kick
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendKick() [2/2]

void DiarkisSessionBase::SendKick ( uint8_t  sessionType,
const std::string &  userID 
)
virtual

Same as SendKick()

Here is the call graph for this function:

◆ SendJoin() [1/2]

void DiarkisSessionBase::SendJoin ( uint8_t  sessionType,
const char *  sessionID 
)
virtual

Join a Session.

Parameters
[in]sessionTypeSession type
[in]sessionIDSession ID
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendJoin() [2/2]

void DiarkisSessionBase::SendJoin ( uint8_t  sessionType,
const std::string &  sessionID 
)
virtual

Same as SendJoin()

Here is the call graph for this function:

◆ SendLeave()

void DiarkisSessionBase::SendLeave ( uint8_t  sessionType)
virtual

Leave a Session.

Parameters
[in]sessionTypeSession type
Here is the call graph for this function:

◆ SetUserID() [1/2]

void DiarkisSessionBase::SetUserID ( const char *  userID)

Set user ID.

Parameters
[in]userIDuser ID
Here is the caller graph for this function:

◆ SetUserID() [2/2]

void DiarkisSessionBase::SetUserID ( const std::string &  userID)

Same as SendUserID()

Here is the call graph for this function:

◆ GetUserID()

Diarkis::StdString DiarkisSessionBase::GetUserID ( ) const

Get user ID.

◆ OnSessionCreateResponse()

void DiarkisSessionBase::OnSessionCreateResponse ( const DiarkisSessionCreateResponseEventArgs e)
protectedvirtual

Callback event called when the Session is created, event content is the Session ID.

Here is the call graph for this function:

◆ OnSessionInvite()

void DiarkisSessionBase::OnSessionInvite ( const DiarkisSessionInviteEventArgs e)
protectedvirtual

Callback event called when a user is invited to the Session, event content is the Session ID.

Here is the call graph for this function:

◆ OnSessionJoin()

void DiarkisSessionBase::OnSessionJoin ( const DiarkisSessionNotificationEventArgs e)
protectedvirtual

Callback event when an a member join the Session, event content is the user ID.

Here is the call graph for this function:

◆ OnSessionLeave()

void DiarkisSessionBase::OnSessionLeave ( const DiarkisSessionNotificationEventArgs e)
protectedvirtual

Callback event when an a member leave the Session, event content is the user ID.

Here is the call graph for this function:

◆ OnSessionBroadcast()

void DiarkisSessionBase::OnSessionBroadcast ( const DiarkisSessionNotificationEventArgs e)
protectedvirtual

Callback event when an a broadcast is received.

Here is the call graph for this function:

◆ OnSessionMessageTo()

void DiarkisSessionBase::OnSessionMessageTo ( const DiarkisSessionNotificationEventArgs e)
protectedvirtual

Callback event when an a message is received.

Here is the call graph for this function:

◆ OnSessionInfo()

void DiarkisSessionBase::OnSessionInfo ( const DiarkisSessionInfoEventArgs e)
protectedvirtual

Callback event called when acquiring information of a participating Session.

Here is the call graph for this function:

◆ OnSessionKick()

void DiarkisSessionBase::OnSessionKick ( const DiarkisSessionNotificationEventArgs e)
protectedvirtual

Callback event when kicked out of the Session.

Here is the call graph for this function:

◆ OnSessionInviteResponse()

void DiarkisSessionBase::OnSessionInviteResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendInvite is sent.

Here is the call graph for this function:

◆ OnSessionKickResponse()

void DiarkisSessionBase::OnSessionKickResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendKick is sent.

Here is the call graph for this function:

◆ OnSessionJoinResponse()

void DiarkisSessionBase::OnSessionJoinResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendJoin is sent.

Here is the call graph for this function:

◆ OnSessionMessageToResponse()

void DiarkisSessionBase::OnSessionMessageToResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendMessageTo is sent.

Here is the call graph for this function:

◆ OnSessionBroadcastResponse()

void DiarkisSessionBase::OnSessionBroadcastResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendBroadcast is sent.

Here is the call graph for this function:

◆ OnSessionLeaveResponse()

void DiarkisSessionBase::OnSessionLeaveResponse ( const DiarkisSessionResponseEventArgs e)
protectedvirtual

Callback event when a response is received from the server when SendLeave is sent.

Here is the call graph for this function:

Member Data Documentation

◆ udp_

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

IDiarkisUdpクラスへのポインタ

~@japanese

Pointer to IDiarkisUdp class

◆ tcp_

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

Pointer to IDiarkisTcp class.

◆ session_

std::shared_ptr<IDiarkisSession> DiarkisSessionBase::session_
protected

Pointer to IDiarkisSession class.

◆ logger_

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

Pointer to IDiarkisLogger class.

◆ eventUnsubscriptions_

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

List of lambda functions.


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