gwnavruntime/navgraph/identifiers/navgraphedgeptr.h Source File

navgraphedgeptr.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 
21 {
22  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
23 public:
24  NavGraphEdgePtr();
25  NavGraphEdgePtr(const NavGraphPtr& navGraphPtr, const NavGraphEdgeSmartIdx& edgeSmartIdx);
26  NavGraphEdgePtr(const NavGraphVertexPtr& navGraphVertexPtr, KyUInt32 neighborIndex);
27 
29  bool IsValid() const;
30 
31  void Invalidate();
32 
33  bool operator==(const NavGraphEdgePtr& rhs) const;
34  bool operator!=(const NavGraphEdgePtr& rhs) const;
35  bool operator<(const NavGraphEdgePtr& rhs) const;
36  bool operator<=(const NavGraphEdgePtr& rhs) const;
37 
40  NavGraph* GetNavGraph() const;
41 
44  const NavGraphBlob* GetNavGraphBlob() const;
45 
48 
51 
52  // ---------------------------------- Member Functions for valid instance ----------------------------------
54 
58 
61  const NavGraphBlob* GetNavGraphBlob_UnSafe() const;
62 
66 
70 
74 
77  const NavGraphVertex& GetStartNavGraphVertex() const;
78 
81  const NavGraphVertex& GetEndNavGraphVertex() const;
82 
86 
89  const Vec3f& GetEndNavGraphVertexPosition() const;
90 
93  const NavTag& GetNavTag() const;
94 
98 
103 
104 public:
105  NavGraphPtr m_navGraphPtr;
106  NavGraphEdgeSmartIdx m_edgeSmartIdx;
107 };
108 
109 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr() : m_navGraphPtr(), m_edgeSmartIdx() {}
110 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr(const NavGraphPtr& navGraphPtr, const NavGraphEdgeSmartIdx& edgeSmartIdx) :
111  m_navGraphPtr(navGraphPtr), m_edgeSmartIdx(edgeSmartIdx) {}
112 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr(const NavGraphVertexPtr& navGraphVertexPtr, KyUInt32 neighborIndex) :
113  m_navGraphPtr(navGraphVertexPtr.m_navGraphPtr), m_edgeSmartIdx(navGraphVertexPtr.GetNavGraphVertexIdx(), neighborIndex) {}
114 
115 KY_INLINE bool NavGraphEdgePtr::IsValid() const { return m_navGraphPtr.IsValid() && m_edgeSmartIdx.IsValid(); }
116 KY_INLINE void NavGraphEdgePtr::Invalidate() { m_navGraphPtr.Invalidate(); m_edgeSmartIdx.Invalidate(); }
117 
118 KY_INLINE NavGraphEdgeRawPtr NavGraphEdgePtr::GetRawPtr() const { return NavGraphEdgeRawPtr(GetNavGraph(), m_edgeSmartIdx); }
119 KY_INLINE NavGraph* NavGraphEdgePtr::GetNavGraph() const { return m_navGraphPtr.GetNavGraph(); }
120 KY_INLINE const NavGraphBlob* NavGraphEdgePtr::GetNavGraphBlob() const { return m_navGraphPtr.GetNavGraphBlob(); }
121 KY_INLINE NavGraph* NavGraphEdgePtr::GetNavGraph_UnSafe() const { return m_navGraphPtr.GetNavGraph_UnSafe(); }
122 KY_INLINE const NavGraphBlob* NavGraphEdgePtr::GetNavGraphBlob_UnSafe() const { return m_navGraphPtr.GetNavGraphBlob_UnSafe(); }
123 KY_INLINE NavGraphVertexIdx NavGraphEdgePtr::GetStartVertexIdx() const { return m_edgeSmartIdx.GetStartVertexIdx(); }
124 KY_INLINE KyUInt32 NavGraphEdgePtr::GetEdgeNumberAroundStartVertex() const { return m_edgeSmartIdx.GetNeighborVertexIdx(); }
126 KY_INLINE const NavGraphVertex& NavGraphEdgePtr::GetStartNavGraphVertex() const { return GetRawPtr().GetStartNavGraphVertex(); }
127 KY_INLINE const NavGraphVertex& NavGraphEdgePtr::GetEndNavGraphVertex() const { return GetRawPtr().GetEndNavGraphVertex(); }
130 KY_INLINE const NavTag& NavGraphEdgePtr::GetNavTag() const { return GetRawPtr().GetNavTag(); }
131 
132 KY_INLINE bool NavGraphEdgePtr::operator ==(const NavGraphEdgePtr& rhs) const { return m_navGraphPtr == rhs.m_navGraphPtr && m_edgeSmartIdx == rhs.m_edgeSmartIdx; }
133 KY_INLINE bool NavGraphEdgePtr::operator < (const NavGraphEdgePtr& rhs) const { return m_navGraphPtr < rhs.m_navGraphPtr || (m_navGraphPtr == rhs.m_navGraphPtr && m_edgeSmartIdx < rhs.m_edgeSmartIdx); }
134 KY_INLINE bool NavGraphEdgePtr::operator !=(const NavGraphEdgePtr& rhs) const { return !(*this == rhs); }
135 KY_INLINE bool NavGraphEdgePtr::operator <=(const NavGraphEdgePtr& rhs) const { return !(rhs < *this); }
136 // avoid warning C471 : marked as __forceinline not inlined
137 inline NavGraphVertexPtr NavGraphEdgePtr::GetStartNavGraphVertexPtr() const { return NavGraphVertexPtr(GetRawPtr().GetStartNavGraphVertexRawPtr()); }
138 inline NavGraphVertexPtr NavGraphEdgePtr::GetEndNavGraphVertexPtr() const { return NavGraphVertexPtr(GetRawPtr().GetEndNavGraphVertexRawPtr()); }
139 
140 }
141 
142 
bool IsValid() const
Returns true if this object refers to a valid runtime NavGraph, which means a NavFloor that exists...
Definition: navgraphptr.h:61
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
NavGraphEdgePtr GetOppositeNavGraphEdgePtr() const
Return the opposite NavGraphEdgePtr, if any exists.
Definition: navgraphedgeptr.cpp:13
const Vec3f & GetStartNavGraphVertexPosition() const
Returns the position of the starting NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:128
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
const NavGraphVertex & GetStartNavGraphVertex() const
Returns the starting NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:126
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphedgeptr.h:122
const Vec3f & GetEndNavGraphVertexPosition() const
Returns the position of the ending NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:29
const NavGraphVertex & GetEndNavGraphVertex() const
Returns the ending NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:50
NavGraphVertexIdx GetEndNavGraphVertexIdx() const
Returns the index of the ending NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgeptr.h:125
const NavGraphVertex & GetStartNavGraphVertex() const
Returns the starting NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:32
void Invalidate()
Invalidates this object.
Definition: navgraphedgeptr.h:116
bool operator!=(const NavGraphEdgePtr &rhs) const
Returns true if this object identifies an edge different from the one identified by rhs...
Definition: navgraphedgeptr.h:134
Each instance of this class uniquely identifies a single NavGraphEdge in a NavGraph.
Definition: navgraphedgerawptr.h:26
NavGraphVertexPtr GetEndNavGraphVertexPtr() const
Returns a NavGraphVertexPtr that identifies the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:138
const NavGraphVertex & GetEndNavGraphVertex() const
Returns the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:127
#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
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:78
NavGraph * GetNavGraph_UnSafe() const
All these function should be called only if IsValid() returns true.
Definition: navgraphedgeptr.h:121
KyUInt32 GetEdgeNumberAroundStartVertex() const
Returns the index of the edge around its starting vertex. It is the index of the ending vertex within...
Definition: navgraphedgeptr.h:124
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
This class uniquely identifies a single NavGraph.
Definition: navgraphptr.h:21
NavGraphEdgeRawPtr GetRawPtr() const
Constructs and returns a NavGraphEdgeRawPtr that refers to the same NavGraphVertex.
Definition: navgraphedgeptr.h:118
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexptr.h:17
bool operator==(const NavGraphEdgePtr &rhs) const
Returns true if this object identifies the same edge as rhs, or if both are invalid.
Definition: navgraphedgeptr.h:132
const Vec3f & GetStartNavGraphVertexPosition() const
Returns the position of the starting NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:28
NavGraphEdgePtr()
Constructs a new instance of this class. Creates an invalid NavGraphEdgePtr.
Definition: navgraphedgeptr.h:109
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:75
void Invalidate()
Invalidates this object.
Definition: navgraphptr.h:60
NavGraphVertexIdx GetEndNavGraphVertexIdx() const
Returns the index of the ending NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgerawptr.inl:44
bool IsValid() const
Returns true if this object refers to a valid NavGraphEdge: i.e. a NavGraphEdge in a valid NavGraph...
Definition: navgraphedgeptr.h:115
const Vec3f & GetEndNavGraphVertexPosition() const
Returns the position of the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:129
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:74
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphEdge.
Definition: navgraphedgerawptr.inl:55
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:20
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphEdge.
Definition: navgraphedgeptr.h:130
NavGraphVertexIdx GetStartVertexIdx() const
Returns the index of the starting NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgeptr.h:123
NavGraphVertexPtr GetStartNavGraphVertexPtr() const
Returns a NavGraphVertexPtr that identifies the starting NavGraphVertex of current instance...
Definition: navgraphedgeptr.h:137
3d vector using 32bits floating points.
Definition: vec3f.h:16
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphedgeptr.h:120
This class is a runtime wrapper of a NavGraphBlob, it gathers all the runtime information associated ...
Definition: navgraph.h:22
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphedgeptr.h:119