gwnavgeneration/generator/generatorsectorlist.h Source File

generatorsectorlist.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 
12 
13 namespace Kaim
14 {
15 
16 class GeneratorSectorList
17 {
18  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
19  KY_CLASS_WITHOUT_COPY(GeneratorSectorList)
20 
21 public:
22  GeneratorSectorList();
23  void ShallowCopy(const GeneratorSectorList& other); // copy and original point to the same GeneratorSectors
24 
26  void DeepCopy(const GeneratorSectorList& other, GeneratorSector::ClearPointedDataMode clearPointedDataMode);
27 
28  void Clear();
29 
30  // returns KY_ERROR if a sector with same name or Guid is already in the list
31  KyResult AddSector(Ptr<GeneratorSector> sector);
32 
33  void RemoveAllSectors();
34 
35  // returns KyUInt32MaxVal if not found
36  KyUInt32 GetSectorIdxFromName(const char* name) const;
37  KyUInt32 GetSectorIdxFromGuid(const KyGuid& guid) const;
38 
39  // returns nullptr if not found
40  Ptr<GeneratorSector> GetSectorWithName(const char* name);
41  Ptr<GeneratorSector> GetSectorWithGuid(const KyGuid& guid);
42  Ptr<GeneratorSector> GetSector(KyUInt32 index) { return index < m_sectors.GetCount() ? m_sectors[index] : nullptr; }
43 
44  const Ptr<GeneratorSector> GetSectorWithName(const char* name) const;
45  const Ptr<GeneratorSector> GetSectorWithGuid(const KyGuid& guid) const ;
46  const Ptr<GeneratorSector> GetSector(KyUInt32 index) const { return index < m_sectors.GetCount() ? m_sectors[index] : nullptr; }
47 
48  const KyArray< Ptr<GeneratorSector> >& GetSectors() const { return m_sectors; }
49  KyArray< Ptr<GeneratorSector> >& GetSectors() { return m_sectors; }
50  KyUInt32 GetSectorCount() const { return m_sectors.GetCount(); }
51 
52 public:
53  KyArray<Ptr<GeneratorSector> > m_sectors;
54  Hash<KyGuid, KyUInt32> m_guidToSectorIdx;
55  StringHash<KyUInt32> m_nameToSectorIdx;
56 };
57 
58 
59 }
60 
61 
62 
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17