gwnavgeneration/generator/generatorsystem.h Source File

generatorsystem.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: LASI
9 #ifndef GwNavGen_GeneratorSystem_H
10 #define GwNavGen_GeneratorSystem_H
11 
12 
30 
31 
32 namespace Kaim
33 {
34 
35 class GeneratorInputOutput;
36 class BlobCategory;
37 class BlobAggregate;
38 class GeneratorProfiling;
39 class BaseVisualDebugServer;
40 class BaseVisualDebugManager;
41 class VisualDebugServer;
42 class FileOpenerBase;
43 class GeneratorReport;
44 
47 {
48  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_NavDataGen)
49 
50 public:
52  ~GeneratorSystem();
53 
54  void Init(GeneratorInputOutput* genIO);
55 
56  const GeneratorParameters& Config() const { return m_genIO->m_params; }
57  GeneratorParameters& Config() { return m_genIO->m_params; }
58 
59  const GeneratorAdvancedParameters& AdvancedParams() const { return m_genIO->m_params.m_advancedParameters; }
60  GeneratorAdvancedParameters& AdvancedParams() { return m_genIO->m_params.m_advancedParameters; }
61 
62  const GeneratorAbstractGraphParameters& AbstractGraphParams() const { return m_genIO->m_abstractGraphParams; }
63  GeneratorAbstractGraphParameters& AbstractGraphParams() { return m_genIO->m_abstractGraphParams; }
64 
65  const GeneratorRunOptions& RunOptions() const { return m_genIO->m_runOptions; }
66  GeneratorRunOptions& RunOptions() { return m_genIO->m_runOptions; }
67 
68  const GeneratorFileSystem& GetFileSystem() const { return m_fileSystem; }
69  GeneratorFileSystem& GetFileSystem() { return m_fileSystem; }
70 
71  const String& GetAbsoluteOutputDirectory() const { return GetFileSystem().GetAbsoluteOutputDirectory(); }
72  String GetAbsoluteFileName(const String& relativeFileName) const { return GetFileSystem().GetAbsoluteFileName(relativeFileName); }
73 
74  IParallelForInterface* GetParallelForIfUseMulticore();
75 
76  const PixelAndCellGrid& GetPixelAndCellGrid() const { return m_pixelAndCellGrid; }
77  PixelAndCellGrid& GetPixelAndCellGrid() { return m_pixelAndCellGrid; }
78 
79  KyFloat32 GetNormalizedRasterPrecision() const { return m_genIO->m_params.m_normalizedParameters.m_normalizedRasterPrecision; }
80  KyFloat32 GetNormalizedCellSize() const { return m_genIO->m_params.m_normalizedParameters.m_normalizedCellSize; }
81 
82  const IntermediateFilesConfig& GetIntermediates() const { return m_genIO->m_runOptions.m_intermediateFiles; }
83 
84  // Load Blob from fileName
85  void* LoadBlobBase(const char* fileName, BaseBlobHandler& blobHandler);
86 
87  template<class T>
88  T* LoadBlob(const char* fileName, BlobHandler<T>& blobHandler) { return (T*)LoadBlobBase(fileName, blobHandler); }
89 
90  // Save Blob to fileName
91  KyResult SaveBlob(const char* fileName, const BaseBlobHandler& blobHandler, Endianness::Type endianness = Endianness::BigEndian);
92 
93  // Load BlobAggregate from fileName
94  KyResult LoadAggregate(const char* fileName, BlobAggregate& aggregate);
95 
96  /* Save Blob to fileName */
97  KyResult SaveAggregate(const char* fileName, BlobAggregate& aggregate, Endianness::Type endianness = Endianness::BigEndian);
98 
99  void StartVisualDebug();
100  void StopVisualDebug();
101  bool IsVisualDebugConnected();
102 
104  bool IsInputTilingEnabled() const { return RunOptions().m_doEnableLimitedMemoryMode; }
105  KyUInt32 GetInputTileSizeInNbCells() const { return RunOptions().m_limitedMemoryModeTileSizeInNbCells; }
106 
107 private:
108  void InitFromParams(GeneratorParameters& params);
109  KyResult ComputeGenerationMode();
110 
111 public:
112  GeneratorInputOutput* m_genIO;
113  DatabaseGenMetrics m_genMetrics;
114  PixelAndCellGrid m_pixelAndCellGrid;
115  GeneratorIntegerCoords m_integerCoords;
116  KyUInt32 m_timeStamp;
117  String m_generatorInputOuputSaveFileName;
118  GeneratorFileSystem m_fileSystem;
119  DenseGrid<KyUInt8> m_isMultipleInputAtCellPosGrid;
120  GeneratorNavDataElementMap m_navDataElementGlobalMap;
121  BlobCategory* m_blobRegistry;
122  Ptr<IParallelForInterface> m_parallelForInterface;
123  Ptr<ITlsAlloc> m_tlsAlloc;
124  Ptr<ICollisionInterface> m_collisionInterface;
125  GeneratorProfiling* m_generatorProfiling;
126  FileOpenerBase* m_fileOpener;
127  VisualDebugServer* m_visualDebugServer;
128  String m_inputTilesTempDir; // local to Generator::GetAbsoluteOutputDirectory()
129  String m_inputTilePartsTempDir; // local to Generator::GetAbsoluteOutputDirectory()
130  GenFlags::GenerationMode m_generationMode;
131  GeneratorReport* m_generatorReport;
132 };
133 
134 
135 template <class OSTREAM>
136 inline OSTREAM& operator<<(OSTREAM& os, GeneratorSystem& sys)
137 {
138  os << KY_LOG_SMALL_TITLE_BEGIN("", "GeneratorSystem Info");
139  os << "ParallelForInterface status: " << (sys.m_parallelForInterface != KY_NULL ? "SET" : "UNSET") << Endl;
140  os << "VisualDebugServer status: " << (sys.IsVisualDebugConnected() ? "CONNECTED" : "DECONNECTED") << Endl;
141  os << "GamewareKey : " << (Kaim::GamewareKey::GetInstance().GetKey()) << Endl;
142  os << KY_LOG_SMALL_TITLE_END("", "GeneratorSystem Info");
143  return os;
144 }
145 
146 }
147 
148 
149 #endif
150 
Base interface for a class that opens a file on disk.
Definition: fileopener.h:35
The GeneratorReport class encapsulates a detailed report of all activities carried out during a call ...
Definition: generatorreport.h:113
Provides an abstract base interface for an object that can treat computational jobs in parallel...
Definition: iparallelforinterface.h:43
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
GeneratorAdvancedParameters m_advancedParameters
Contains more advanced configuration parameters.
Definition: generatorparameters.h:178
KyUInt32 m_limitedMemoryModeTileSizeInNbCells
Size of the internally used tiles for large scale generations and/or running generation with low memo...
Definition: generatorrunoptions.h:130
GeneratorSystem gathers everything that is global across a generation: configuration, options...
Definition: generatorsystem.h:46
#define KY_NULL
Null value.
Definition: types.h:247
The BlobHandler class is a top-level mechanism for serializing blobs between objects in memory and fi...
Definition: blobhandler.h:45
IntermediateFilesConfig m_intermediateFiles
Contains configuration parameters that relate to the generation of intermediate data files...
Definition: generatorrunoptions.h:172
bool IsInputTilingEnabled() const
Tiling enabled i.e. IsLowMemoryModeEnabled() or possibly a future fast-local-input-produce-mode.
Definition: generatorsystem.h:105
Big-endian format (used, for example, for PlayStation 3, Xbox 360).
Definition: endianness.h:31
The GeneratorAdvancedParameters class is used by the GeneratorParameters class to maintain a set of c...
Definition: generatoradvancedparameters.h:34
Definition: gamekitcrowddispersion.h:20
The GeneratorInputOutput class is a central element of the generation.
Definition: generatorinputoutput.h:41
The GeneratorParameters class contains configuration parameters that control the characteristics of t...
Definition: generatorparameters.h:75
bool m_doEnableLimitedMemoryMode
Determines whether or not the input geometry consumption is buffered to avoid exceeding the memory li...
Definition: generatorrunoptions.h:124
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
The GeneratorRunOptions class contains configuration parameters that control the way in which the Gen...
Definition: generatorrunoptions.h:49
Type
Enumerates possible endianness types.
Definition: endianness.h:28
The IntermediateFilesConfig class is used by GeneratorRunOptions to store configuration parameters th...
Definition: intermediatefilesconfig.h:23
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
The BlobCategory class represents a collection of blob types.
Definition: blobcategory.h:25
This class gathers a set of generation parameters of one Database and manages the conversion between ...
Definition: databasegenmetrics.h:24
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43