21 template<
typename T,
size_t S >
27 std::deque< T > copy = from._queue;
28 const size_t maxSize = from._maxSize;
40 template<
typename T,
size_t S >
44 while( _queue.size() <= index )
47 LBASSERT( _queue.size() > index );
48 const T& element = _queue[index];
53 template<
typename T,
size_t S >
57 while( _queue.size() > maxSize )
64 template<
typename T,
size_t S >
67 LBASSERT( minSize <= _maxSize );
69 while( _queue.size() < minSize )
71 const size_t size = _queue.size();
76 template<
typename T,
size_t S >
85 template<
typename T,
size_t S >
89 while( _queue.empty( ))
92 LBASSERT( !_queue.empty( ));
93 T element = _queue.front();
100 template<
typename T,
size_t S >
104 while( _queue.empty( ))
106 if( !_cond.timedWait( timeout ))
112 LBASSERT( !_queue.empty( ));
113 element = _queue.front();
120 template<
typename T,
size_t S > std::vector< T >
122 const size_t maximum )
124 std::vector< T > result;
127 while( _queue.size() < minimum )
129 if( !_cond.timedWait( timeout ))
136 const size_t size = LB_MIN( maximum, _queue.size( ));
138 result.reserve( size );
139 result.insert( result.end(), _queue.begin(), _queue.begin() + size );
140 _queue.erase( _queue.begin(), _queue.begin() + size );
146 template<
typename T,
size_t S >
156 result = _queue.front();
163 template<
typename T,
size_t S >
167 const size_t size = LB_MIN( num, _queue.size( ));
170 result.reserve( result.size() + size );
171 for(
size_t i = 0; i < size; ++i )
173 result.push_back( _queue.front( ));
193 Group(
const size_t height ) : height_( height ), waiting_( 0 ) {}
196 void setHeight(
const size_t height ) { height_ = height; }
199 template<
typename T,
size_t S >
202 LBASSERT( barrier.height_ > 0 )
206 while( _queue.empty() && barrier.waiting_ < barrier.height_ )
211 LBASSERT( barrier.waiting_ == barrier.height_ );
217 element = _queue.front();
226 template<
typename T,
size_t S >
236 result = _queue.front();
241 template<
typename T,
size_t S >
251 result = _queue.back();
256 template<
typename T,
size_t S >
260 while( _queue.size() >= _maxSize )
262 _queue.push_back( element );
267 template<
typename T,
size_t S >
271 LBASSERT( elements.size() <= _maxSize );
272 while( (_maxSize - _queue.size( )) < elements.size( ))
274 _queue.insert( _queue.end(), elements.begin(), elements.end( ));
279 template<
typename T,
size_t S >
283 while( _queue.size() >= _maxSize )
285 _queue.push_front( element );
290 template<
typename T,
size_t S >
294 LBASSERT( elements.size() <= _maxSize );
295 while( (_maxSize - _queue.size( )) < elements.size( ))
297 _queue.insert(_queue.begin(), elements.begin(), elements.end());