![]() |
Diarkis C++Client Library API Document
|
Interface class for Group. More...
#include <group.h>
Public Member Functions | |
virtual | ~IDiarkisGroup () |
Destructor for the IDiarkisGroup class. More... | |
virtual void | SetLoggerFactory (const std::shared_ptr< IDiarkisLoggerFactory > &loggerFactory, Diarkis::StdString loggerNameSuffix)=0 |
Register a logger. More... | |
virtual bool | SetupAsTcp (const std::shared_ptr< IDiarkisTcp > &tcp)=0 |
Set up Group as a TCP protocol. More... | |
virtual bool | SetupAsUdp (const std::shared_ptr< IDiarkisUdp > &udp)=0 |
Set up Group as a UDP protocol. More... | |
virtual bool | SetTcp (const std::shared_ptr< IDiarkisTcp > &tcp)=0 |
Registers a pointer to the IDiarkisTcp class. More... | |
virtual bool | SetUdp (const std::shared_ptr< IDiarkisUdp > &udp)=0 |
Registers a pointer to the IDiarkisUdp class. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisGroupEventArgs & > > | GetCreateEvent ()=0 |
Get the callback event called when a Group is created. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisGroupEventArgs & > > | GetJoinEvent ()=0 |
Get the callback event called when joined a Group. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisGroupEventArgs & > > | GetLeaveEvent ()=0 |
Get the callback event called when left from a Group. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisPayloadEventArgs & > > | GetMemberJoinEvent ()=0 |
Get the callback event called when other clients joined a Group. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisPayloadEventArgs & > > | GetMemberLeaveEvent ()=0 |
Get the callback event called when other clients left from a Group. More... | |
virtual std::shared_ptr< IDiarkisEvent< const DiarkisPayloadEventArgs & > > | GetMemberBroadcastEvent ()=0 |
Get the callback event called when received a broadcast message. More... | |
virtual void | GetGroupIDs (Diarkis::StdVector< Diarkis::StdString > &idList)=0 |
Get a list of Group member's user IDs. More... | |
virtual Diarkis::System::Result | Create (bool allowEmpty, bool join, uint16_t ttl)=0 |
Creates a new Group. More... | |
virtual Diarkis::System::Result | Join (const char *groupID, const uint8_t *message, size_t messageSize)=0 |
Join an existing Group. More... | |
virtual Diarkis::System::Result | Join (const Diarkis::StdString &groupID, const Diarkis::StdVector< uint8_t > &message)=0 |
Same as Join() More... | |
virtual Diarkis::System::Result | JoinRandom (uint16_t ttl, const uint8_t *message, size_t messageSize, uint32_t interval=200, bool allowEmpty=false)=0 |
If there is a Group you can join, join that Group, otherwise create a new Group. More... | |
virtual Diarkis::System::Result | JoinRandom (uint16_t ttl, const Diarkis::StdVector< uint8_t > &message, uint32_t interval=200, bool allowEmpty=false)=0 |
Same as JoinRandom() More... | |
virtual Diarkis::System::Result | Leave (const char *groupID, const uint8_t *message, size_t messageSize)=0 |
Leave from the Group. More... | |
virtual Diarkis::System::Result | Leave (const Diarkis::StdString &groupID, const Diarkis::StdVector< uint8_t > &message)=0 |
Same as Leave() More... | |
virtual Diarkis::System::Result | BroadcastTo (const char *groupID, const uint8_t *message, size_t messageSize, bool reliable=true)=0 |
Sends a message to all participants of the Group. More... | |
virtual Diarkis::System::Result | BroadcastTo (const Diarkis::StdString &groupID, const Diarkis::StdVector< uint8_t > &message, bool reliable=true)=0 |
Same as BroadcastTo() More... | |
Interface class for Group.
Functions and callback events are provided to use Group.
|
inlinevirtual |
Destructor for the IDiarkisGroup class.
|
pure virtual |
Register a logger.
[in] | loggerFactory | Pointer to IDiarkisLoggerFactory |
[in] | loggerNameSuffix | String to be added to the tag that will be output to the log |
|
pure virtual |
Set up Group as a TCP protocol.
|
pure virtual |
Set up Group as a UDP protocol.
|
pure virtual |
Registers a pointer to the IDiarkisTcp class.
[in] | tcp | Pointer to IDiarkisTcp class |
|
pure virtual |
Registers a pointer to the IDiarkisUdp class.
[in] | udp | Pointer to IDiarkisUdp class |
|
pure virtual |
Get the callback event called when a Group is created.
|
pure virtual |
Get the callback event called when joined a Group.
|
pure virtual |
Get the callback event called when left from a Group.
|
pure virtual |
Get the callback event called when other clients joined a Group.
|
pure virtual |
Get the callback event called when other clients left from a Group.
|
pure virtual |
Get the callback event called when received a broadcast message.
|
pure virtual |
Get a list of Group member's user IDs.
|
pure virtual |
Creates a new Group.
Callback events registered with GetCreateEvent() (e.g. OnGroupCreation) will be triggered.
[in] | allowEmpty | Determines if the client will keep the Group even when no one has joined. true = Keep the Group even when no clients are present. false = If the client is gone the Group will be destroyed after the time specified by ttl has elapsed. |
[in] | join | Determines whether or not a new Group is created and then joined. true = Join the Group after it is created. In this case, the server will not respond to the Join request. false = Only creates the Group. If you want to join the Group, you need to execute Join separately. |
[in] | ttl | Specifies the duration, in seconds, of a Group's existence after it becomes empty; used only if allowEmpty is set to true. |
|
pure virtual |
Join an existing Group.
A callback event registered with GetJoinEvent() (e.g. OnGroupJoin) will be triggered.
A callback event registered with GetMemberJoinEvent() (e.g. OnGroupMemberJoin) will be triggered for the member of the target Group.
[in] | groupID | ID of the Group to join |
[in] | message | Sends an message to Group members when join. For example, you can include a user ID to notify the user ID of a newly joined member. |
[in] | messageSize | Length of the message |
|
pure virtual |
Same as Join()
|
pure virtual |
If there is a Group you can join, join that Group, otherwise create a new Group.
If you join an existing Group, a callback event registered with GetJoinEvent() (e.g. OnGroupJoin) will be triggered.
When a new Group is created, the callback event registered with GetCreateEvent() (e.g. OnGroupCreation ) will be triggered.
[in] | ttl | Duration in seconds since the Group became empty, used only when allowEmpty is set to true. |
[in] | message | Sends an optional message to Group members when they join. |
[in] | messageSize | Length of the message |
[in] | interval | Specifies the interval in milliseconds between when the server processes BroadcastTo. The default value is 200ms. The messages for the time specified by interval are compiled and sent by the server. |
[in] | allowEmpty | Determines whether or not the Group is retained even when no client has joined. true = Retain the Group even if no clients are present. false = The Group will be destroyed after the time specified by ttl if there are no clients. |
|
pure virtual |
Same as JoinRandom()
|
pure virtual |
Leave from the Group.
Callback event registered with GetMemberLeaveEvent() (e.g. OnGroupMemberLeave) will be triggered.
[in] | groupID | ID of the Group to leave |
[in] | message | Sends an message to Group members when leaving. |
[in] | messageSize | Length of the message |
|
pure virtual |
Same as Leave()
|
pure virtual |
Sends a message to all participants of the Group.
The callback event registered with GetMemberBroadcastEvent() (e.g. OnGroupMemberBroadcast) will be triggered.
Callback events are also triggered for messages sent by you.
[in] | groupID | ID of the Group |
[in] | message | Message to be sent |
[in] | messageSize | Length of the message |
[in] | reliable | Determines if the message is sent via reliable communication (RUDP); ignored for TCP protocol. |
|
pure virtual |
Same as BroadcastTo()