gwnavruntime/navdata/sectordescriptor.h Source File

sectordescriptor.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: LASI - secondary contact: GUAL
9 #ifndef Navigation_SectorDescriptor_H
10 #define Navigation_SectorDescriptor_H
11 
15 
16 namespace Kaim
17 {
18 
21 class SectorDescriptorBlob
22 {
23  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
25  KY_ROOT_BLOB_CLASS(NavData, SectorDescriptorBlob, 0)
26 public:
28  BlobFieldArray m_fields;
29 };
30 inline void SwapEndianness(Endianness::Target e, SectorDescriptorBlob& self)
31 {
32  SwapEndianness(e, self.m_fields);
33 }
34 
38 // or in NavData::Save() when saving NavGraph-only Navdata at runtime or in user's post-process of the generation.
39 // Read along with NavData Load.
44 class SectorDescriptor
45 {
46  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavData)
47 
48 public:
50 
51  KyResult ReadFromAggregate(const BlobAggregate& aggregate)
52  {
53  BlobAggregate::Collection<SectorDescriptorBlob> sectorDescs = aggregate.GetCollection<SectorDescriptorBlob>();
54  if (sectorDescs.GetCount() != 1)
55  return KY_ERROR; // 1 and only 1 SectorDescriptorBlob
56  return ReadFromBlob(*sectorDescs.GetHandler(0)->Blob());
57  }
58 
59  void AddMapping(BlobFieldsMapping& mapping)
60  {
61  mapping.AddString("SectorName", m_sectorName);
62  mapping.AddString("GeneratorRelativeOutputDirectory", m_generatorRelativeOutputDirectory);
63  mapping.AddUInt32("Database index", m_databaseIndex);
64  }
65 
66  KyResult ReadFromBlob(const SectorDescriptorBlob& blob)
67  {
68  BlobFieldsMapping mapping;
69  AddMapping(mapping);
70  return mapping.ReadFromBlobFieldArray(blob.m_fields);
71  }
72 
73 public:
76  String m_sectorName;
77 
81 
85 };
86 
87 } // namespace Kaim
88 
89 #endif
KyUInt32 m_databaseIndex
Index of the Lab's database in which the NavData will be added to.
Definition: sectordescriptor.h:92
Easy to write/read version of SectorDescriptorBlob.
Definition: sectordescriptor.h:49
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
String m_generatorRelativeOutputDirectory
Generator relative directory to used by the generator to output NavData, ClientInput, GenIO, related to this sector m_generatorRelativeOutputDirectory is relativeOutputDir in the call to void SetOutputDirectory(const char* absoluteOutputBaseDir, const char* relativeOutputDir);.
Definition: sectordescriptor.h:87
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
The NavData class is the object containing navigation data that will be added to one Database...
Definition: navdata.h:44
Definition: gamekitcrowddispersion.h:20
#define KY_ERROR
Shorthand for Kaim::Result::Failure.
Definition: types.h:272
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
Set of Key-Values embedded within in NavData BlobAggregate (serialized form).
Definition: sectordescriptor.h:22
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
String m_sectorName
Contains the name of the sector which is also the name of the file This is used to identify Graph-onl...
Definition: sectordescriptor.h:83