8 #ifndef Navigation_QueryQueue_H
9 #define Navigation_QueryQueue_H
23 class VisualDebugServer;
34 : m_msSpentInProcessStat(
"Spent in Process (ms)")
35 , m_nbQueriesPopped(0)
66 enum Type { Push = 0, Cancel };
75 class QueryQueue :
public RefCountBase<QueryQueue, MemStat_QuerySystem>
81 virtual ~QueryQueue();
108 void SetWorkingMemoryMaxSizeInBytes(
KyUInt32 sizeInBytes);
109 KyUInt32 GetWorkingMemoryMaxSizeInBytes() const;
110 KyUInt32 GetWorkingMemoryCurrentSize() const;
125 const String& GetName()
const {
return m_name; }
129 void CancelAllQueriesAndClearCommands();
135 void ClearCommandForThisQuery(
IQuery* query);
136 void CancelQuery(
IQuery* query);
138 IQuery* FindFirstNonNullQuery();
139 IQuery* FindNextNonNullQuery();
142 CircularArray<QueryQueueCommand, MemStat_QuerySystem>
m_commands;
143 CircularArray<Ptr<IQuery>, MemStat_QuerySystem >
m_queries;
153 KY_INLINE QueryQueue::QueryQueue()
154 : m_firstQueryToProcessIndex(0)
155 , m_msProcessBudget(1.0f)
156 , m_msSpentInProcess(0.0f)
159 KY_INLINE QueryQueue::~QueryQueue() { Clear(); }
165 KY_INLINE
KyUInt32 QueryQueue::GetCommandCount()
const {
return m_commands.GetCount(); }
166 KY_INLINE QueryQueueCommand& QueryQueue::GetCommand(
KyUInt32 index) {
return m_commands[index]; }
167 KY_INLINE
const QueryQueueCommand& QueryQueue::GetCommand(
KyUInt32 index)
const {
return m_commands[index]; }
168 KY_INLINE
KyUInt32 QueryQueue::GetQueryCount()
const {
return m_queries.GetCount(); }
169 KY_INLINE IQuery* QueryQueue::GetQuery(
KyUInt32 index)
const {
return m_queries[index]; }
174 #endif // Navigation_QueryQueue_H
String m_name
The name of the QueryQueue.
Definition: queryqueue.h:159
KyUInt32 m_firstQueryToProcessIndex
Current index of query to Process. Usefull for successive call to Process. For Internal Use...
Definition: queryqueue.h:154
void Process()
Process the Queries in the QueryQueue until the budget is spent.
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().
CircularArray< QueryQueueCommand, MemStat_QuerySystem > m_commands
Postpone PushBack() and Cancel() until next ConsumeCommands().
Definition: queryqueue.h:152
String m_name
The name of the QueryQueue.
Definition: queryqueue.h:57
KyUInt32 GetPendingOperationCount() const
GetCommandCount() + GetQueryCount()
Definition: queryqueue.h:180
void PushBack(IQuery *query)
Must be called from the main thread.
const QueryQueueStats & GetStats() const
Previous value of GetMsSpentInProcess(). Call this for statitics on the time spent in Process()...
Definition: queryqueue.h:174
QueryQueue processes queries in an asynchronous, time-sliced way, within a QueryQueueArray.
Definition: queryqueue.h:79
Class used to provide QueryQueue initialization parameters.
Definition: queryqueue.h:44
class use internal by the QueryQueue to postpone Push/Cancel of Queries until next FlushCommands() st...
Definition: queryqueue.h:64
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
void Cancel(IQuery *query)
Must be called from the main thread.
KyFloat32 m_budgetInMilliseconds
The time budget per frame of the QueryQueue. Default value is 1 ms.
Definition: queryqueue.h:58
KyUInt32 m_workingMemoryReallocSize
The additional size of memory in bytes that will be allocated on ReAlloc in the WorkingMemory. Default value is 5 KB.
Definition: queryqueue.h:60
FloatStat maintains current, average, min, max statistics in a sliding window of frames.
Definition: floatstat.h:23
Definition: gamekitcrowddispersion.h:20
void FlushQueries()
When QueryQueue is part of A QueryQueueArray, QueryQueue::FlushQueries() is called in the World::Upda...
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
QueryQueueStats m_stats
Remember statistics of this QueryQueue. For Visual Debug.
Definition: queryqueue.h:158
KyFloat32 m_msSpentInProcess
Aggregates the actual time spent in Process(), set to zero in FlushQueries().
Definition: queryqueue.h:157
KyUInt32 m_workingMemoryMaxSize
The amount of memory in bytes the WorkingMemory of this QueryQueue is allowed to allocate. Default value is 1 MB.
Definition: queryqueue.h:59
CircularArray< Ptr< IQuery >, MemStat_QuerySystem > m_queries
Queries to process, this includes queries that have been canceled.
Definition: queryqueue.h:153
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
WorkingMemory m_workingMemory
Sandbox memory used to perform queries; allocates less memory, and in a thread-local manner...
Definition: queryqueue.h:155
This class is used by the Visual Debug system to profileQueryQueue.
Definition: queryqueue.h:29
double KyFloat64
Type used internally to represent a 64-bit floating-point number.
Definition: types.h:44
void DoSendVisualDebug(VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent, KyUInt32 queueIndex, KyUInt32 elementId, KyUInt32 queueArrayProcessMode)
When QueryQueue is part of A QueryQueueArray, call within QueryQueueArray::DoSendVisualDebug().
KyFloat32 m_msProcessBudget
The time in milliseconds this queue is allowed to use in a call to Process().
Definition: queryqueue.h:156
Abstract class for all queries.
Definition: iquery.h:133
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43