gwnavruntime/querysystem/queryqueuearray.h Source File

queryqueuearray.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 // Authors: James Park, Guillaume Aldebert
8 
9 #ifndef Navigation_QueryQueueArray_H
10 #define Navigation_QueryQueueArray_H
11 
12 
15 
16 namespace Kaim
17 {
18 
19 class QueryQueue;
20 class World;
21 
22 
23 enum QueryQueueArrayProcess
24 {
25  QueryQueueArrayProcess_InWorldUpdate,
26  QueryQueueArrayProcess_OutOfWorldUpdate,
27 };
28 
29 
35 class QueryQueueArray : public WorldElement
36 {
37  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_QuerySystem)
39 
40 public:
41  static WorldElementType GetStaticType() { return TypeQueryQueueArray; }
42  virtual WorldElementType GetType() const { return TypeQueryQueueArray; }
43  virtual const char* GetTypeName() const { return "QueryQueueArray"; }
44 
45  QueryQueueArray();
46  virtual ~QueryQueueArray() {}
47 
48  void Init(World* world, KyUInt32 queueCount, QueryQueueArrayProcess queryQueueArrayProcessThread);
49 
50  void AddToWorld();
51  void RemoveFromWorld();
52 
53  void ProcessQueues();
54 
55  void FlushQueries();
56 
57  void FlushCommands();
58 
59  KyUInt32 GetQueueCount() { return m_queues.GetCount(); }
60  QueryQueue* GetQueue(KyUInt32 index) { return m_queues[index]; }
61 
62  KyUInt32 GetPendingOperationCount();
63 
64  bool IsProcessedInWorldUpdate() const { return m_queryQueueArrayProcessThread == QueryQueueArrayProcess_InWorldUpdate; }
65 
66  virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent); // Inherited from WorldElement
67 
68  void CancelAllQueriesAndClearCommands();
69 private:
70  KyArray<Ptr<QueryQueue>, MemStat_QuerySystem> m_queues;
71  QueryQueueArrayProcess m_queryQueueArrayProcessThread;
72 };
73 
74 } // namespace Kaim
75 
76 #endif // Navigation_QueryQueueArray_H
77 
78 
QueryQueueArray processes queries in an asynchronous, time-sliced way.
Definition: queryqueuearray.h:38
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36