gwnavgeneration/generator/generatorabstractgraphparameters.h Source File

generatorabstractgraphparameters.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 
8 #pragma once
9 
14 
15 namespace Kaim
16 {
17 
18 class BlobAggregate;
19 
20 class GeneratorAbstractGraphParametersBlob
21 {
22  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
23  KY_ROOT_BLOB_CLASS(Generator, GeneratorAbstractGraphParametersBlob, 0)
24  KY_CLASS_WITHOUT_COPY(GeneratorAbstractGraphParametersBlob)
25 public:
26  GeneratorAbstractGraphParametersBlob() {}
27  BlobFieldArray m_fields;
28 };
29 inline void SwapEndianness(Endianness::Target e, GeneratorAbstractGraphParametersBlob& self)
30 {
31  SwapEndianness(e, self.m_fields);
32 }
33 
34 enum AbstractGraphBuildMode
35 {
36  GENERATE_ABSTRACTGRAPHS_DISABLE = 0, // no abstract graph generated
37  GENERATE_ABSTRACTGRAPHS_ENABLE = 1, // abstract graph generated only for sectors which did change (cf. SECTOR_CHANGED)
38  GENERATE_ABSTRACTGRAPHS_FORCE_ENABLE = 2, // abstract graph generated for all sectors even if they didn't change (cf. SECTOR_NOCHANGE)
39 };
40 
41 class GeneratorAbstractGraphParameters
42 {
43  KY_DEFINE_NEW_DELETE_OPERATORS(Stat_Default_Mem)
44 public:
45  GeneratorAbstractGraphParameters();
46  void Clear();
47 
49  void BuildBlob(BlobHandler<GeneratorAbstractGraphParametersBlob>& handler) const;
50 
53  KyResult ReadFromAggregate(BlobAggregate& aggregate);
54 
55  KyResult ReadBlob(const GeneratorAbstractGraphParametersBlob& blob);
56 
57  void SetMode(AbstractGraphBuildMode mode) { m_doGenerateAbstractGraphs = mode; }
58  AbstractGraphBuildMode GetMode() const { return (AbstractGraphBuildMode)m_doGenerateAbstractGraphs; }
59 
61  void InitBlobFieldsMapping(BlobFieldsMapping& mapping);
62  void InitBlobFieldsMapping(BlobFieldsMapping& mapping) const;
63 
65  bool operator==(const GeneratorAbstractGraphParameters& other) const
66  {
67  return m_doGenerateAbstractGraphs == other.m_doGenerateAbstractGraphs
68  && m_extentsInNumberOfCells == other.m_extentsInNumberOfCells
69  && m_workingMemorySizeLimit == other.m_workingMemorySizeLimit;
70  }
71 
73  bool operator!=(const GeneratorAbstractGraphParameters& other) const { return !operator==(other); }
74 
75 public:
78  KyUInt32 m_doGenerateAbstractGraphs; // enum GenerateAbstractGraphs
79 
82  KyUInt32 m_extentsInNumberOfCells;
83 
85  KyUInt32 m_workingMemorySizeLimit;
86 };
87 
88 
89 template <class OSTREAM>
90 inline OSTREAM& operator<<(OSTREAM& os, GeneratorAbstractGraphParameters& params)
91 {
92  BlobFieldsMapping mapping;
93  params.InitBlobFieldsMapping(mapping);
94 
95  os << KY_LOG_SMALL_TITLE_BEGIN("", "GeneratorAbstractGraphParameters Info");
96  os << mapping;
97  os << KY_LOG_SMALL_TITLE_END("", "GeneratorAbstractGraphParameters Info");
98  return os;
99 }
100 
101 
102 class GeneratorAbstractGraphParametersBlobBuilder : public BaseBlobBuilder<GeneratorAbstractGraphParametersBlob>
103 {
104 public:
105  GeneratorAbstractGraphParametersBlobBuilder(const GeneratorAbstractGraphParameters* params)
106  : m_params(params)
107  {}
108 
109 private:
110  virtual void DoBuild();
111 
112  const GeneratorAbstractGraphParameters* m_params;
113 };
114 
115 } // namespace Kaim
116 
117 
118 
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
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:27
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17