载入中...
搜索中...
未找到
Session.h
浏览该文件的文档.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5
6namespace eve::network {
7
8class Channel;
9
14class Session {
15public:
16 Session() = default;
17 ~Session();
18
20 void add(std::string name, Channel* ch);
22 Channel* get(std::string name);
24 void remove(std::string name);
26 void closeAll();
27
28private:
29 std::unordered_map<std::string, Channel*> channels_;
30};
31
32} // namespace eve::network
const char * name
Definition RockMesh.cpp:21
Length-prefixed (big-endian uint32) message framing over a TcpSocket. sendMsg() writes one framed mes...
Definition Channel.h:21
Named collection of Channels (a "session"). Lookup by name, close all. Does not own the channels; the...
Definition Session.h:14
void remove(std::string name)
Removes a channel from the session (does not delete it).
Definition Session.cpp:20
void add(std::string name, Channel *ch)
Registers a channel under a name (replaces an existing entry).
Definition Session.cpp:11
void closeAll()
Closes every channel in the session.
Definition Session.cpp:24
Channel * get(std::string name)
Finds a channel by name, or nullptr.
Definition Session.cpp:15