Added vscode

This commit is contained in:
Brad Arant committed 2020-11-07 17:28:24 -08:00
1 parent 177bc602af
commit f652ba1f34
6 files changed
+165 -136

No files matched your search

+56 -63
View File
@@ -8,151 +8,144 @@ namespace core {
class Command;
enum Mode {LINE, BLOCK};
class TCPServer;
///
/// TCPSession
///
/// TCPSession defines the nature of the interaction with the client
/// and stores persistent data for a defined session. TCPSession objects
/// are not sockets but instead provide a communications control
/// are not sockets but instead provide a communications control
/// mechanism. Protocol conversations are provided through extensions
/// from this object.
///
///
/// from this object.
///
///
///
class TCPSession : public TCPSocket {
public:
///
///
///
TCPSession(EPoll &ePoll, TCPServer &server, std::string text = "");
///
///
///
~TCPSession();
~TCPSession();
Command *grab = NULL;
virtual void output(std::stringstream &data);
///
/// Use out to send data to the session socket or other session sockets.
///
std::stringstream out;
///
///
/// The send method is used to output the contents of the out stream
/// to the session containing the stream.
///
void send();
///
/// Use this sendToAll method to output the contents of the out stream
/// to all the connections on the server excluding the sender session.
/// to all the connections on the server excluding the sender session.
///
void sendToAll();
///
/// Use this sendToAll method to output the contents of the out stream
/// to all the connections on the server excluding the sender session
/// and the entries identified by the passed in filter object.
///
void sendToAll(SessionFilter filter);
///
/// Use this method to terminate this TCPSession.
/// Use this method to terminate this TCPSession.
///
void terminate();
///
///
///
///
TCPServer &server;
///
/// Set this value to control the next read event coming
/// from this socket.
///
// enum Mode {LINE, BLOCK};
protected:
///
///
///
virtual void onRegistered() override;
virtual void onRegistered() override;
///
/// Override this method to receive data directly from the socket as data is
/// received. If you need data split by line termination characters then
/// override the onLineReceived method instead.
///
virtual void onDataReceived(char *data, int len) override;
virtual void onDataReceived(char *data, int len) override;
///
/// Override the onLineReceived method to receive a string of characters that
/// represents a single line of data terminated by a LF or CRLF. If onDataReceived
/// Override the onLineReceived method to receive a string of characters that
/// represents a single line of data terminated by a LF or CRLF. If onDataReceived
/// was overriden this method will not be called unless the onDataReceived calls
/// this method explicitly using the class and member name.
///
virtual void onLineReceived(std::string line);
virtual void onLineReceived(std::string line);
///
/// Override the onBlockReceived method to receive a string of characters that
/// represents a single block of data of length determined by the block length value. If
/// onDataReceived was overriden this method will not be called unless the onDataReceived
/// Override the onBlockReceived method to receive a string of characters that
/// represents a single block of data of length determined by the block length value. If
/// onDataReceived was overriden this method will not be called unless the onDataReceived
/// calls this method explicitly using the class and member name.
///
virtual void onBlockReceived(std::string block);
virtual void onBlockReceived(std::string block);
///
/// This method is called from within the protocol method when protocol is called
/// on the initial connection where the data is an empty string. Use this method
/// to deliver a message to the connection upon connection.
///
virtual void onConnected();
///
/// Override the protocol method to manage and control the session communications
/// in your inherited session. If you do not override this method then the Session
/// default will process the 'commands' added to the server object using the
/// processRequest method on the session input.
/// default will process the 'commands' added to the server object using the
/// processRequest method on the session input.
///
/// When data is received within the session two modes are available to pass the
/// When data is received within the session two modes are available to pass the
/// data through the protocol method: LINE or BLOCK.
///
virtual void protocol(std::string data);
virtual void protocol(std::string data);
///
/// Use the setMode method to set the receiving mode for the data on this socket.
/// Data can be received in LINE mode, which will receive data from the socket one
/// Use the setMode method to set the receiving mode for the data on this socket.
/// Data can be received in LINE mode, which will receive data from the socket one
/// line at a time, or BLOCK mode where a certain specified data block is received
/// before calling the onBlockReceived method.
///
void setMode(core::Mode mode, int size = 0);
void setMode(core::Mode mode, int size = 0);
private:
char *lineBuffer = NULL;
int lineBufferSize = 0;
@@ -162,9 +155,9 @@ namespace core {
bool term = false;
core::Mode mode = LINE;
int blockSize;
};
}
#endif