NSCpp 2.0
NSCpp is a modern C++20 server/client framework designed to simplify network programming in C++. With robust support for both IPv4 and IPv6, as well as TCP and UDP communication protocols.
 
Loading...
Searching...
No Matches
HelperChannel.h
Go to the documentation of this file.
1
6
7
8#ifndef _HELPERCHANNEL_H
9#define _HELPERCHANNEL_H
10
11#include "Channel.h"
12#include "GroupManager.h"
13#include <sstream>
14#include <iostream>
15#include <unordered_set>
16
17class HelperChannel: public Channel {
18public:
25 HelperChannel(const std::string& key, const std::string& logKey = "logChannel", bool doLogging = true);
26
30 void run(std::stop_token st);
31
37 void addChannelKey(const std::string& key);
38
44 void removeChannelKey(const std::string& key);
45
46protected:
50 std::unordered_set<std::string> keys;
51
55 bool logging;
56
60 std::string logKey;
61};
62
63#endif //_HELPERCHANNEL_H
Project NSCpp.
std::string key
This key must be unique on the server on which it is plugged.
Definition Channel.h:98
Channel(const std::string &key)
Constructor of the Channel's class.
void removeChannelKey(const std::string &key)
Used as a callback which listen to the "ServerChannelUnplug" group.
void run(std::stop_token st)
Run method of the Channel, process the given events.
void addChannelKey(const std::string &key)
Used as a callback which listen to the "ServerChannelPlug" group.
HelperChannel(const std::string &key, const std::string &logKey="logChannel", bool doLogging=true)
Constructor of the HelperChannel.
std::unordered_set< std::string > keys
Keep the keys of the plugged channels.
Definition HelperChannel.h:50
std::string logKey
Key of the log channel's group.
Definition HelperChannel.h:60
bool logging
Tells if the channel is supposed to log.
Definition HelperChannel.h:55