VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtReservedElementsBuffer.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
6 #pragma once
7 
8 #include <vector>
9 
10 namespace makVrv
11 {
15  template <typename T>
17  {
18  public:
19 
24  DtReservedElementsBuffer(size_t initialSize, size_t growIncrement, const T& defaultValue);
25 
28 
32  size_t reserveElements(size_t elementsToReserve);
33 
38  void freeElements(size_t startIndex, size_t numberOfElements);
39 
40  // \brief Overloading [] operator to access elements in array style
41  T& operator[](int index);
42 
44  std::vector<T>& buffer();
45 
48  size_t size() const;
49 
50  protected:
51 
52  std::vector<bool> myReservedStatusBuffer;
53  std::vector<T> myElementsBuffer;
54 
58  };
59 }
60 
61 #include <vrvUtil/DtReservedElementsBuffer.inl>
T myDefaultElementValue
Definition: DtReservedElementsBuffer.h:57
Template class which implements a data structure providing management of &#39;reserved&#39; elements...
Definition: DtReservedElementsBuffer.h:16
size_t size() const
Get the size of the underlying buffer.
DtReservedElementsBuffer(size_t initialSize, size_t growIncrement, const T &defaultValue)
Constructs a reserved elements buffer.
size_t myElementsBufferSize
Definition: DtReservedElementsBuffer.h:55
size_t reserveElements(size_t elementsToReserve)
Reserve some number of contiguous elements in the buffer.
std::vector< T > myElementsBuffer
Definition: DtReservedElementsBuffer.h:53
void freeElements(size_t startIndex, size_t numberOfElements)
Free some number of contiguous elements in the buffer.
std::vector< bool > myReservedStatusBuffer
Definition: DtReservedElementsBuffer.h:52
std::vector< T > & buffer()
Get a reference to the underlying buffer.
size_t myElementsBufferGrowIncrement
Definition: DtReservedElementsBuffer.h:56

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)