MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / reserve

Method reserve

Utils/ObjectArray.h:180–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178 }
179
180 FORCE_INLINE void reserve(const unsigned int count)
181 {
182 if (!m_data)
183 {
184 unsigned int newSize = count;
185 if(newSize < growBy)
186 newSize = growBy;
187 m_data = new T[newSize];
188 m_size = 0;
189 m_capacity = newSize;
190 }
191 else
192 {
193 if(count <= m_capacity)
194 return;
195 unsigned int newSize = m_capacity;
196 newSize = (linearGrow) ? (newSize+growBy) : (newSize*2u);
197 if (count < newSize)
198 {
199 grow();
200 return;
201 }
202 T* tmp = new T[count];
203 memcpy(tmp, m_data, sizeof(T)*m_size);
204 delete [] m_data;
205 m_data = tmp;
206 m_capacity = count;
207 }
208 }
209
210 FORCE_INLINE void resize(unsigned int count)
211 {

Callers 15

UtilitiesModuleFunction · 0.45
vector_pointer_modifiersFunction · 0.45
readRigidBodiesMethod · 0.45
readTriangleModelsMethod · 0.45
readTetModelsMethod · 0.45
initMeshMethod · 0.45
initMeshMethod · 0.45
BufferSinkMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected