TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
UpdateMask Class Reference

#include <UpdateMask.h>

Public Types

enum  UpdateMaskCount { CLIENT_UPDATE_MASK_BITS = sizeof(ClientUpdateMaskType) * 8 }
 
typedef uint32 ClientUpdateMaskType
 Type representing how client reads update mask. More...
 

Public Member Functions

 UpdateMask ()
 
 UpdateMask (UpdateMask const &right)
 
 ~UpdateMask ()
 
void SetBit (uint32 index)
 
void UnsetBit (uint32 index)
 
bool GetBit (uint32 index) const
 
void AppendToPacket (ByteBuffer *data)
 
uint32 GetBlockCount () const
 
uint32 GetCount () const
 
void SetCount (uint32 valuesCount)
 
void AddBlock ()
 
void Clear ()
 
UpdateMaskoperator= (UpdateMask const &right)
 
UpdateMaskoperator&= (UpdateMask const &right)
 
UpdateMaskoperator|= (UpdateMask const &right)
 
UpdateMask operator| (UpdateMask const &right)
 

Private Attributes

uint32 _fieldCount
 
uint32 _blockCount
 
uint8_bits
 

Member Typedef Documentation

Type representing how client reads update mask.

Member Enumeration Documentation

Enumerator
CLIENT_UPDATE_MASK_BITS 
33  {
35  };
Definition: UpdateMask.h:34
uint32 ClientUpdateMaskType
Type representing how client reads update mask.
Definition: UpdateMask.h:30

Constructor & Destructor Documentation

UpdateMask::UpdateMask ( )
inline
37 : _fieldCount(0), _blockCount(0), _bits(NULL) { }
uint32 _blockCount
Definition: UpdateMask.h:142
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 _fieldCount
Definition: UpdateMask.h:141
uint8 * _bits
Definition: UpdateMask.h:143
UpdateMask::UpdateMask ( UpdateMask const right)
inline
39  : _bits(NULL)
40  {
41  SetCount(right.GetCount());
42  memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * 32);
43  }
uint32 _blockCount
Definition: UpdateMask.h:142
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 * _bits
Definition: UpdateMask.h:143
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

UpdateMask::~UpdateMask ( )
inline
45 { delete[] _bits; }
uint8 * _bits
Definition: UpdateMask.h:143

Member Function Documentation

void UpdateMask::AddBlock ( )
inline
85  {
86  uint8* curr = _bits;
88  ++_blockCount;
89 
92  if (curr)
93  {
94  memcpy(_bits, curr, sizeof(uint8) * (_blockCount - 1) * CLIENT_UPDATE_MASK_BITS);
95  delete[] curr;
96  }
97  }
uint32 _blockCount
Definition: UpdateMask.h:142
uint32 _fieldCount
Definition: UpdateMask.h:141
Definition: UpdateMask.h:34
uint8 * _bits
Definition: UpdateMask.h:143
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

void UpdateMask::AppendToPacket ( ByteBuffer data)
inline
52  {
53  for (uint32 i = 0; i < GetBlockCount(); ++i)
54  {
55  ClientUpdateMaskType maskPart = 0;
56  for (uint32 j = 0; j < CLIENT_UPDATE_MASK_BITS; ++j)
57  if (_bits[CLIENT_UPDATE_MASK_BITS * i + j])
58  maskPart |= 1 << j;
59 
60  *data << maskPart;
61  }
62  }
uint32 GetBlockCount() const
Definition: UpdateMask.h:64
uint32_t uint32
Definition: Define.h:150
Definition: UpdateMask.h:34
uint8 * _bits
Definition: UpdateMask.h:143
uint32 ClientUpdateMaskType
Type representing how client reads update mask.
Definition: UpdateMask.h:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void UpdateMask::Clear ( )
inline
100  {
101  if (_bits)
102  memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
103  }
uint32 _blockCount
Definition: UpdateMask.h:142
Definition: UpdateMask.h:34
uint8 * _bits
Definition: UpdateMask.h:143
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

bool UpdateMask::GetBit ( uint32  index) const
inline
49 { return _bits[index] != 0; }
uint8 * _bits
Definition: UpdateMask.h:143

+ Here is the caller graph for this function:

uint32 UpdateMask::GetBlockCount ( ) const
inline
64 { return _blockCount; }
uint32 _blockCount
Definition: UpdateMask.h:142

+ Here is the caller graph for this function:

uint32 UpdateMask::GetCount ( ) const
inline
65 { return _fieldCount; }
uint32 _fieldCount
Definition: UpdateMask.h:141

+ Here is the caller graph for this function:

UpdateMask& UpdateMask::operator&= ( UpdateMask const right)
inline
116  {
117  ASSERT(right.GetCount() <= GetCount());
118  for (uint32 i = 0; i < _fieldCount; ++i)
119  _bits[i] &= right._bits[i];
120 
121  return *this;
122  }
uint32 _fieldCount
Definition: UpdateMask.h:141
uint32_t uint32
Definition: Define.h:150
uint32 GetCount() const
Definition: UpdateMask.h:65
uint8 * _bits
Definition: UpdateMask.h:143
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

UpdateMask& UpdateMask::operator= ( UpdateMask const right)
inline
106  {
107  if (this == &right)
108  return *this;
109 
110  SetCount(right.GetCount());
111  memcpy(_bits, right._bits, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
112  return *this;
113  }
uint32 _blockCount
Definition: UpdateMask.h:142
Definition: UpdateMask.h:34
uint8 * _bits
Definition: UpdateMask.h:143
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
uint8_t uint8
Definition: Define.h:152

+ Here is the call graph for this function:

UpdateMask UpdateMask::operator| ( UpdateMask const right)
inline
134  {
135  UpdateMask ret(*this);
136  ret |= right;
137  return ret;
138  }
Definition: UpdateMask.h:26
UpdateMask& UpdateMask::operator|= ( UpdateMask const right)
inline
125  {
126  ASSERT(right.GetCount() <= GetCount());
127  for (uint32 i = 0; i < _fieldCount; ++i)
128  _bits[i] |= right._bits[i];
129 
130  return *this;
131  }
uint32 _fieldCount
Definition: UpdateMask.h:141
uint32_t uint32
Definition: Define.h:150
uint32 GetCount() const
Definition: UpdateMask.h:65
uint8 * _bits
Definition: UpdateMask.h:143
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

void UpdateMask::SetBit ( uint32  index)
inline
47 { _bits[index] = 1; }
uint8 * _bits
Definition: UpdateMask.h:143

+ Here is the caller graph for this function:

void UpdateMask::SetCount ( uint32  valuesCount)
inline
68  {
69  delete[] _bits;
70 
71  _fieldCount = valuesCount;
73 
74  if (!valuesCount)
75  {
76  _bits = nullptr;
77  return;
78  }
79 
81  memset(_bits, 0, sizeof(uint8) * _blockCount * CLIENT_UPDATE_MASK_BITS);
82  }
uint32 _blockCount
Definition: UpdateMask.h:142
uint32 _fieldCount
Definition: UpdateMask.h:141
Definition: UpdateMask.h:34
uint8 * _bits
Definition: UpdateMask.h:143
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

void UpdateMask::UnsetBit ( uint32  index)
inline
48 { _bits[index] = 0; }
uint8 * _bits
Definition: UpdateMask.h:143

Member Data Documentation

uint8* UpdateMask::_bits
private
uint32 UpdateMask::_blockCount
private
uint32 UpdateMask::_fieldCount
private

The documentation for this class was generated from the following file: