gwnavgeneration/input/inputcellinfogrid.h Source File

inputcellinfogrid.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: GUAL - secondary contact: NOBODY
9 #ifndef GwNavGen_InputCellInfoGrid_H
10 #define GwNavGen_InputCellInfoGrid_H
11 
12 
16 
17 
18 namespace Kaim
19 {
20 
21 class GeneratorSystem;
22 
23 
24 class InputCellInfoGrid
25 {
26  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavDataGen)
27 
28 public:
29  InputCellInfoGrid() {}
30 
31  void Add(GeneratorSectorBuilder* sectorBuilder, const CellPos& cellPos, Ptr<BlobHandler<InputCellBlob> > inputCellHandler = KY_NULL)
32  {
33  InputCellInfoArrayAtPos* inputCellInfoArrayAtPos = m_grid.GetOrCreate(cellPos.x, cellPos.y);
34 
35  InputCellInfo inputCellInfo(sectorBuilder, cellPos, inputCellHandler);
36 
37  KY_ASSERT(inputCellInfoArrayAtPos->DoesContain(inputCellInfo) == false);
38  inputCellInfoArrayAtPos->PushBack(inputCellInfo);
39  }
40 
41  InputCellInfoArrayAtPos* GetArrayAtPos(const CellPos& pos) { return m_grid.Get(pos.x, pos.y); }
42  InputCellInfoArrayAtPos* GetArrayAtPos(CellCoord x, CellCoord y) { return m_grid.Get(x, y); }
43 
44  Ptr<InputCellInfoArrayAtPos>* GetArrayOfArray() { return m_grid.GetElements(); }
45  KyUInt32 GetArrayOfArrayCount() { return m_grid.GetElementsCount(); }
46 
47 public:
48  DenseGridAndArrayOfRefPtr<InputCellInfoArrayAtPos> m_grid;
49 };
50 
51 
52 }
53 
54 
55 #endif
56 
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:33
#define KY_NULL
Null value.
Definition: types.h:247
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
KyInt32 CellCoord
A type that represents the placement of a cell on one axis of a 2D grid.
Definition: navmeshtypes.h:32