MCPcopy Create free account
hub / github.com/Kitware/VTK / Reserve

Method Reserve

IO/Import/vtkVRML.h:92–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void Reserve(int newSize)
93 {
94 if (newSize >= this->Allocated)
95 {
96 int oldSize = this->Allocated;
97 this->Allocated = newSize + DEFAULTINCREMENT;
98 T* temp = this->Data;
99 if (!this->UseNew)
100 {
101 // NOLINTNEXTLINE(bugprone-sizeof-expression)
102 void* mem = vtkVRMLAllocator::AllocateMemory(this->Allocated * sizeof(T));
103 this->Data = new (mem) T[this->Allocated];
104 }
105 else
106 {
107 this->Data = new T[this->Allocated];
108 }
109 if (this->Data == (T*)'\0')
110 {
111 return;
112 }
113 // NOLINTNEXTLINE(bugprone-sizeof-expression)
114 memcpy((void*)this->Data, (void*)temp, oldSize * sizeof(T));
115 if (this->UseNew)
116 {
117 delete[] temp;
118 }
119 }
120 }
121
122 void Demand(int newSize)
123 {

Callers 3

DemandMethod · 0.95
vtkVRMLVectorTypeClass · 0.95
PushMethod · 0.95

Calls 1

AllocateMemoryFunction · 0.85

Tested by

no test coverage detected