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 Cancel (IQuery *query)
 
void DoSendVisualDebug (VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent, KyUInt32 queueIndex, KyUInt32 elementId, KyUInt32 queueArrayProcessMode)
 
void FlushCommands ()
 
void FlushQueries ()
 
KyUInt32 GetPendingOperationCount () const
 
const QueryQueueStatsGetStats () const
 
void Process ()
 
void PushBack (IQuery *query)
 

Protected Attributes

CircularArray< QueryQueueCommand, MemStat_QuerySystem > m_commands
 
KyUInt32 m_firstQueryToProcessIndex
 
KyFloat32 m_msProcessBudget
 
KyFloat32 m_msSpentInProcess
 
String m_name
 
CircularArray< Ptr< IQuery >, MemStat_QuerySystem > m_queries
 
QueryQueueStats m_stats
 
WorkingMemory m_workingMemory
 

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 file: