Horizon Official Technical Documentation
ClientInterface.hpp
Go to the documentation of this file.
1/***************************************************
2 * _ _ _ *
3 * | | | | (_) *
4 * | |_| | ___ _ __ _ _______ _ __ *
5 * | _ |/ _ \| '__| |_ / _ \| '_ \ *
6 * | | | | (_) | | | |/ / (_) | | | | *
7 * \_| |_/\___/|_| |_/___\___/|_| |_| *
8 ***************************************************
9 * This file is part of Horizon (c).
10 * Copyright (c) 2020- Horizon Dev Team.
11 *
12 * Base Author - Sagun Khosla. (sagunxp@gmail.com)
13 *
14 * This library is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this library. If not, see <http://www.gnu.org/licenses/>.
26 **************************************************/
27
28#ifndef HORIZON_CLIENTINTERFACE_HPP
29#define HORIZON_CLIENTINTERFACE_HPP
30
31#include <memory>
32
33namespace Horizon
34{
35
36template <typename SessionType>
38{
39public:
40 ClientInterface(std::shared_ptr<SessionType> s) : _session(s) { }
42
43 std::shared_ptr<SessionType> get_session() { return _session.lock(); }
44 void set_session(std::shared_ptr<SessionType> s) { _session = s; }
45
46private:
47 std::weak_ptr<SessionType> _session;
48};
49
50}
51
52#endif /* HORIZON_CLIENTINTERFACE_HPP */
Definition: ClientInterface.hpp:38
ClientInterface(std::shared_ptr< SessionType > s)
Definition: ClientInterface.hpp:40
void set_session(std::shared_ptr< SessionType > s)
Definition: ClientInterface.hpp:44
std::shared_ptr< SessionType > get_session()
Definition: ClientInterface.hpp:43
std::weak_ptr< SessionType > _session
Definition: ClientInterface.hpp:47
~ClientInterface()
Definition: ClientInterface.hpp:41
Definition: Element.hpp:7