gwnavruntime/querysystem/workingmemcontainers/workingmemdeque.h Source File

workingmemdeque.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 
8 #ifndef Navigation_WorkingMemDeque_H
9 #define Navigation_WorkingMemDeque_H
10 
12 
13 namespace Kaim
14 {
15 
16 template <class T>
17 class WorkingMemDeque
18 {
19 public:
20  WorkingMemDeque();
21 
22  WorkingMemDeque(WorkingMemory*workingMemory);
23 
24  void Init(WorkingMemory* workingMemory);
25 
26  T* GetBuffer() const;
27  bool IsInitialized() const;
28  bool IsEmpty() const;
29 
30  bool IsFull();
31  void MakeEmpty();
32 
33  KyResult PushFront(const T& x);
34  KyResult PushBack(const T& x);
35 
36  void PopFront();
37  void PopBack();
38 
39  void Front(T& item) const;
40  void Back(T& item) const;
41 
42  KyUInt32 GetHeadIdx() const;
43  KyUInt32 GetTailEndIdx() const;
44 
45  KyUInt32 GetNextItemIdx(KyUInt32 idx) const;
46  KyUInt32 GetPrevItemIdx(KyUInt32 idx) const;
47 
48  T& GetItem(KyUInt32 idx);
49 
50  KyResult TryToResize();
51 
52  void ReleaseWorkingMemoryBuffer() { m_workingMemContainerBase.ReleaseBuffer(); }
53 public :
54  WorkingMemContainerBase m_workingMemContainerBase;
55  KyUInt32 m_headIdx;
56  KyUInt32 m_tailIdx;
57  KyUInt32 m_lastIdx; // capacity - 1
58 };
59 
60 }
61 
63 
64 #endif
65 
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Definition: gamekitcrowddispersion.h:20
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36