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 
23  DtReservedElementsBuffer(size_t initialSize, size_t growIncrement, const T& defaultValue);
24 
27 
31  size_t reserveElements(size_t elementsToReserve);
32 
37  void freeElements(size_t startIndex, size_t numberOfElements);
38 
39  // \brief Overloading [] operator to access elements in array style
40  T& operator[](int index);
41 
43  std::vector<T>& buffer();
44 
47  size_t size() const;
48 
49  protected:
50 
51  std::vector<bool> myReservedStatusBuffer;
52  std::vector<T> myElementsBuffer;
53 
57  };
58 }
59 
60 #include <vrvUtil/DtReservedElementsBuffer.inl>
T myDefaultElementValue
Definition: DtReservedElementsBuffer.h:56
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:54
size_t reserveElements(size_t elementsToReserve)
Reserve some number of contiguous elements in the buffer.
std::vector< T > myElementsBuffer
Definition: DtReservedElementsBuffer.h:52
void freeElements(size_t startIndex, size_t numberOfElements)
Free some number of contiguous elements in the buffer.
std::vector< bool > myReservedStatusBuffer
Definition: DtReservedElementsBuffer.h:51
std::vector< T > & buffer()
Get a reference to the underlying buffer.
size_t myElementsBufferGrowIncrement
Definition: DtReservedElementsBuffer.h:55

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)