4 #include <unordered_map>
5 #include <unordered_set>
18 using std::unordered_map;
19 using std::unordered_set;
33 template <
typename SERVER,
typename CLIENT,
typename GROUP>
66 if (
server->setGroupKey(
this,
key) ==
true) {
151 server->workerThreadPool->addElement(request,
false);
153 server->closeGroup(
static_cast<GROUP*
>(
this));
Base class for network server group.
Base class for network server groups.
virtual void onCreate()=0
ReadWriteLock clientKeyListsReadWriteLock
ClientKeySet getClientKeySet()
get a copy of current group client keys
virtual const bool addClient(CLIENT *client)
Adds a client to this group.
ClientKeySet clientKeySet
virtual void close()
Shuts down this group.
unordered_set< string > ClientKeySet
virtual void shutdown()=0
Shuts down this server group.
const bool setKey(const string &key)
sets the group identification key
virtual const bool removeClient(CLIENT *client)
Removes a client from this group.
unordered_map< string, CLIENT * > ClientKeyMap
const string & getKey()
group identification key
@ REQUESTTYPE_GROUP_CLOSE
Implementation for read/write lock.
void writeLock()
Locks for writing / exclusive lock.
void unlock()
Unlocks this read write lock.
void readLock()
Locks for reading / shared lock.
Reference counter implementation to be used with inheritance.
virtual void acquireReference()
Acquires a reference, incrementing the counter.
std::exception Exception
Exception base class.
#define FORBID_CLASS_COPY(CLASS)