MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / needPacket

Method needPacket

Engine/source/platform/async/asyncPacketQueue.h:218–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216
217template< typename Packet, typename TimeSource, typename Consumer, typename Tick >
218bool AsyncPacketQueue< Packet, TimeSource, Consumer, Tick >::needPacket()
219{
220 // Never need more packets once we have reached the
221 // end.
222
223 if( isAtEnd() )
224 return false;
225
226 // Always needs packets while the queue is not
227 // filled up completely.
228
229 if( mPacketQueue.capacity() != 0 )
230 return true;
231
232 // Unqueue packets that have expired their playtime.
233
234 TickType currentTick = getCurrentTick();
235 while( mPacketQueue.size() && currentTick >= mPacketQueue.front().mEndTick )
236 {
237 #ifdef DEBUG_SPEW
238 Platform::outputDebugString( "[AsyncPacketQueue] expired packet #%i: %i-%i (tick: %i; queue: %i)",
239 mTotalQueuedPackets - mPacketQueue.size(),
240 U32( mPacketQueue.front().mStartTick ),
241 U32( mPacketQueue.front().mEndTick ),
242 U32( currentTick ),
243 mPacketQueue.size() );
244 #endif
245
246 mPacketQueue.popFront();
247 }
248
249 // Need more packets if the queue isn't full anymore.
250
251 return ( mPacketQueue.capacity() != 0 );
252}
253
254template< typename Packet, typename TimeSource, typename Consumer, typename Tick >
255bool AsyncPacketQueue< Packet, TimeSource, Consumer, Tick >::submitPacket( Packet packet, TickType packetTicks, bool isLast, TickType packetPos )

Callers 2

refreshMethod · 0.80
updateMethod · 0.80

Calls 5

U32Enum · 0.50
capacityMethod · 0.45
sizeMethod · 0.45
frontMethod · 0.45
popFrontMethod · 0.45

Tested by

no test coverage detected