Kaim::QueryQueue Class Reference

Kaim::QueryQueue Class Reference
+ Related help topics:

#include <queryqueue.h>

Class Description

QueryQueue processes queries in an asynchronous, time-sliced way, within a QueryQueueArray.

Each QueryQueue has its own WorkingMemory, time budget...

+ Examples:

Inherits Kaim::RefCountBase< C, Stat >.

Public Member Functions

void PushBack (IQuery *query)
 Must be called from the main thread. More...
 
void Cancel (IQuery *query)
 Must be called from the main thread. More...
 
void Process ()
 Process the Queries in the QueryQueue until the budget is spent. More...
 
void FlushCommands ()
 When QueryQueue is part of A QueryQueueArray and this QueryQueue runs within the World::Update(), QueryQueue::FlushCommands() is called at the beginning of World::Update(). More...
 
void FlushQueries ()
 When QueryQueue is part of A QueryQueueArray, QueryQueue::FlushQueries() is called in the World::Update() just after the World::ProcessQueuesInWorldUpdate() step. More...
 
KyUInt32 GetPendingOperationCount () const
 GetCommandCount() + GetQueryCount() More...
 
const QueryQueueStatsGetStats () const
 Previous value of GetMsSpentInProcess(). Call this for statitics on the time spent in Process(). More...
 
void DoSendVisualDebug (VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent, KyUInt32 queueIndex, KyUInt32 elementId, KyUInt32 queueArrayProcessMode)
 When QueryQueue is part of A QueryQueueArray, call within QueryQueueArray::DoSendVisualDebug(). More...
 

Protected Attributes

CircularArray< QueryQueueCommand, MemStat_QuerySystem > m_commands
 Postpone PushBack() and Cancel() until next ConsumeCommands(). More...
 
CircularArray< Ptr< IQuery >, MemStat_QuerySystem > m_queries
 Queries to process, this includes queries that have been canceled. More...
 
KyUInt32 m_firstQueryToProcessIndex
 Current index of query to Process. Usefull for successive call to Process. For Internal Use. More...
 
WorkingMemory m_workingMemory
 Sandbox memory used to perform queries; allocates less memory, and in a thread-local manner. More...
 
KyFloat32 m_msProcessBudget
 The time in milliseconds this queue is allowed to use in a call to Process(). More...
 
KyFloat32 m_msSpentInProcess
 Aggregates the actual time spent in Process(), set to zero in FlushQueries(). More...
 
QueryQueueStats m_stats
 Remember statistics of this QueryQueue. For Visual Debug. More...
 
String m_name
 The name of the QueryQueue. More...
 

Member Function Documentation

void Kaim::QueryQueue::Cancel ( IQuery query)

Must be called from the main thread.

Precondition
The query should have been pushed in this queue and not flushed yet.
void Kaim::QueryQueue::DoSendVisualDebug ( VisualDebugServer &  visualDebugServer,
VisualDebugSendChangeEvent  changeEvent,
KyUInt32  queueIndex,
KyUInt32  elementId,
KyUInt32  queueArrayProcessMode 
)

When QueryQueue is part of A QueryQueueArray, call within QueryQueueArray::DoSendVisualDebug().

void Kaim::QueryQueue::FlushCommands ( )

When QueryQueue is part of A QueryQueueArray and this QueryQueue runs within the World::Update(), QueryQueue::FlushCommands() is called at the beginning of World::Update().

When QueryQueue is part of A QueryQueueArray and this QueryQueue runs outside the World::Update(), QueryQueue::FlushCommands() is called at the end of World::Update().

void Kaim::QueryQueue::FlushQueries ( )

When QueryQueue is part of A QueryQueueArray, QueryQueue::FlushQueries() is called in the World::Update() just after the World::ProcessQueuesInWorldUpdate() step.

It calls IQuery::OnDone() on all the queries that finished.

KyUInt32 Kaim::QueryQueue::GetPendingOperationCount ( ) const
inline

GetCommandCount() + GetQueryCount()

const QueryQueueStats & Kaim::QueryQueue::GetStats ( ) const
inline

Previous value of GetMsSpentInProcess(). Call this for statitics on the time spent in Process().

void Kaim::QueryQueue::Process ( )

Process the Queries in the QueryQueue until the budget is spent.

The process can be called in a worker thread as long as Process() and World::Update are mutally exclusive.

void Kaim::QueryQueue::PushBack ( IQuery query)

Must be called from the main thread.

Precondition
The query must be initialized and should not be already present in a QueryQueue.

Member Data Documentation

CircularArray<QueryQueueCommand, MemStat_QuerySystem> Kaim::QueryQueue::m_commands
protected

Postpone PushBack() and Cancel() until next ConsumeCommands().

KyUInt32 Kaim::QueryQueue::m_firstQueryToProcessIndex
protected

Current index of query to Process. Usefull for successive call to Process. For Internal Use.

KyFloat32 Kaim::QueryQueue::m_msProcessBudget
protected

The time in milliseconds this queue is allowed to use in a call to Process().

KyFloat32 Kaim::QueryQueue::m_msSpentInProcess
protected

Aggregates the actual time spent in Process(), set to zero in FlushQueries().

String Kaim::QueryQueue::m_name
protected

The name of the QueryQueue.

CircularArray<Ptr<IQuery>, MemStat_QuerySystem > Kaim::QueryQueue::m_queries
protected

Queries to process, this includes queries that have been canceled.

QueryQueueStats Kaim::QueryQueue::m_stats
protected

Remember statistics of this QueryQueue. For Visual Debug.

WorkingMemory Kaim::QueryQueue::m_workingMemory
protected

Sandbox memory used to perform queries; allocates less memory, and in a thread-local manner.


The documentation for this class was generated from the following files:
  • gwnavruntime/querysystem/queryqueue.h
  • gwnavruntime/querysystem/queryqueue.cpp