Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

template<class ArrayT>
bool Impala::Core::Vector::VectorSet< ArrayT >::Reserve ( int  newCapacity,
bool  copyData 
) [inline]

Definition at line 185 of file VectorSet.h.

References Impala::Core::Vector::VectorSet< ArrayT >::mCapacity, Impala::Core::Vector::VectorSet< ArrayT >::mFirst, Impala::Core::Vector::VectorSet< ArrayT >::mHasConstVecSize, Impala::Core::Vector::VectorSet< ArrayT >::mLast, Impala::Core::Vector::VectorSet< ArrayT >::mLength, Impala::Core::Vector::VectorSet< ArrayT >::mStorage, Impala::Core::Vector::VectorSet< ArrayT >::mVecSize, and Impala::Core::Vector::SetPart().

Referenced by Impala::Core::Vector::VectorSet< ArrayT >::AddVector(), Impala::Core::Vector::VectorSet< ArrayT >::AllocateVector(), and Impala::Core::Histogram::MakeHistogram1dSet().

00186     {
00187         if (newCapacity == mCapacity)
00188             return true;
00189         int common = (newCapacity > mCapacity) ? mCapacity : newCapacity;
00190         mCapacity = newCapacity;
00191         ArrayT* newStorage = new ArrayT(mVecSize, mCapacity, 0, 0);
00192         if (newStorage == 0)
00193         {
00194             std::cout << "VectorSet: could not resize, no memory" << std::endl;
00195             return false;
00196         }
00197         Array::Array2dScalarInt32* newFirst;
00198         Array::Array2dScalarInt32* newLength;
00199         if (!mHasConstVecSize)
00200         {
00201             newFirst = new Array::Array2dScalarInt32(mCapacity, 1, 0, 0);
00202             newLength = new Array::Array2dScalarInt32(mCapacity, 1, 0, 0);
00203             if ((newFirst == 0) || (newLength == 0))
00204             {
00205                 std::cout << "VectorSet: could not resize, no memory" << std::endl;
00206                 return false;
00207             }
00208         }
00209         if (copyData)
00210         {
00211             Array::SetPart(newStorage, mStorage, 0, 0, mVecSize, common, 0, 0);
00212             if (!mHasConstVecSize)
00213             {
00214                 Array::SetPart(newFirst, mFirst, 0, 0, common, 1, 0, 0);
00215                 Array::SetPart(newLength, mLength, 0, 0, common, 1, 0, 0);
00216             }
00217         }
00218         delete mStorage;
00219         mStorage = newStorage;
00220         if (!mHasConstVecSize)
00221         {
00222             delete mFirst;
00223             delete mLength;
00224             mFirst = newFirst;
00225             mLength = newLength;
00226         }
00227         if (mLast > mCapacity)
00228             mLast = mCapacity;
00229         return true;
00230     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:21:38 2011 for ImpalaSrc by  doxygen 1.5.1