TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ObjectGuid.h File Reference
#include "Common.h"
#include "ByteBuffer.h"
#include <type_traits>
#include <functional>
+ Include dependency graph for ObjectGuid.h:

Go to the source code of this file.

Classes

struct  ObjectGuidTraits< high >
 
class  ObjectGuid
 
class  PackedGuid
 
class  ObjectGuidGeneratorBase
 
class  ObjectGuidGenerator< high >
 
struct  std::hash< ObjectGuid >
 

Macros

#define NUM_CLIENT_OBJECT_TYPES   11
 
#define GUID_TRAIT_GLOBAL(highguid)
 
#define GUID_TRAIT_REALM_SPECIFIC(highguid)
 
#define GUID_TRAIT_MAP_SPECIFIC(highguid)
 
#define PACKED_GUID_MIN_BUFFER_SIZE   18
 

Typedefs

typedef std::set< ObjectGuidGuidSet
 
typedef std::list< ObjectGuidGuidList
 
typedef std::deque< ObjectGuidGuidDeque
 
typedef std::vector< ObjectGuidGuidVector
 
typedef std::unordered_set
< ObjectGuid
GuidUnorderedSet
 

Enumerations

enum  TypeID {
  TYPEID_OBJECT = 0, TYPEID_ITEM = 1, TYPEID_CONTAINER = 2, TYPEID_UNIT = 3,
  TYPEID_PLAYER = 4, TYPEID_GAMEOBJECT = 5, TYPEID_DYNAMICOBJECT = 6, TYPEID_CORPSE = 7,
  TYPEID_AREATRIGGER = 8, TYPEID_SCENEOBJECT = 9, TYPEID_CONVERSATION = 10
}
 
enum  TypeMask {
  TYPEMASK_OBJECT = 0x0001, TYPEMASK_ITEM = 0x0002, TYPEMASK_CONTAINER = 0x0004, TYPEMASK_UNIT = 0x0008,
  TYPEMASK_PLAYER = 0x0010, TYPEMASK_GAMEOBJECT = 0x0020, TYPEMASK_DYNAMICOBJECT = 0x0040, TYPEMASK_CORPSE = 0x0080,
  TYPEMASK_AREATRIGGER = 0x0100, TYPEMASK_SCENEOBJECT = 0x0200, TYPEMASK_CONVERSATION = 0x0400, TYPEMASK_SEER = TYPEMASK_PLAYER | TYPEMASK_UNIT | TYPEMASK_DYNAMICOBJECT
}
 
enum  HighGuid {
  HighGuid::Null = 0, HighGuid::Uniq = 1, HighGuid::Player = 2, HighGuid::Item = 3,
  HighGuid::WorldTransaction = 4, HighGuid::StaticDoor = 5, HighGuid::Transport = 6, HighGuid::Conversation = 7,
  HighGuid::Creature = 8, HighGuid::Vehicle = 9, HighGuid::Pet = 10, HighGuid::GameObject = 11,
  HighGuid::DynamicObject = 12, HighGuid::AreaTrigger = 13, HighGuid::Corpse = 14, HighGuid::LootObject = 15,
  HighGuid::SceneObject = 16, HighGuid::Scenario = 17, HighGuid::AIGroup = 18, HighGuid::DynamicDoor = 19,
  HighGuid::ClientActor = 20, HighGuid::Vignette = 21, HighGuid::CallForHelp = 22, HighGuid::AIResource = 23,
  HighGuid::AILock = 24, HighGuid::AILockTicket = 25, HighGuid::ChatChannel = 26, HighGuid::Party = 27,
  HighGuid::Guild = 28, HighGuid::WowAccount = 29, HighGuid::BNetAccount = 30, HighGuid::GMTask = 31,
  HighGuid::MobileSession = 32, HighGuid::RaidGroup = 33, HighGuid::Spell = 34, HighGuid::Mail = 35,
  HighGuid::WebObj = 36, HighGuid::LFGObject = 37, HighGuid::LFGList = 38, HighGuid::UserRouter = 39,
  HighGuid::PVPQueueGroup = 40, HighGuid::UserClient = 41, HighGuid::PetBattle = 42, HighGuid::UniqUserClient = 43,
  HighGuid::BattlePet = 44, HighGuid::CommerceObj = 45, HighGuid::ClientSession = 46, HighGuid::Count
}
 

Functions

 GUID_TRAIT_REALM_SPECIFIC (HighGuid::Item) class ObjectGuid
 
TC_GAME_API ByteBufferoperator<< (ByteBuffer &buf, ObjectGuid const &guid)
 
TC_GAME_API ByteBufferoperator>> (ByteBuffer &buf, ObjectGuid &guid)
 
TC_GAME_API ByteBufferoperator<< (ByteBuffer &buf, PackedGuid const &guid)
 
TC_GAME_API std::ostream & operator<< (std::ostream &stream, ObjectGuid const &guid)
 

Macro Definition Documentation

#define GUID_TRAIT_GLOBAL (   highguid)
Value:
template<> struct ObjectGuidTraits<highguid> \
{ \
static bool const Global = true; \
static bool const RealmSpecific = false; \
static bool const MapSpecific = false; \
};
static bool const MapSpecific
Definition: ObjectGuid.h:118
static bool const RealmSpecific
Definition: ObjectGuid.h:117
Definition: ObjectGuid.h:114
static bool const Global
Definition: ObjectGuid.h:116
#define GUID_TRAIT_MAP_SPECIFIC (   highguid)
Value:
template<> struct ObjectGuidTraits<highguid> \
{ \
static bool const Global = false; \
static bool const RealmSpecific = false; \
static bool const MapSpecific = true; \
};
static bool const MapSpecific
Definition: ObjectGuid.h:118
static bool const RealmSpecific
Definition: ObjectGuid.h:117
Definition: ObjectGuid.h:114
static bool const Global
Definition: ObjectGuid.h:116
#define GUID_TRAIT_REALM_SPECIFIC (   highguid)
Value:
template<> struct ObjectGuidTraits<highguid> \
{ \
static bool const Global = false; \
static bool const RealmSpecific = true; \
static bool const MapSpecific = false; \
};
static bool const MapSpecific
Definition: ObjectGuid.h:118
static bool const RealmSpecific
Definition: ObjectGuid.h:117
Definition: ObjectGuid.h:114
static bool const Global
Definition: ObjectGuid.h:116
#define NUM_CLIENT_OBJECT_TYPES   11
#define PACKED_GUID_MIN_BUFFER_SIZE   18

Typedef Documentation

typedef std::deque<ObjectGuid> GuidDeque
typedef std::list<ObjectGuid> GuidList
typedef std::set<ObjectGuid> GuidSet
typedef std::unordered_set<ObjectGuid> GuidUnorderedSet
typedef std::vector<ObjectGuid> GuidVector

Enumeration Type Documentation

enum HighGuid
strong
Enumerator
Null 
Uniq 
Player 
Item 
WorldTransaction 
StaticDoor 
Transport 
Conversation 
Creature 
Vehicle 
Pet 
GameObject 
DynamicObject 
AreaTrigger 
Corpse 
LootObject 
SceneObject 
Scenario 
AIGroup 
DynamicDoor 
ClientActor 
Vignette 
CallForHelp 
AIResource 
AILock 
AILockTicket 
ChatChannel 
Party 
Guild 
WowAccount 
BNetAccount 
GMTask 
MobileSession 
RaidGroup 
Spell 
Mail 
WebObj 
LFGObject 
LFGList 
UserRouter 
PVPQueueGroup 
UserClient 
PetBattle 
UniqUserClient 
BattlePet 
CommerceObj 
ClientSession 
Count 
61 {
62  Null = 0,
63  Uniq = 1,
64  Player = 2,
65  Item = 3,
66  WorldTransaction = 4,
67  StaticDoor = 5, //NYI
68  Transport = 6,
69  Conversation = 7,
70  Creature = 8,
71  Vehicle = 9,
72  Pet = 10,
73  GameObject = 11,
74  DynamicObject = 12,
75  AreaTrigger = 13,
76  Corpse = 14,
77  LootObject = 15,
78  SceneObject = 16,
79  Scenario = 17,
80  AIGroup = 18,
81  DynamicDoor = 19,
82  ClientActor = 20, //NYI
83  Vignette = 21,
84  CallForHelp = 22,
85  AIResource = 23,
86  AILock = 24,
87  AILockTicket = 25,
88  ChatChannel = 26,
89  Party = 27,
90  Guild = 28,
91  WowAccount = 29,
92  BNetAccount = 30,
93  GMTask = 31,
94  MobileSession = 32, //NYI
95  RaidGroup = 33,
96  Spell = 34,
97  Mail = 35,
98  WebObj = 36, //NYI
99  LFGObject = 37, //NYI
100  LFGList = 38, //NYI
101  UserRouter = 39,
102  PVPQueueGroup = 40,
103  UserClient = 41,
104  PetBattle = 42, //NYI
105  UniqUserClient = 43,
106  BattlePet = 44,
107  CommerceObj = 45,
108  ClientSession = 46,
109 
110  Count,
111 };
Definition: Corpse.h:49
Definition: Vehicle.h:32
Definition: Transport.h:28
Definition: Creature.h:467
Definition: Mail.h:166
Definition: DynamicObject.h:35
size_t Count(ContainerMapList< SPECIFIC_TYPE > const &elements, SPECIFIC_TYPE *)
Definition: TypeContainerFunctions.h:132
Definition: Item.h:259
Definition: GameObject.h:880
Definition: Guild.h:320
Definition: Pet.h:46
Definition: AreaTrigger.h:26
Definition: Spell.h:294
enum TypeID
Enumerator
TYPEID_OBJECT 
TYPEID_ITEM 
TYPEID_CONTAINER 
TYPEID_UNIT 
TYPEID_PLAYER 
TYPEID_GAMEOBJECT 
TYPEID_DYNAMICOBJECT 
TYPEID_CORPSE 
TYPEID_AREATRIGGER 
TYPEID_SCENEOBJECT 
TYPEID_CONVERSATION 
28 {
29  TYPEID_OBJECT = 0,
30  TYPEID_ITEM = 1,
31  TYPEID_CONTAINER = 2,
32  TYPEID_UNIT = 3,
33  TYPEID_PLAYER = 4,
36  TYPEID_CORPSE = 7,
40 };
Definition: ObjectGuid.h:31
Definition: ObjectGuid.h:36
Definition: ObjectGuid.h:32
Definition: ObjectGuid.h:37
Definition: ObjectGuid.h:39
Definition: ObjectGuid.h:34
Definition: ObjectGuid.h:29
Definition: ObjectGuid.h:38
Definition: ObjectGuid.h:33
Definition: ObjectGuid.h:35
Definition: ObjectGuid.h:30
enum TypeMask
Enumerator
TYPEMASK_OBJECT 
TYPEMASK_ITEM 
TYPEMASK_CONTAINER 
TYPEMASK_UNIT 
TYPEMASK_PLAYER 
TYPEMASK_GAMEOBJECT 
TYPEMASK_DYNAMICOBJECT 
TYPEMASK_CORPSE 
TYPEMASK_AREATRIGGER 
TYPEMASK_SCENEOBJECT 
TYPEMASK_CONVERSATION 
TYPEMASK_SEER 
45 {
46  TYPEMASK_OBJECT = 0x0001,
47  TYPEMASK_ITEM = 0x0002,
48  TYPEMASK_CONTAINER = 0x0004,
49  TYPEMASK_UNIT = 0x0008,
50  TYPEMASK_PLAYER = 0x0010,
51  TYPEMASK_GAMEOBJECT = 0x0020,
52  TYPEMASK_DYNAMICOBJECT = 0x0040,
53  TYPEMASK_CORPSE = 0x0080,
54  TYPEMASK_AREATRIGGER = 0x0100,
55  TYPEMASK_SCENEOBJECT = 0x0200,
56  TYPEMASK_CONVERSATION = 0x0400,
58 };
Definition: ObjectGuid.h:47
Definition: ObjectGuid.h:50
Definition: ObjectGuid.h:46
Definition: ObjectGuid.h:56
Definition: ObjectGuid.h:49
Definition: ObjectGuid.h:51
Definition: ObjectGuid.h:57
Definition: ObjectGuid.h:54
Definition: ObjectGuid.h:48
Definition: ObjectGuid.h:55
Definition: ObjectGuid.h:53
Definition: ObjectGuid.h:52

Function Documentation

GUID_TRAIT_REALM_SPECIFIC ( HighGuid::Item  )
TC_GAME_API ByteBuffer& operator<< ( ByteBuffer buf,
ObjectGuid const guid 
)
147 {
148  uint8 lowMask = 0;
149  uint8 highMask = 0;
150  buf.FlushBits(); // flush any unwritten bits to make wpos return a meaningful value
151  std::size_t pos = buf.wpos();
152  buf << uint8(lowMask);
153  buf << uint8(highMask);
154 
155  uint8 packed[8];
156  if (size_t packedSize = ByteBuffer::PackUInt64(guid._low, &lowMask, packed))
157  buf.append(packed, packedSize);
158  if (size_t packedSize = ByteBuffer::PackUInt64(guid._high, &highMask, packed))
159  buf.append(packed, packedSize);
160 
161  buf.put(pos, lowMask);
162  buf.put(pos + 1, highMask);
163 
164  return buf;
165 }
void FlushBits()
Definition: ByteBuffer.h:150
size_t wpos() const
Definition: ByteBuffer.h:454
static size_t PackUInt64(uint64 value, uint8 *mask, uint8 *result)
Definition: ByteBuffer.h:660
void put(size_t pos, T value)
Definition: ByteBuffer.h:227
void append(T value)
Definition: ByteBuffer.h:143
uint8_t uint8
Definition: g3dmath.h:164
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

TC_GAME_API ByteBuffer& operator<< ( ByteBuffer buf,
PackedGuid const guid 
)
177 {
178  buf.append(guid._packedGuid);
179  return buf;
180 }
void append(T value)
Definition: ByteBuffer.h:143

+ Here is the call graph for this function:

TC_GAME_API std::ostream& operator<< ( std::ostream &  stream,
ObjectGuid const guid 
)
183 {
184  std::ostringstream tmp;
185  tmp << std::hex << std::setw(16) << std::setfill('0') << guid._high << std::setw(16) << std::setfill('0') << guid._low;
186  stream << tmp.str();
187  return stream;
188 }
IntFormatSpec< int, TypeSpec<'x'> > hex(int value)

+ Here is the call graph for this function:

TC_GAME_API ByteBuffer& operator>> ( ByteBuffer buf,
ObjectGuid guid 
)
168 {
169  uint8 lowMask, highMask;
170  buf >> lowMask >> highMask;
171  buf.ReadPackedUInt64(lowMask, guid._low);
172  buf.ReadPackedUInt64(highMask, guid._high);
173  return buf;
174 }
void ReadPackedUInt64(uint64 &guid)
Definition: ByteBuffer.h:511
uint64 _low
Definition: ObjectGuid.h:325
uint8_t uint8
Definition: Define.h:152
uint64 _high
Definition: ObjectGuid.h:326

+ Here is the call graph for this function: