gwnavruntime/navgraph/identifiers/navgraphvertexptr.h Source File

navgraphvertexptr.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_NavGraphVertexPtr_H
10 #define Navigation_NavGraphVertexPtr_H
11 
14 
15 
16 namespace Kaim
17 {
18 
21 class NavGraphVertexPtr
22 {
23  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
24 
25 public:
27 
29  NavGraphVertexPtr(const NavGraphPtr& navGraphPtr, NavGraphVertexIdx vertexIdx);
30 
32  explicit NavGraphVertexPtr(const NavGraphVertexRawPtr& navGraphVertexRawPtr);
33 
35  bool IsValid() const;
36 
37  void Invalidate();
38 
39  bool operator ==(const NavGraphVertexPtr& rhs) const;
40  bool operator !=(const NavGraphVertexPtr& rhs) const;
41  bool operator < (const NavGraphVertexPtr& rhs) const;
42  bool operator <=(const NavGraphVertexPtr& rhs) const;
43 
46 
49  NavGraph* GetNavGraph() const;
50 
53  const NavGraphBlob* GetNavGraphBlob() const;
54 
55  // ---------------------------------- Member Functions for valid instance ----------------------------------
58 
62 
65  const NavGraphBlob* GetNavGraphBlob_UnSafe() const;
66 
70 
73  GraphVertexData& GetGraphVertexData() const;
74 
77  const NavTag& GetNavTag() const;
78 
81  const NavGraphVertex& GetNavGraphVertex() const;
82 
85  const Vec3f& GetGraphVertexPosition() const;
86 
90 
91 public:
92  NavGraphPtr m_navGraphPtr;
93  NavGraphVertexIdx m_vertexIdx;
94 };
95 
96 
98  m_navGraphPtr(), m_vertexIdx(NavGraphVertexIdx_Invalid) {}
99 KY_INLINE NavGraphVertexPtr::NavGraphVertexPtr(const NavGraphPtr& navGraphPtr, NavGraphVertexIdx vertexIdx) :
100  m_navGraphPtr(navGraphPtr), m_vertexIdx(vertexIdx) {}
101 KY_INLINE NavGraphVertexPtr::NavGraphVertexPtr(const NavGraphVertexRawPtr& navGraphVertexRawPtr) :
102  m_navGraphPtr(navGraphVertexRawPtr.GetNavGraph()), m_vertexIdx(navGraphVertexRawPtr.GetNavGraphVertexIdx()) {}
103 
104 KY_INLINE bool NavGraphVertexPtr::IsValid() const { return m_navGraphPtr.IsValid() && m_vertexIdx != NavGraphVertexIdx_Invalid; }
105 KY_INLINE void NavGraphVertexPtr::Invalidate() { m_navGraphPtr.Invalidate(); m_vertexIdx = NavGraphVertexIdx_Invalid; }
107 KY_INLINE bool NavGraphVertexPtr::operator ==(const NavGraphVertexPtr& rhs) const { return m_navGraphPtr == rhs.m_navGraphPtr && m_vertexIdx == rhs.m_vertexIdx; }
108 KY_INLINE bool NavGraphVertexPtr::operator !=(const NavGraphVertexPtr& rhs) const { return !(*this == rhs); }
109 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); }
110 KY_INLINE bool NavGraphVertexPtr::operator <=(const NavGraphVertexPtr& rhs) const { return !(rhs < *this); }
111 
112 KY_INLINE NavGraphVertexIdx NavGraphVertexPtr::GetNavGraphVertexIdx() const { return m_vertexIdx; }
113 KY_INLINE NavGraph* NavGraphVertexPtr::GetNavGraph() const { return m_navGraphPtr.GetNavGraph(); }
114 KY_INLINE NavGraph* NavGraphVertexPtr::GetNavGraph_UnSafe() const { return m_navGraphPtr.GetNavGraph_UnSafe(); }
115 KY_INLINE const NavGraphBlob* NavGraphVertexPtr::GetNavGraphBlob() const { return m_navGraphPtr.GetNavGraphBlob(); }
116 KY_INLINE const NavGraphBlob* NavGraphVertexPtr::GetNavGraphBlob_UnSafe() const { return m_navGraphPtr.GetNavGraphBlob_UnSafe(); }
119 KY_INLINE GraphVertexData& NavGraphVertexPtr::GetGraphVertexData() const { return GetRawPtr().GetGraphVertexData(); }
120 KY_INLINE const NavTag& NavGraphVertexPtr::GetNavTag() const { return GetRawPtr().GetNavTag(); }
121 KY_INLINE const NavGraphVertex& NavGraphVertexPtr::GetNavGraphVertex() const { return GetRawPtr().GetNavGraphVertex(); }
124 }
126 #endif //Navigation_NavGraphVertexPtr_H
bool IsValid() const
Returns true if this object refers to a valid runtime NavGraph, which means a NavFloor that exists...
Definition: navgraphptr.h:68
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphvertexptr.h:124
bool IsValid() const
Returns true if this object refers to a valid NavGraphVertex: i.e. a NavGraphVertex in a validNavGrap...
Definition: navgraphvertexptr.h:113
The NavGraphBlob contains the static data of a NavGraph.
Definition: navgraphblob.h:21
KyUInt32 NavGraphVertexIdx
An index that uniquely identifies a single vertex within the set of vertices owned by a NavGraph...
Definition: navgraphtypes.h:47
const Vec3f & GetGraphVertexPosition() const
Retrieves the position of the NavGraph vertex .
Definition: navgraphvertexptr.h:131
NavGraphVertexRawPtr GetRawPtr() const
Constructs and returns a NavGraphVertexRawPtr that refers to the same NavGraphVertex.
Definition: navgraphvertexptr.h:126
static const NavGraphVertexIdx NavGraphVertexIdx_Invalid
Represents an invalid NavGraphVertexIdx.
Definition: navgraphtypes.h:48
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphvertexptr.h:125
void Invalidate()
Invalidates this object.
Definition: navgraphvertexptr.h:114
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphvertexptr.h:123
const NavGraphVertex & GetNavGraphVertex() const
Retrieves the NavGraph vertex at the start of the specified NavGraph edge.
Definition: navgraphvertexptr.h:130
GraphVertexData & GetGraphVertexData() const
Returns theGraphVertexData associated to this NavGraphVertex. For Internal use.
Definition: navgraphvertexrawptr.h:100
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:84
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphvertexptr.h:122
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:85
KyUInt32 GetNeighborVertexCount() const
Returns the number of outgoing edges (equal to the number of neighbors) of this vertex.
Definition: navgraphvertexptr.h:127
Definition: gamekitcrowddispersion.h:20
This class uniquely identifies a single NavGraph.
Definition: navgraphptr.h:24
bool operator!=(const NavGraphVertexPtr &rhs) const
Returns true if this object identifies an vertex different from the one identified by rhs...
Definition: navgraphvertexptr.h:117
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexptr.h:22
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphVertex.
Definition: navgraphvertexrawptr.h:103
NavGraphVertexIdx GetNavGraphVertexIdx() const
Returns the GraphVertexIdx that identifies this vertex within its Graph.
Definition: navgraphvertexptr.h:121
KyUInt32 GetNeighborVertexCount() const
Returns the number of outgoing edges (equal to the number of neighbors) of this vertex.
Definition: navgraphvertexrawptr.h:101
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:82
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphVertex.
Definition: navgraphvertexptr.h:129
void Invalidate()
Invalidates this object.
Definition: navgraphptr.h:67
const Vec3f & GetGraphVertexPosition() const
Retrieves the position of the NavGraph vertex .
Definition: navgraphvertexrawptr.h:99
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:81
GraphVertexData & GetGraphVertexData() const
Returns the GraphVertexData associated to this NavGraphVertex.
Definition: navgraphvertexptr.h:128
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:116
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexrawptr.h:36
NavGraphVertexPtr()
Constructs a new instance of this class. Creates an invalid NavGraphVertexPtr.
Definition: navgraphvertexptr.h:106
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
This class is a runtime wrapper of a NavGraphBlob, it gathers all the runtime information associated ...
Definition: navgraph.h:27
const NavGraphVertex & GetNavGraphVertex() const
Retrieves the NavGraph vertex at the start of the specified NavGraph edge.
Definition: navgraphvertexrawptr.h:98