/* * @Description: * @Version: 1.0 * @Autor: lishengyin * @Date: 2022-04-11 17:12:05 * @LastEditors: lishengyin * @LastEditTime: 2022-04-12 10:13:25 */ #ifndef __USERAPP_HPP_ #define __USERAPP_HPP_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Network/TcpServer.h" #include "Network/TcpSession.h" #include "TcpProxySession.hpp" #include "Disposition.hpp" #include "Poller/Timer.h" using namespace std; using namespace toolkit; #define OK 0 #define ERR -1 class UserApp:private NonCopyable { private: UserApp(std::string appName):appName_(appName){} public: using Ptr = std::shared_ptr; ~UserApp(){} /** * @description: 创建新的实例 * @param {string} appName * @return {*} */ static std::shared_ptr CreateNew(std::string appName); /** * @description: 初始化 * @param {*} * @return {*} */ int8_t Init(); /** * @description: 启动任务 * @param {*} * @return {*} */ int8_t StartTask(); private: std::string appName_; int port = 7400; TcpServer::Ptr m_tcpServer = nullptr; Timer::Ptr m_timer; }; #endif