bufferContextChain.I 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Filename: bufferContextChain.I
  2. // Created by: drose (16Mar06)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. ////////////////////////////////////////////////////////////////////
  15. // Function: BufferContextChain::Constructor
  16. // Access: Public
  17. // Description:
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE BufferContextChain::
  20. BufferContextChain() :
  21. LinkedListNode(true), // This object is the root of a list of BufferContexts.
  22. _total_size(0),
  23. _count(0)
  24. {
  25. }
  26. ////////////////////////////////////////////////////////////////////
  27. // Function: BufferContextChain::Destructor
  28. // Access: Public
  29. // Description:
  30. ////////////////////////////////////////////////////////////////////
  31. INLINE BufferContextChain::
  32. ~BufferContextChain() {
  33. nassertv(_total_size == 0 && _count == 0);
  34. }
  35. ////////////////////////////////////////////////////////////////////
  36. // Function: BufferContextChain::get_total_size
  37. // Access: Public
  38. // Description: Returns the total number of bytes represented by the
  39. // BufferContexts currently assigned to this tracker.
  40. ////////////////////////////////////////////////////////////////////
  41. INLINE size_t BufferContextChain::
  42. get_total_size() const {
  43. return _total_size;
  44. }
  45. ////////////////////////////////////////////////////////////////////
  46. // Function: BufferContextChain::get_count
  47. // Access: Public
  48. // Description: Returns the total number of BufferContexts currently
  49. // assigned to this tracker.
  50. ////////////////////////////////////////////////////////////////////
  51. INLINE int BufferContextChain::
  52. get_count() const {
  53. return _count;
  54. }
  55. ////////////////////////////////////////////////////////////////////
  56. // Function: BufferContextChain::adjust_bytes
  57. // Access: Private
  58. // Description: Adds or removes some from the total byte count.
  59. ////////////////////////////////////////////////////////////////////
  60. INLINE void BufferContextChain::
  61. adjust_bytes(int delta) {
  62. _total_size += delta;
  63. }