26 template<
class T, Foam::label staticSize>
32 template<
class T, Foam::label staticSize>
38 template<
class T, Foam::label staticSize>
48 T* newData =
new T[
s];
50 for(
label i=0;i<nextFree_;++i)
51 newData[i] = this->
operator[](i);
53 if( nAllocated_ > staticSize )
59 else if(
s < nAllocated_ )
62 T* newData =
new T[
s];
65 newData[i] = this->
operator[](i);
75 if( nAllocated_ > staticSize )
79 staticData_[i] = dataPtr_[i];
84 dataPtr_ = staticData_;
85 nAllocated_ = staticSize;
89 template<
class T, Foam::label staticSize>
92 if( (i < 0) || (i >= nextFree_) )
96 "void Foam::DynList<T, label, Offset>::"
97 "checkIndex(const label i) const"
98 ) <<
"Index " << i <<
" is not in range " << 0
103 template<
class T, Foam::label staticSize>
106 if( nextFree_ > nAllocated_ )
109 "template<class T, Foam::label staticSize> "
110 "inline void Foam::DynList<T, staticSize>::"
111 "checkAllocation() const"
112 ) <<
"nextFree_ is out of scope 0 " <<
" and " << nAllocated_
119 template<
class T, Foam::label staticSize>
135 template<
class T, Foam::label staticSize>
150 template<
class T, Foam::label staticSize>
161 this->
operator[](i) = val;
168 template<
class T, Foam::label staticSize>
179 this->operator[](i) = ul[i];
186 template<
class T, Foam::label staticSize>
187 template<
class ListType>
196 for(
label i=0;i<nextFree_;++i)
197 this->
operator[](i) = l[i];
205 template<
class T, Foam::label staticSize>
217 for(
label i=0;i<nextFree_;++i)
218 this->
operator[](i) = dl[i];
225 template<
class T, Foam::label staticSize>
234 template<
class T, Foam::label staticSize>
244 template<
class T, Foam::label staticSize>
251 if( !contiguous<T>() )
254 <<
"Cannot return the binary size of a list of "
255 "non-primitive elements"
259 return nextFree_*
sizeof(
T);
262 template<
class T, Foam::label staticSize>
278 template<
class T, Foam::label staticSize>
289 template<
class T, Foam::label staticSize>
296 allocateSize(nextFree_);
303 template<
class T, Foam::label staticSize>
310 if( nextFree_ >= nAllocated_ )
312 const label newSize = 2*nAllocated_+2;
313 allocateSize(newSize);
320 this->operator[](nextFree_++) =
e;
323 template<
class T, Foam::label staticSize>
338 template<
class T, Foam::label staticSize>
345 for(
label i=0;i<nextFree_;++i)
347 if( this->
operator[](i) ==
e )
354 template<
class T, Foam::label staticSize>
364 for(
label i=0;i<nextFree_;++i)
366 if( this->
operator[](i) ==
e )
373 template<
class T, Foam::label staticSize>
380 return this->operator[](nextFree_-1);
383 template<
class T, Foam::label staticSize>
394 "void Foam::DynList<T, staticSize>::remove()"
398 T el = this->operator[](nextFree_-1);
403 template<
class T, Foam::label staticSize>
414 "void Foam::DynList<T, staticSize>::remove()"
418 T el = this->operator[](i);
419 this->operator[](i) = this->operator[](nextFree_-1);
429 template<
class T, Foam::label staticSize>
436 return this->operator()(i);
441 template<
class T, Foam::label staticSize>
450 if( nextFree_ >= nAllocated_ )
452 allocateSize(2 * nextFree_+1);
459 return this->operator[](i);
462 template<
class T, Foam::label staticSize>
473 template<
class T, Foam::label staticSize>
484 template<
class T, Foam::label staticSize>
491 return (index + offset) % nextFree_;
494 template<
class T, Foam::label staticSize>
501 return (index + nextFree_ - offset) % nextFree_;
504 template<
class T, Foam::label staticSize>
511 return operator[](fcIndex(index, offset));
514 template<
class T, Foam::label staticSize>
521 return operator[](rcIndex(index, offset));
524 template<
class T, Foam::label staticSize>
531 for(
label i=0;i<nextFree_;++i)
535 template<
class T, Foam::label staticSize>
545 allocateSize(dl.
size());
546 nextFree_ = dl.
size();
552 for(
label i=0;i<nextFree_;++i)
553 this->
operator[](i) = dl[i];
556 template<
class T, Foam::label staticSize>
557 template<
class ListType>
564 allocateSize(l.size());
565 nextFree_ = l.size();
571 for(
label i=0;i<nextFree_;++i)
572 this->
operator[](i) = l[i];
575 template<
class T, Foam::label staticSize>
581 if( nextFree_ != DL.nextFree_ )
585 if( this->
operator[](i) != DL[i] )
591 template<
class T, Foam::label staticSize>