Elimination of Service object,
This commit is contained in:
1 parent
a46db126e9
commit
a40f7314a8
440 files changed
+17787
-516
No files matched your search
@@ -0,0 +1,73 @@
|
||||
#ifndef __Session_h__
|
||||
#define __Session_h__
|
||||
|
||||
#include "TCPSocket.h"
|
||||
#include "SessionFilter.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class TCPServer;
|
||||
|
||||
///
|
||||
/// TCPSession
|
||||
///
|
||||
/// TCPSession defines the nature of the interaction with the client
|
||||
/// and stores persistent data for a defined session. BMASession objects
|
||||
/// are not sockets but instead provide a communications control
|
||||
/// mechanism. Protocol conversations are provided through extensions
|
||||
/// from this object.
|
||||
///
|
||||
|
||||
class TCPSession : public TCPSocket {
|
||||
|
||||
public:
|
||||
TCPSession(EPoll &ePoll, TCPServer &server);
|
||||
~TCPSession();
|
||||
|
||||
virtual void output(std::stringstream &data);
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
||||
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);
|
||||
|
||||
std::stringstream out;
|
||||
|
||||
TCPServer &server;
|
||||
|
||||
protected:
|
||||
|
||||
void onDataReceived(std::string data) override;
|
||||
void onConnected() override;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
|
||||
virtual void protocol(std::string data);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user