use std copy function instead of a while loop

This commit is contained in:
Volker Fischer 2013-12-24 09:59:27 +00:00
parent 575cf722d9
commit bc3098ab79

View File

@ -446,29 +446,27 @@ public:
bool Put ( const CVector<TData>& vecsData ) bool Put ( const CVector<TData>& vecsData )
{ {
// calculate the input size and the end position after copying
const int iVecSize = vecsData.Size(); const int iVecSize = vecsData.Size();
const int iEnd = iPutPos + iVecSize;
// copy new data in internal buffer
int iCurPos = 0;
const int iEnd = iPutPos + iVecSize;
// first check for buffer overrun // first check for buffer overrun
if ( iEnd <= iMemSize ) if ( iEnd <= iMemSize )
{ {
// actual copy operation // copy new data in internal buffer
while ( iPutPos < iEnd ) std::copy ( vecsData.begin(),
{ vecsData.begin() + iVecSize,
vecsMemory[iPutPos++] = vecsData[iCurPos++]; vecsMemory.begin() + iPutPos );
}
// set buffer pointer one block further
iPutPos = iEnd;
// return "buffer is ready for readout" flag // return "buffer is ready for readout" flag
return ( iEnd == iMemSize ); return ( iEnd == iMemSize );
} }
else
{ // buffer overrun or not initialized, return "not ready"
// buffer overrun or not initialized, return "not ready" return false;
return false;
}
} }
CVector<TData> Get() CVector<TData> Get()