OregonCore  revision be9e804-git
Your Favourite TBC server
UpdateMask Class Reference

#include <UpdateMask.h>

Public Member Functions

 UpdateMask ()
 
 UpdateMask (const UpdateMask &mask)
 
 ~UpdateMask ()
 
void SetBit (uint32 index)
 
void UnsetBit (uint32 index)
 
bool GetBit (uint32 index)
 
uint32 GetBlockCount ()
 
uint32 GetLength ()
 
uint32 GetCount ()
 
uint8GetMask ()
 
void SetCount (uint32 valuesCount)
 
void Clear ()
 
UpdateMaskoperator= (const UpdateMask &mask)
 
void operator&= (const UpdateMask &mask)
 
void operator|= (const UpdateMask &mask)
 
UpdateMask operator& (const UpdateMask &mask) const
 
UpdateMask operator| (const UpdateMask &mask) const
 

Private Attributes

uint32 mCount
 
uint32 mBlocks
 
uint32mUpdateMask
 

Detailed Description

Definition at line 24 of file UpdateMask.h.

Constructor & Destructor Documentation

UpdateMask::UpdateMask ( )
inline

Definition at line 27 of file UpdateMask.h.

27 : mCount(0), mBlocks(0), mUpdateMask(0) { }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 mCount
Definition: UpdateMask.h:134
UpdateMask::UpdateMask ( const UpdateMask mask)
inline

Definition at line 28 of file UpdateMask.h.

28  : mUpdateMask(0)
29  {
30  *this = mask;
31  }
uint32 * mUpdateMask
Definition: UpdateMask.h:136
UpdateMask::~UpdateMask ( )
inline

Definition at line 33 of file UpdateMask.h.

References mUpdateMask.

34  {
35  if (mUpdateMask)
36  delete [] mUpdateMask;
37  }
uint32 * mUpdateMask
Definition: UpdateMask.h:136

Member Function Documentation

void UpdateMask::Clear ( void  )
inline

Definition at line 83 of file UpdateMask.h.

References mBlocks, and mUpdateMask.

84  {
85  if (mUpdateMask)
86  memset(mUpdateMask, 0, mBlocks << 2);
87  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
bool UpdateMask::GetBit ( uint32  index)
inline

Definition at line 49 of file UpdateMask.h.

References mUpdateMask.

Referenced by Object::_BuildValuesUpdate(), and Player::_SetCreateBits().

50  {
51  return (((uint8*)mUpdateMask)[ index >> 3 ] & (1 << (index & 0x7))) != 0;
52  }
ACE_UINT8 uint8
Definition: Define.h:73
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 UpdateMask::GetBlockCount ( )
inline

Definition at line 54 of file UpdateMask.h.

References mBlocks.

Referenced by Object::_BuildValuesUpdate().

55  {
56  return mBlocks;
57  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 UpdateMask::GetCount ( )
inline

Definition at line 62 of file UpdateMask.h.

References mCount.

Referenced by Object::_BuildValuesUpdate().

63  {
64  return mCount;
65  }
uint32 mCount
Definition: UpdateMask.h:134
uint32 UpdateMask::GetLength ( )
inline

Definition at line 58 of file UpdateMask.h.

References mBlocks.

Referenced by Object::_BuildValuesUpdate().

59  {
60  return mBlocks << 2;
61  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint8* UpdateMask::GetMask ( )
inline

Definition at line 66 of file UpdateMask.h.

References mUpdateMask.

Referenced by Object::_BuildValuesUpdate().

67  {
68  return (uint8*)mUpdateMask;
69  }
ACE_UINT8 uint8
Definition: Define.h:73
uint32 * mUpdateMask
Definition: UpdateMask.h:136
UpdateMask UpdateMask::operator& ( const UpdateMask mask) const
inline

Definition at line 111 of file UpdateMask.h.

References ASSERT, and mCount.

112  {
113  ASSERT(mask.mCount <= mCount);
114 
115  UpdateMask newmask;
116  newmask = *this;
117  newmask &= mask;
118 
119  return newmask;
120  }
uint32 mCount
Definition: UpdateMask.h:134
#define ASSERT
Definition: Errors.h:29
void UpdateMask::operator&= ( const UpdateMask mask)
inline

Definition at line 97 of file UpdateMask.h.

References ASSERT, mBlocks, mCount, and mUpdateMask.

98  {
99  ASSERT(mask.mCount <= mCount);
100  for (uint32 i = 0; i < mBlocks; i++)
101  mUpdateMask[i] &= mask.mUpdateMask[i];
102  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 mCount
Definition: UpdateMask.h:134
#define ASSERT
Definition: Errors.h:29
ACE_UINT32 uint32
Definition: Define.h:71
UpdateMask& UpdateMask::operator= ( const UpdateMask mask)
inline

Definition at line 89 of file UpdateMask.h.

References mBlocks, mCount, mUpdateMask, and SetCount().

90  {
91  SetCount(mask.mCount);
92  memcpy(mUpdateMask, mask.mUpdateMask, mBlocks << 2);
93 
94  return *this;
95  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 mCount
Definition: UpdateMask.h:134
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:71
UpdateMask UpdateMask::operator| ( const UpdateMask mask) const
inline

Definition at line 122 of file UpdateMask.h.

References ASSERT, and mCount.

123  {
124  ASSERT(mask.mCount <= mCount);
125 
126  UpdateMask newmask;
127  newmask = *this;
128  newmask |= mask;
129 
130  return newmask;
131  }
uint32 mCount
Definition: UpdateMask.h:134
#define ASSERT
Definition: Errors.h:29
void UpdateMask::operator|= ( const UpdateMask mask)
inline

Definition at line 104 of file UpdateMask.h.

References ASSERT, mBlocks, mCount, and mUpdateMask.

105  {
106  ASSERT(mask.mCount <= mCount);
107  for (uint32 i = 0; i < mBlocks; i++)
108  mUpdateMask[i] |= mask.mUpdateMask[i];
109  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 mCount
Definition: UpdateMask.h:134
#define ASSERT
Definition: Errors.h:29
ACE_UINT32 uint32
Definition: Define.h:71
void UpdateMask::SetBit ( uint32  index)
inline

Definition at line 39 of file UpdateMask.h.

References mUpdateMask.

Referenced by Object::_BuildValuesUpdate(), Object::_SetCreateBits(), Player::_SetCreateBits(), Object::_SetUpdateBits(), and Player::InitVisibleBits().

40  {
41  ((uint8*)mUpdateMask)[ index >> 3 ] |= 1 << (index & 0x7);
42  }
ACE_UINT8 uint8
Definition: Define.h:73
uint32 * mUpdateMask
Definition: UpdateMask.h:136
void UpdateMask::SetCount ( uint32  valuesCount)
inline

Definition at line 71 of file UpdateMask.h.

References mBlocks, mCount, and mUpdateMask.

Referenced by Object::BuildCreateUpdateBlockForPlayer(), Object::BuildValuesUpdateBlockForPlayer(), Player::InitVisibleBits(), and operator=().

72  {
73  if (mUpdateMask)
74  delete [] mUpdateMask;
75 
76  mCount = valuesCount;
77  mBlocks = (valuesCount + 31) / 32;
78 
79  mUpdateMask = new uint32[mBlocks];
80  memset(mUpdateMask, 0, mBlocks << 2);
81  }
uint32 mBlocks
Definition: UpdateMask.h:135
uint32 * mUpdateMask
Definition: UpdateMask.h:136
uint32 mCount
Definition: UpdateMask.h:134
ACE_UINT32 uint32
Definition: Define.h:71
void UpdateMask::UnsetBit ( uint32  index)
inline

Definition at line 44 of file UpdateMask.h.

References mUpdateMask.

45  {
46  ((uint8*)mUpdateMask)[ index >> 3 ] &= (0xff ^ (1 << (index & 0x7)));
47  }
ACE_UINT8 uint8
Definition: Define.h:73
uint32 * mUpdateMask
Definition: UpdateMask.h:136

Member Data Documentation

uint32 UpdateMask::mBlocks
private

Definition at line 135 of file UpdateMask.h.

Referenced by Clear(), GetBlockCount(), GetLength(), operator&=(), operator=(), operator|=(), and SetCount().

uint32 UpdateMask::mCount
private

Definition at line 134 of file UpdateMask.h.

Referenced by GetCount(), operator&(), operator&=(), operator=(), operator|(), operator|=(), and SetCount().

uint32* UpdateMask::mUpdateMask
private

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