gwnavruntime/abstractgraph/identifiers/abstractgraphnodeptr.h Source File

abstractgraphnodeptr.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 
9 
10 #include "gwnavruntime/abstractgraphtypes.h"
12 
13 namespace Kaim
14 {
15 
16 class AbstractGraph;
17 
18 class AbstractGraphNodePtr
19 {
20  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
21 public:
22  AbstractGraphNodePtr() { Invalidate(); }
23  AbstractGraphNodePtr(AbstractGraph* abstractGraph, AbstractGraphNodeIdx nodeIdx) { Set(abstractGraph, nodeIdx); }
24 
25  bool IsValid() const { return m_abstractGraph != nullptr && m_nodeIdx < AbstractGraphNodeIdx_Invalid; }
26  void Invalidate()
27  {
28  m_abstractGraph = nullptr;
29  m_nodeIdx = AbstractGraphNodeIdx_Invalid;
30  }
31 
32  void Set(AbstractGraph* abstractGraph, AbstractGraphNodeIdx nodeIdx)
33  {
34  m_abstractGraph = abstractGraph;
35  m_nodeIdx = nodeIdx;
36  }
37 
38 public:
39  Ptr<AbstractGraph> m_abstractGraph;
40  AbstractGraphNodeIdx m_nodeIdx;
41 };
42 
43 }
44 
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17