#include <queryqueue.h>
QueryQueue processes queries in an asynchronous, time-sliced way, within a QueryQueueArray.
Each QueryQueue has its own WorkingMemory, time budget...
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 QueryQueueStats & | GetStats () 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... | |
void Kaim::QueryQueue::Cancel | ( | IQuery * | query | ) |
Must be called from the main thread.
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.
|
inline |
GetCommandCount() + GetQueryCount()
|
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.
|
protected |
Postpone PushBack() and Cancel() until next ConsumeCommands().
|
protected |
Current index of query to Process. Usefull for successive call to Process. For Internal Use.
|
protected |
The time in milliseconds this queue is allowed to use in a call to Process().
|
protected |
Aggregates the actual time spent in Process(), set to zero in FlushQueries().
|
protected |
The name of the QueryQueue.
|
protected |
Queries to process, this includes queries that have been canceled.
|
protected |
Remember statistics of this QueryQueue. For Visual Debug.
|
protected |
Sandbox memory used to perform queries; allocates less memory, and in a thread-local manner.