gwnavruntime/navgraph/identifiers/navgraphedgeptr.h Source File

navgraphedgeptr.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_NavGraphEdgePtr_H
10 #define Navigation_NavGraphEdgePtr_H
11 
14 
15 namespace Kaim
16 {
17 
23 class NavGraphEdgePtr
24 {
26 public:
27  NavGraphEdgePtr();
28  NavGraphEdgePtr(const NavGraphPtr& navGraphPtr, const NavGraphEdgeSmartIdx& edgeSmartIdx);
29  NavGraphEdgePtr(const NavGraphVertexPtr& navGraphVertexPtr, KyUInt32 neighborIndex);
30 
32  bool IsValid() const;
33 
34  void Invalidate();
35 
36  bool operator ==(const NavGraphEdgePtr& rhs) const;
37  bool operator !=(const NavGraphEdgePtr& rhs) const;
38  bool operator < (const NavGraphEdgePtr& rhs) const;
39  bool operator <=(const NavGraphEdgePtr& rhs) const;
40 
43  NavGraph* GetNavGraph() const;
44 
47  const NavGraphBlob* GetNavGraphBlob() const;
48 
51 
54 
55  // ---------------------------------- Member Functions for valid instance ----------------------------------
57 
61 
64  const NavGraphBlob* GetNavGraphBlob_UnSafe() const;
65 
69 
73 
77 
80  const NavGraphVertex& GetStartNavGraphVertex() const;
81 
84  const NavGraphVertex& GetEndNavGraphVertex() const;
85 
89 
92  const Vec3f& GetEndNavGraphVertexPosition() const;
93 
96  const NavTag& GetNavTag() const;
97 
101 
105  NavGraphEdgePtr GetOppositeNavGraphEdgePtr() const;
106 
107 public:
108  NavGraphPtr m_navGraphPtr;
109  NavGraphEdgeSmartIdx m_edgeSmartIdx;
110 };
111 
112 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr() : m_navGraphPtr(), m_edgeSmartIdx() {}
113 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr(const NavGraphPtr& navGraphPtr, const NavGraphEdgeSmartIdx& edgeSmartIdx) :
114  m_navGraphPtr(navGraphPtr), m_edgeSmartIdx(edgeSmartIdx) {}
115 KY_INLINE NavGraphEdgePtr::NavGraphEdgePtr(const NavGraphVertexPtr& navGraphVertexPtr, KyUInt32 neighborIndex) :
116  m_navGraphPtr(navGraphVertexPtr.m_navGraphPtr), m_edgeSmartIdx(navGraphVertexPtr.GetNavGraphVertexIdx(), neighborIndex) {}
117 
118 KY_INLINE bool NavGraphEdgePtr::IsValid() const { return m_navGraphPtr.IsValid() && m_edgeSmartIdx.IsValid(); }
119 KY_INLINE void NavGraphEdgePtr::Invalidate() { m_navGraphPtr.Invalidate(); m_edgeSmartIdx.Invalidate(); }
120 
121 KY_INLINE NavGraphEdgeRawPtr NavGraphEdgePtr::GetRawPtr() const { return NavGraphEdgeRawPtr(GetNavGraph(), m_edgeSmartIdx); }
122 KY_INLINE NavGraph* NavGraphEdgePtr::GetNavGraph() const { return m_navGraphPtr.GetNavGraph(); }
123 KY_INLINE const NavGraphBlob* NavGraphEdgePtr::GetNavGraphBlob() const { return m_navGraphPtr.GetNavGraphBlob(); }
124 KY_INLINE NavGraph* NavGraphEdgePtr::GetNavGraph_UnSafe() const { return m_navGraphPtr.GetNavGraph_UnSafe(); }
125 KY_INLINE const NavGraphBlob* NavGraphEdgePtr::GetNavGraphBlob_UnSafe() const { return m_navGraphPtr.GetNavGraphBlob_UnSafe(); }
126 KY_INLINE NavGraphVertexIdx NavGraphEdgePtr::GetStartVertexIdx() const { return m_edgeSmartIdx.GetStartVertexIdx(); }
127 KY_INLINE KyUInt32 NavGraphEdgePtr::GetEdgeNumberAroundStartVertex() const { return m_edgeSmartIdx.GetNeighborVertexIdx(); }
129 KY_INLINE const NavGraphVertex& NavGraphEdgePtr::GetStartNavGraphVertex() const { return GetRawPtr().GetStartNavGraphVertex(); }
130 KY_INLINE const NavGraphVertex& NavGraphEdgePtr::GetEndNavGraphVertex() const { return GetRawPtr().GetEndNavGraphVertex(); }
133 KY_INLINE const NavTag& NavGraphEdgePtr::GetNavTag() const { return GetRawPtr().GetNavTag(); }
135 KY_INLINE bool NavGraphEdgePtr::operator ==(const NavGraphEdgePtr& rhs) const { return m_navGraphPtr == rhs.m_navGraphPtr && m_edgeSmartIdx == rhs.m_edgeSmartIdx; }
136 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); }
137 KY_INLINE bool NavGraphEdgePtr::operator !=(const NavGraphEdgePtr& rhs) const { return !(*this == rhs); }
138 KY_INLINE bool NavGraphEdgePtr::operator <=(const NavGraphEdgePtr& rhs) const { return !(rhs < *this); }
139 // avoid warning C471 : marked as __forceinline not inlined
140 inline NavGraphVertexPtr NavGraphEdgePtr::GetStartNavGraphVertexPtr() const { return NavGraphVertexPtr(GetRawPtr().GetStartNavGraphVertexRawPtr()); }
141 inline NavGraphVertexPtr NavGraphEdgePtr::GetEndNavGraphVertexPtr() const { return NavGraphVertexPtr(GetRawPtr().GetEndNavGraphVertexRawPtr()); }
143 }
145 #endif //Navigation_NavGraphEdgePtr_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
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
NavGraphEdgePtr GetOppositeNavGraphEdgePtr() const
Return the opposite NavGraphEdgePtr, if any exists.
const Vec3f & GetStartNavGraphVertexPosition() const
Returns the position of the starting NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:142
const NavGraphVertex & GetStartNavGraphVertex() const
Returns the starting NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:140
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphedgeptr.h:136
const Vec3f & GetEndNavGraphVertexPosition() const
Returns the position of the ending NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:32
const NavGraphVertex & GetEndNavGraphVertex() const
Returns the ending NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:53
NavGraphVertexIdx GetEndNavGraphVertexIdx() const
Returns the index of the ending NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgeptr.h:139
const NavGraphVertex & GetStartNavGraphVertex() const
Returns the starting NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:35
void Invalidate()
Invalidates this object.
Definition: navgraphedgeptr.h:130
bool operator!=(const NavGraphEdgePtr &rhs) const
Returns true if this object identifies an edge different from the one identified by rhs...
Definition: navgraphedgeptr.h:148
Each instance of this class uniquely identifies a single NavGraphEdge in a NavGraph.
Definition: navgraphedgerawptr.h:33
NavGraphVertexPtr GetEndNavGraphVertexPtr() const
Returns a NavGraphVertexPtr that identifies the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:152
const NavGraphVertex & GetEndNavGraphVertex() const
Returns the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:141
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:84
const NavGraphBlob * GetNavGraphBlob_UnSafe() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphptr.h:85
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphedgeptr.h:135
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:138
Definition: gamekitcrowddispersion.h:20
This class uniquely identifies a single NavGraph.
Definition: navgraphptr.h:24
NavGraphEdgeRawPtr GetRawPtr() const
Constructs and returns a NavGraphEdgeRawPtr that refers to the same NavGraphVertex.
Definition: navgraphedgeptr.h:132
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
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:146
const Vec3f & GetStartNavGraphVertexPosition() const
Returns the position of the starting NavGraphVertex of current instance.
Definition: navgraphedgerawptr.inl:31
NavGraphEdgePtr()
Constructs a new instance of this class. Creates an invalid NavGraphEdgePtr.
Definition: navgraphedgeptr.h:123
NavGraph * GetNavGraph_UnSafe() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:82
void Invalidate()
Invalidates this object.
Definition: navgraphptr.h:67
NavGraphVertexIdx GetEndNavGraphVertexIdx() const
Returns the index of the ending NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgerawptr.inl:47
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
bool IsValid() const
Returns true if this object refers to a valid NavGraphEdge: i.e. a NavGraphEdge in a valid NavGraph...
Definition: navgraphedgeptr.h:129
const Vec3f & GetEndNavGraphVertexPosition() const
Returns the position of the ending NavGraphVertex of current instance.
Definition: navgraphedgeptr.h:143
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphptr.h:81
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphEdge.
Definition: navgraphedgerawptr.inl:58
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:25
const NavTag & GetNavTag() const
Returns the NavTag associated to this NavGraphEdge.
Definition: navgraphedgeptr.h:144
NavGraphVertexIdx GetStartVertexIdx() const
Returns the index of the starting NavGraphVertex of current instance within its NavGraph.
Definition: navgraphedgeptr.h:137
NavGraphVertexPtr GetStartNavGraphVertexPtr() const
Returns a NavGraphVertexPtr that identifies the starting NavGraphVertex of current instance...
Definition: navgraphedgeptr.h:151
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
const NavGraphBlob * GetNavGraphBlob() const
Returns a pointer to the NavGraphBlob identified by this object.
Definition: navgraphedgeptr.h:134
This class is a runtime wrapper of a NavGraphBlob, it gathers all the runtime information associated ...
Definition: navgraph.h:27
NavGraph * GetNavGraph() const
Returns a pointer to the NavGraph that handles the graph identified by this object.
Definition: navgraphedgeptr.h:133