gwnavruntime/navgraph/identifiers/navgraphvertexptr.h Source File

navgraphvertexptr.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
8 
11 
12 namespace Kaim
13 {
14 
18 {
19  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
20 
21 public:
23 
25  NavGraphVertexPtr(const NavGraphPtr& navGraphPtr, NavGraphVertexIdx vertexIdx);
26 
28  explicit NavGraphVertexPtr(const NavGraphVertexRawPtr& navGraphVertexRawPtr);
29 
31  bool IsValid() const;
32 
33  void Invalidate();
34 
35  bool operator ==(const NavGraphVertexPtr& rhs) const;
36  bool operator !=(const NavGraphVertexPtr& rhs) const;
37  bool operator < (const NavGraphVertexPtr& rhs) const;
38  bool operator <=(const NavGraphVertexPtr& rhs) const;
39 
42 
45  NavGraph* GetNavGraph() const;
46 
49  const NavGraphBlob* GetNavGraphBlob() const;
50 
51  // ---------------------------------- Member Functions for valid instance ----------------------------------
54 
58 
61  const NavGraphBlob* GetNavGraphBlob_UnSafe() const;
62 
66 
69  GraphVertexData& GetGraphVertexData() const;
70 
73  const NavTag& GetNavTag() const;
74 
77  const NavGraphVertex& GetNavGraphVertex() const;
78 
81  const Vec3f& GetGraphVertexPosition() const;
82 
86 
87 public:
88  NavGraphPtr m_navGraphPtr;
89  NavGraphVertexIdx m_vertexIdx;
90 };
91 
92 
94  m_navGraphPtr(), m_vertexIdx(NavGraphVertexIdx_Invalid) {}
95 KY_INLINE NavGraphVertexPtr::NavGraphVertexPtr(const NavGraphPtr& navGraphPtr, NavGraphVertexIdx vertexIdx) :
96  m_navGraphPtr(navGraphPtr), m_vertexIdx(vertexIdx) {}
97 KY_INLINE NavGraphVertexPtr::NavGraphVertexPtr(const NavGraphVertexRawPtr& navGraphVertexRawPtr) :
98  m_navGraphPtr(navGraphVertexRawPtr.GetNavGraph()), m_vertexIdx(navGraphVertexRawPtr.GetNavGraphVertexIdx()) {}
99 
100 KY_INLINE bool NavGraphVertexPtr::IsValid() const { return m_navGraphPtr.IsValid() && m_vertexIdx != NavGraphVertexIdx_Invalid; }
101 KY_INLINE void NavGraphVertexPtr::Invalidate() { m_navGraphPtr.Invalidate(); m_vertexIdx = NavGraphVertexIdx_Invalid; }
102 
103 KY_INLINE bool NavGraphVertexPtr::operator ==(const NavGraphVertexPtr& rhs) const { return m_navGraphPtr == rhs.m_navGraphPtr && m_vertexIdx == rhs.m_vertexIdx; }
104 KY_INLINE bool NavGraphVertexPtr::operator !=(const NavGraphVertexPtr& rhs) const { return !(*this == rhs); }
105 KY_INLINE bool NavGraphVertexPtr::operator < (const NavGraphVertexPtr& rhs) const { return m_navGraphPtr < rhs.m_navGraphPtr || (m_navGraphPtr == rhs.m_navGraphPtr && m_vertexIdx < rhs.m_vertexIdx); }
106 KY_INLINE bool NavGraphVertexPtr::operator <=(const NavGraphVertexPtr& rhs) const { return !(rhs < *this); }
107 
108 KY_INLINE NavGraphVertexIdx NavGraphVertexPtr::GetNavGraphVertexIdx() const { return m_vertexIdx; }
109 KY_INLINE NavGraph* NavGraphVertexPtr::GetNavGraph() const { return m_navGraphPtr.GetNavGraph(); }
110 KY_INLINE NavGraph* NavGraphVertexPtr::GetNavGraph_UnSafe() const { return m_navGraphPtr.GetNavGraph_UnSafe(); }
111 KY_INLINE const NavGraphBlob* NavGraphVertexPtr::GetNavGraphBlob() const { return m_navGraphPtr.GetNavGraphBlob(); }
112 KY_INLINE const NavGraphBlob* NavGraphVertexPtr::GetNavGraphBlob_UnSafe() const { return m_navGraphPtr.GetNavGraphBlob_UnSafe(); }
115 KY_INLINE GraphVertexData& NavGraphVertexPtr::GetGraphVertexData() const { return GetRawPtr().GetGraphVertexData(); }
116 KY_INLINE const NavTag& NavGraphVertexPtr::GetNavTag() const { return GetRawPtr().GetNavTag(); }
117 KY_INLINE const NavGraphVertex& NavGraphVertexPtr::GetNavGraphVertex() const { return GetRawPtr().GetNavGraphVertex(); }
119 
120 }
121 
122 
bool IsValid() const
Returns true if this object refers to a valid runtime NavGraph, which means a NavFloor that exists...
Definition: navgraphptr.h:61
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphvertexptr.h:111
bool IsValid() const
Returns true if this object refers to a valid NavGraphVertex: i.e. a NavGraphVertex in a validNavGrap...
Definition: navgraphvertexptr.h:100
The NavGraphBlob contains the static data of a NavGraph.
Definition: navgraphblob.h:19
KyUInt32 NavGraphVertexIdx
An index that uniquely identifies a single vertex within the set of vertices owned by a NavGraph...
Definition: navgraphtypes.h:45
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
const Vec3f & GetGraphVertexPosition() const
Retrieves the position of the NavGraph vertex .
Definition: navgraphvertexptr.h:118
NavGraphVertexRawPtr GetRawPtr() const
Constructs and returns a NavGraphVertexRawPtr that refers to the same NavGraphVertex.
Definition: navgraphvertexptr.h:113
static const NavGraphVertexIdx NavGraphVertexIdx_Invalid
Represents an invalid NavGraphVertexIdx.
Definition: navgraphtypes.h:46
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphvertexptr.h:112
void Invalidate()
Invalidates this object.
Definition: navgraphvertexptr.h:101
NavGraph * GetNavGraph_UnSafe() const
All these function should be called only if IsValid() returns true.
Definition: navgraphvertexptr.h:110
const NavGraphVertex & GetNavGraphVertex() const
Retrieves the NavGraph vertex at the start of the specified NavGraph edge.
Definition: navgraphvertexptr.h:117
GraphVertexData & GetGraphVertexData() const
Returns theGraphVertexData associated to this NavGraphVertex. For Internal use.
Definition: navgraphvertexrawptr.h:85
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:77
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphvertexptr.h:109
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:78
KyUInt32 GetNeighborVertexCount() const
Returns the number of outgoing edges (equal to the number of neighbors) of this vertex.
Definition: navgraphvertexptr.h:114
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
This class uniquely identifies a single NavGraph.
Definition: navgraphptr.h:21
bool operator!=(const NavGraphVertexPtr &rhs) const
Returns true if this object identifies an vertex different from the one identified by rhs...
Definition: navgraphvertexptr.h:104
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexptr.h:17
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphVertex.
Definition: navgraphvertexrawptr.h:88
NavGraphVertexIdx GetNavGraphVertexIdx() const
Returns the GraphVertexIdx that identifies this vertex within its Graph.
Definition: navgraphvertexptr.h:108
KyUInt32 GetNeighborVertexCount() const
Returns the number of outgoing edges (equal to the number of neighbors) of this vertex.
Definition: navgraphvertexrawptr.h:86
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:75
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphVertex.
Definition: navgraphvertexptr.h:116
void Invalidate()
Invalidates this object.
Definition: navgraphptr.h:60
const Vec3f & GetGraphVertexPosition() const
Retrieves the position of the NavGraph vertex .
Definition: navgraphvertexrawptr.h:84
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:74
GraphVertexData & GetGraphVertexData() const
Returns the GraphVertexData associated to this NavGraphVertex.
Definition: navgraphvertexptr.h:115
bool operator==(const NavGraphVertexPtr &rhs) const
Returns true if this object identifies the same vertex as rhs, or if both are invalid.
Definition: navgraphvertexptr.h:103
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexrawptr.h:27
NavGraphVertexPtr()
Constructs a new instance of this class. Creates an invalid NavGraphVertexPtr.
Definition: navgraphvertexptr.h:93
3d vector using 32bits floating points.
Definition: vec3f.h:16
This class is a runtime wrapper of a NavGraphBlob, it gathers all the runtime information associated ...
Definition: navgraph.h:22
const NavGraphVertex & GetNavGraphVertex() const
Retrieves the NavGraph vertex at the start of the specified NavGraph edge.
Definition: navgraphvertexrawptr.h:83