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
DebugChannel Class Reference

Project NSCpp. More...

#include <DebugChannel.h>

Inheritance diagram for DebugChannel:
Channel

Public Member Functions

 DebugChannel (const std::string &key, std::ostream &stream, bool echo=false, const std::string &logKey="logChannel", bool doLogging=true)
 Constructor of the DebugChannel.
 
void run (std::stop_token st)
 Run method of the Channel, process the given events.
 
- Public Member Functions inherited from Channel
 Channel (const std::string &key)
 Constructor of the Channel's class.
 
void setKey (const std::string &key)
 Defined the Channel's key.
 
const std::string & getKey ()
 Return the Channel's key.
 
void setState (ChannelState state)
 Change the state of the server.
 
void push (ClientData data)
 Add the given data at the end of the queue.
 
ClientData pull ()
 Pop the first data from the queue and return it.
 
bool available ()
 Return true if data is available inside the dataQueue, false otherwise.
 

Protected Attributes

std::ostream & stream
 Debug's stream.
 
bool logging
 Tells if the channel is supposed to log.
 
bool echo
 Tells if the channel echo back (with the same protocol) to the client.
 
std::string logKey
 Key of the log channel's group.
 
- Protected Attributes inherited from Channel
std::string key
 This key must be unique on the server on which it is plugged.
 
std::queue< ClientDatadataQueue
 This queue is used to store (and read) the data send to the Channel by the Server.
 
ChannelState state
 Control if the channel is active or not.
 

Detailed Description

Project NSCpp.

Author
Thomas K/BIDI
Version
2.0

Constructor & Destructor Documentation

◆ DebugChannel()

DebugChannel::DebugChannel ( const std::string & key,
std::ostream & stream,
bool echo = false,
const std::string & logKey = "logChannel",
bool doLogging = true )

Constructor of the DebugChannel.

The ostream is the one used to display the information, could be any ostream.

Parameters
keyChannel's key.
streamStream on which the debug will be shown.
echoTells if the Channel echo back the data to the clients.
logKeyKey of the log channel group which can be used to log the debug information (default : "logChannel").
doLoggingTells if the Channel should log its actions.

Member Function Documentation

◆ run()

void DebugChannel::run ( std::stop_token st)
virtual

Run method of the Channel, process the given events.

Implements Channel.

Member Data Documentation

◆ echo

bool DebugChannel::echo
protected

Tells if the channel echo back (with the same protocol) to the client.

◆ logging

bool DebugChannel::logging
protected

Tells if the channel is supposed to log.

◆ logKey

std::string DebugChannel::logKey
protected

Key of the log channel's group.

◆ stream

std::ostream& DebugChannel::stream
protected

Debug's stream.


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