gwnavruntime/queries/utils/spatializedpointcollectorcontext.h Source File

spatializedpointcollectorcontext.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 // Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_SpatializedPointCollectorContext_H
10 #define Navigation_SpatializedPointCollectorContext_H
11 
15 
16 namespace Kaim
17 {
18 
19 class CollectorTraversalNodeIdx
20 {
21 public:
22  CollectorTraversalNodeIdx() : m_data(KyUInt32MAXVAL) {}
23  CollectorTraversalNodeIdx(const NavFloorRawPtr& /*navFloorRawPtr*/, KyUInt32 nodeIndex) : m_data(0x80000000 | nodeIndex) {}
24  CollectorTraversalNodeIdx(const NavGraphEdgeRawPtr& /*navGraphEdgeRawPtr*/, KyUInt32 nodeIndex) : m_data(0x7FFFFFFF & nodeIndex) {}
25 
26  KY_INLINE bool IsNavFloorNode() const { return (m_data & 0x80000000) != 0; }
27  KY_INLINE bool IsNavGraphEdgeNode() const { return (m_data & 0x80000000) == 0; }
28  KY_INLINE KyUInt32 GetNodeIndex() const { return (m_data & 0x7FFFFFFF); }
29 
30  KyUInt32 m_data; // 1 bit for type, 31 bit for index
31 };
32 
33 class SpatializedPointCollectorContext
34 {
35  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_QueryWorkingMem)
36 public:
37  SpatializedPointCollectorContext() {}
38  ~SpatializedPointCollectorContext() { ReleaseWorkingMemory(); }
39 
40  void ReleaseWorkingMemory()
41  {
42  m_traversalNodeStatus.ReleaseWorkingMemoryBuffer();
43  m_openNodes.ReleaseWorkingMemoryBuffer();
44  m_edgeRawPtrNodes.ReleaseWorkingMemoryBuffer();
45  m_navFloorRawPtrNodes.ReleaseWorkingMemoryBuffer();
46  }
47 public:
48  NavFloorAndNavGraphEdgeStatusInGrid m_traversalNodeStatus;
49  WorkingMemDeque<CollectorTraversalNodeIdx> m_openNodes; //< open nodes = nodes that are about to be analysed
50  WorkingMemArray<NavGraphEdgeRawPtr> m_edgeRawPtrNodes;
51  WorkingMemArray<NavFloorRawPtr> m_navFloorRawPtrNodes;
52 };
53 
54 
55 
56 
57 }
58 
59 
60 #endif //Navigation_SpatializedPointCollectorContext_H
61 
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
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226