TrinityCore
Loading...
Searching...
No Matches
RealmList.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _REALMLIST_H
19#define _REALMLIST_H
20
21#include "Define.h"
22#include "Realm.h"
23#include <map>
24
25namespace boost
26{
27 namespace system
28 {
29 class error_code;
30 }
31}
32
35{
36public:
37 typedef std::map<RealmHandle, Realm> RealmMap;
38
39 static RealmList* Instance();
40
42
43 void Initialize(Trinity::Asio::IoContext& ioContext, uint32 updateInterval);
44 void Close();
45
46 RealmMap const& GetRealms() const { return _realms; }
47 Realm const* GetRealm(RealmHandle const& id) const;
48
49private:
50 RealmList();
51
52 void UpdateRealms(boost::system::error_code const& error);
53 void UpdateRealm(RealmHandle const& id, uint32 build, std::string const& name,
54 boost::asio::ip::address&& address, boost::asio::ip::address&& localAddr, boost::asio::ip::address&& localSubmask,
55 uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel, float population);
56
59 std::unique_ptr<Trinity::Asio::DeadlineTimer> _updateTimer;
60 std::unique_ptr<Trinity::Asio::Resolver> _resolver;
61};
62
63#define sRealmList RealmList::Instance()
64#endif
AccountTypes
Definition Common.h:39
uint8_t uint8
Definition Define.h:135
#define TC_SHARED_API
Definition Define.h:108
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
RealmFlags
Definition Realm.h:27
Storage object for the list of realms on the server.
Definition RealmList.h:35
std::unique_ptr< Trinity::Asio::Resolver > _resolver
Definition RealmList.h:60
RealmMap _realms
Definition RealmList.h:57
std::map< RealmHandle, Realm > RealmMap
Definition RealmList.h:37
uint32 _updateInterval
Definition RealmList.h:58
std::unique_ptr< Trinity::Asio::DeadlineTimer > _updateTimer
Definition RealmList.h:59
RealmMap const & GetRealms() const
Definition RealmList.h:46
Definition Realm.h:66