Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.1 KiB

  1. //====== Copyright �, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Network dirty field marker for shared objects
  4. //
  5. //=============================================================================
  6. #ifndef GC_DIRTYFIELD_H
  7. #define GC_DIRTYFIELD_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //#include "sharedobject.h"
  12. namespace GCSDK
  13. {
  14. class CSharedObject;
  15. //----------------------------------------------------------------------------
  16. // Purpose: Holds the set of dirty fields for this object
  17. //----------------------------------------------------------------------------
  18. class CSharedObjectDirtyFieldList
  19. {
  20. public:
  21. CSharedObjectDirtyFieldList( CSharedObject *obj );
  22. ~CSharedObjectDirtyFieldList();
  23. CSharedObject *Obj() const;
  24. void DirtyField( int index );
  25. void GetDirtyFieldSet( CUtlVector<int> &fieldSet ) const;
  26. private:
  27. CSharedObject *m_obj;
  28. uint32 m_firstFieldBits;
  29. CUtlVector<int> *m_pExtendedFields;
  30. };
  31. //----------------------------------------------------------------------------
  32. // Purpose: Holds a list of dirty fields on objects
  33. //----------------------------------------------------------------------------
  34. class CSharedObjectDirtyList
  35. {
  36. public:
  37. CSharedObjectDirtyList();
  38. ~CSharedObjectDirtyList();
  39. void DirtyObjectField( CSharedObject *obj, int field );
  40. int InvalidIndex() const;
  41. int NumDirtyObjects() const;
  42. int FindIndexByObj( CSharedObject *pObj );
  43. bool GetDirtyFieldSetByIndex( int index, CSharedObject **ppObj, CUtlVector<int> &fieldSet ) const;
  44. bool GetDirtyFieldSetByObj( CSharedObject *pObj, CUtlVector<int> &fieldSet );
  45. bool FindAndRemove( CSharedObject *pObj );
  46. void RemoveAll();
  47. #ifdef DBGFLAG_VALIDATE
  48. void Validate( CValidator &validator, const char *pchName );
  49. #endif
  50. private:
  51. CUtlVector< CSharedObjectDirtyFieldList > m_sharedObjectDirtyFieldList;
  52. };
  53. inline int CSharedObjectDirtyList::InvalidIndex() const
  54. {
  55. return m_sharedObjectDirtyFieldList.InvalidIndex();
  56. }
  57. inline int CSharedObjectDirtyList::NumDirtyObjects() const
  58. {
  59. return m_sharedObjectDirtyFieldList.Count();
  60. }
  61. } // GCSDK
  62. #endif //GC_DIRTYFIELD_H