TDME2 1.9.121
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ServerGroup< SERVER, CLIENT, GROUP > Class Template Referenceabstract

Base class for network server groups. More...

#include <tdme/network/udpserver/ServerGroup.h>

Inheritance diagram for ServerGroup< SERVER, CLIENT, GROUP >:
Inheritance graph
Collaboration diagram for ServerGroup< SERVER, CLIENT, GROUP >:
Collaboration graph

Public Types

typedef std::set< std::string > ClientKeySet
 

Public Member Functions

 ServerGroup (const uint32_t groupId)
 
const string & getKey ()
 group identification key More...
 
const bool setKey (const string &key)
 sets the group identification key More...
 
ClientKeySet getClientKeySet ()
 get a copy of current group client keys More...
 
virtual const bool addClient (CLIENT *client)
 Adds a client to this group. More...
 
virtual const bool removeClient (CLIENT *client)
 Removes a client from this group. More...
 
virtual void shutdown ()=0
 Shuts down this server group. More...
 
- Public Member Functions inherited from Reference
 Reference ()
 Public constructor. More...
 
virtual ~Reference ()
 destructor More...
 
void acquireReference ()
 acquires a reference, incrementing the counter More...
 
void releaseReference ()
 releases a reference, thus decrementing the counter and delete it if reference counter is zero More...
 
virtual void onDelete ()
 Callback method to be overridden, will be called if object will be deleted. More...
 

Protected Types

typedef std::map< const std::string, CLIENT * > ClientKeyMap
 

Protected Member Functions

virtual void onCreate ()=0
 
virtual void onClose ()=0
 
virtual void close ()
 Shuts down this group. More...
 
- Protected Member Functions inherited from ServerGroupBase
virtual void onInit ()=0
 
virtual void onClose ()=0
 
virtual void onCustomEvent (const string &type)=0
 

Protected Attributes

SERVER * server
 
uint32_t groupId
 
std::string key
 
ClientKeySet clientKeySet
 
ReadWriteLock clientKeyListsReadWriteLock
 

Detailed Description

template<typename SERVER, typename CLIENT, typename GROUP>
class tdme::network::udpserver::ServerGroup< SERVER, CLIENT, GROUP >

Base class for network server groups.

Author
Andreas Drewke

Definition at line 34 of file ServerGroup.h.

Member Typedef Documentation

◆ ClientKeyMap

typedef std::map<const std::string, CLIENT*> ClientKeyMap
protected

Definition at line 124 of file ServerGroup.h.

◆ ClientKeySet

typedef std::set<std::string> ClientKeySet

Definition at line 36 of file ServerGroup.h.

Constructor & Destructor Documentation

◆ ServerGroup()

ServerGroup ( const uint32_t  groupId)
inline

Definition at line 38 of file ServerGroup.h.

Member Function Documentation

◆ addClient()

virtual const bool addClient ( CLIENT *  client)
inlinevirtual

Adds a client to this group.

Parameters
clientclient

Definition at line 89 of file ServerGroup.h.

◆ close()

virtual void close ( )
inlineprotectedvirtual

Shuts down this group.

Definition at line 139 of file ServerGroup.h.

◆ getClientKeySet()

ClientKeySet getClientKeySet ( )
inline

get a copy of current group client keys

Returns
group client list

Definition at line 75 of file ServerGroup.h.

◆ getKey()

const string & getKey ( )
inline

group identification key

Returns
group key

Definition at line 53 of file ServerGroup.h.

◆ onClose()

virtual void onClose ( )
protectedpure virtual

Implements ServerGroupBase.

◆ onCreate()

virtual void onCreate ( )
protectedpure virtual

◆ removeClient()

virtual const bool removeClient ( CLIENT *  client)
inlinevirtual

Removes a client from this group.

Parameters
clientclient

Definition at line 106 of file ServerGroup.h.

◆ setKey()

const bool setKey ( const string &  key)
inline

sets the group identification key

Parameters
&keygroup identification key
Returns
if setting the key was succesful

Definition at line 62 of file ServerGroup.h.

◆ shutdown()

virtual void shutdown ( )
pure virtual

Shuts down this server group.

Member Data Documentation

◆ clientKeyListsReadWriteLock

ReadWriteLock clientKeyListsReadWriteLock
protected

Definition at line 160 of file ServerGroup.h.

◆ clientKeySet

ClientKeySet clientKeySet
protected

Definition at line 158 of file ServerGroup.h.

◆ groupId

uint32_t groupId
protected

Definition at line 155 of file ServerGroup.h.

◆ key

std::string key
protected

Definition at line 156 of file ServerGroup.h.

◆ server

SERVER* server
protected

Definition at line 154 of file ServerGroup.h.


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