gwnavruntime/querysystem/workingmemcontainers/workingmemarray.h Source File

workingmemarray.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_WorkingMemArray_H
9 #define Navigation_WorkingMemArray_H
10 
12 
13 namespace Kaim
14 {
15 
16 template <class T>
17 class WorkingMemArray
18 {
19 public:
20  WorkingMemArray();
21 
22  WorkingMemArray(WorkingMemory* workingMemory);
23 
24  void Init(WorkingMemory* workingMemory);
25 
26  bool IsInitialized() const; // Check whether the container has been successfully initialized from a buffer of the WorkingMemory
27 
28  T* GetBuffer() const;
29  KyUInt32 GetCount() const;
30  KyUInt32 GetCapacity() const;
31  bool IsEmpty() const;
32 
33  void MakeEmpty();
34  KyResult SetMinimumCapacity(KyUInt32 minCapacity); /* \pre IsInitialized() == true */
35  bool IsFull(); /* \pre IsInitialized() == true */
36 
37  KyResult PushBack(const T& x); /* \pre IsInitialized() == true */
38  void PushBack_UnSafe(const T& x); /* \pre IsInitialized() == true && IsFull() == false */
39 
40  KyResult PopBack(); /* \pre IsInitialized() == true && IsEmpty() == false */
41 
42  const T& operator[](UPInt idx) const; /* \pre IsInitialized() == true && idx < GetCount() */
43  T& operator[](UPInt idx); /* \pre IsInitialized() == true && idx < GetCount() */
44 
45  // newSize == 0 means no specific is wanted, only try to increase the buffer with a normal way
46  KyResult TryToResize(KyUInt32 newBytesSize = 0); /* \pre IsInitialized() == true */
47 
48  void ReleaseWorkingMemoryBuffer() { m_workingMemContainerBase.ReleaseBuffer(); }
49 public:
50  WorkingMemContainerBase m_workingMemContainerBase;
51  KyUInt32 m_itemCount;
52  KyUInt32 m_capacity;
53 };
54 
55 }
56 
58 
59 
60 #endif //Navigation_WorkingMemArray_H
61 
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