TrinityCore
Loading...
Searching...
No Matches
GroupMgr.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 _GROUPMGR_H
19#define _GROUPMGR_H
20
21#include "ObjectGuid.h"
22#include <map>
23
24class Group;
25
27{
28private:
29 GroupMgr();
30 ~GroupMgr();
31
32public:
33 GroupMgr(GroupMgr const&) = delete;
34 GroupMgr(GroupMgr&&) = delete;
35 GroupMgr& operator=(GroupMgr const&) = delete;
37
38 static GroupMgr* instance();
39
40 typedef std::map<ObjectGuid::LowType, Group*> GroupContainer;
41 typedef std::vector<Group*> GroupDbContainer;
42
43 Group* GetGroupByGUID(ObjectGuid const& guid) const;
44
45 uint32 GenerateNewGroupDbStoreId();
46 void RegisterGroupDbStoreId(uint32 storageId, Group* group);
47 void FreeGroupDbStoreId(Group* group);
48 void SetNextGroupDbStoreId(uint32 storageId) { NextGroupDbStoreId = storageId; }
49 Group* GetGroupByDbStoreId(uint32 storageId) const;
50 void SetGroupDbStoreSize(uint32 newSize);
51
52 void Update(uint32 diff);
53
54 void LoadGroups();
55 ObjectGuid::LowType GenerateGroupId();
56 void AddGroup(Group* group);
57 void RemoveGroup(Group* group);
58
59protected:
64};
65
66#define sGroupMgr GroupMgr::instance()
67
68#endif
#define TC_GAME_API
Definition Define.h:129
uint32_t uint32
Definition Define.h:154
std::map< ObjectGuid::LowType, Group * > GroupContainer
Definition GroupMgr.h:40
GroupMgr(GroupMgr const &)=delete
GroupMgr(GroupMgr &&)=delete
ObjectGuid::LowType NextGroupId
Definition GroupMgr.h:60
void SetNextGroupDbStoreId(uint32 storageId)
Definition GroupMgr.h:48
std::vector< Group * > GroupDbContainer
Definition GroupMgr.h:41
GroupDbContainer GroupDbStore
Definition GroupMgr.h:63
uint32 NextGroupDbStoreId
Definition GroupMgr.h:61
GroupMgr & operator=(GroupMgr const &)=delete
GroupMgr & operator=(GroupMgr &&)=delete
GroupContainer GroupStore
Definition GroupMgr.h:62
Definition Group.h:205
uint64 LowType
Definition ObjectGuid.h:321