Kaim::GeneratorInputOutput Class Reference

#include <generatorinputoutput.h>

Class Description

The GeneratorInputOutput class is a central element of the generation.

Its purpose is to setup a generation as well as store the data that have been produced. GeneratorInputOutput contains 3 types of information:

  • the Sectors: description of all sectors in the database (typically change not very often)
  • the Actions: what to generate in the next call to Generator::Generate(). By default, everything is generated from scratch, but it's possible to setup iterative generations.
  • the Outputs: GeneratorInputOutput gives access to generated NavData GeneratorInputOutput can be saved, loaded and modified to enable iterative generations.
+ Examples:

Inherits Kaim::RefCountBaseNTS< C, Stat >.

Public Member Functions

 GeneratorInputOutput ()
 constructor More...
 
void Clear ()
 Reset members as if the object was freshly constructed. More...
 

Save, Load, Copy, Clear Functions

KyResult Save (const char *fullFileName, FileOpenerBase *fileOpener=nullptr) const
 Save the GeneratorInputOutput in a file. More...
 
KyResult Load (const char *fullFileName, FileOpenerBase *fileOpener=nullptr)
 Load the GeneratorInputOutput from a file. More...
 

Add/Remove/Set Functions

void SetSectorChangeForAllSectors (GenFlags::SectorChange sectorChange)
 Set sectorChange for all sectors (regular and patches) More...
 
void SetInputSourceForAllSectors (GenFlags::SectorInputSource inputSource)
 Set inputSource for all sectors (regular and patches) More...
 
KyResult AddSector (Ptr< GeneratorSector > sector)
 Use this function to Add new GeneratorSector to the list stored in the GeneratorInputOutput. More...
 
void AddExclusiveGuids (const KyGuid *guids, KyUInt32 guidsCount)
 Specifies the GUIDs of sectors that cover the same areas of terrain, but that will never be loaded into the same Database at the same time. More...
 
void AddExclusiveGuids (const GeneratorGuidCompound &generatorGuidCompound)
 

Accessors

KyUInt32 GetSectorCount () const
 Returns the sector count. More...
 
Ptr< GeneratorSectorGetSectorWithIndex (KyUInt32 index)
 Returns the Sector at index if it exists, non const version. More...
 
Ptr< GeneratorSectorGetSectorWithName (const char *name)
 Returns the Sector with name if it exists, non const version. More...
 
Ptr< GeneratorSectorGetSectorWithGuid (const KyGuid &guid)
 Returns the Sector with guid if it exists, non const version. More...
 
const Ptr< GeneratorSectorGetSectorWithIndex (KyUInt32 index) const
 Returns the Sector at index if it exists, const version. More...
 
const Ptr< GeneratorSectorGetSectorWithName (const char *name) const
 Returns the Sector with name if it exists, const version. More...
 
const Ptr< GeneratorSectorGetSectorWithGuid (const KyGuid &guid) const
 Returns the Sector with guid if it exists, const version. More...
 

Constructor & Destructor Documentation

Kaim::GeneratorInputOutput::GeneratorInputOutput ( )

constructor

Member Function Documentation

void Kaim::GeneratorInputOutput::AddExclusiveGuids ( const KyGuid guids,
KyUInt32  guidsCount 
)

Specifies the GUIDs of sectors that cover the same areas of terrain, but that will never be loaded into the same Database at the same time.

This prevents the NavData generation system from generating alternative data in the area of overlap. This is primarily intended to support swappable sectors, which reflect multiple versions of the terrain in a single area – for example, one version of a sector that contains a building, and another version of a sector in which the building has been destroyed. You can still use swappable sectors without calling this method. However, as the alternative data generated in the area of overlap between the sectors will never be used, you can reduce the size of your NavData by preventing the NavData generation system from generating the data in the first place.

Parameters
guidsAn array of GUIDs that identify the sectors that will never be loaded into the same Database at the same time.
guidsCountThe number of elements in the guids array.
+ Examples:
KyResult Kaim::GeneratorInputOutput::AddSector ( Ptr< GeneratorSector sector)

Use this function to Add new GeneratorSector to the list stored in the GeneratorInputOutput.

This function returns KY_ERROR if a sector with the same name or GUID is already in the sector list.

+ Examples:
void Kaim::GeneratorInputOutput::Clear ( )

Reset members as if the object was freshly constructed.

KyUInt32 Kaim::GeneratorInputOutput::GetSectorCount ( ) const

Returns the sector count.

Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithGuid ( const KyGuid guid)

Returns the Sector with guid if it exists, non const version.

const Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithGuid ( const KyGuid guid) const

Returns the Sector with guid if it exists, const version.

Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithIndex ( KyUInt32  index)

Returns the Sector at index if it exists, non const version.

const Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithIndex ( KyUInt32  index) const

Returns the Sector at index if it exists, const version.

Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithName ( const char *  name)

Returns the Sector with name if it exists, non const version.

+ Examples:
const Ptr< GeneratorSector > Kaim::GeneratorInputOutput::GetSectorWithName ( const char *  name) const

Returns the Sector with name if it exists, const version.

KyResult Kaim::GeneratorInputOutput::Load ( const char *  fullFileName,
FileOpenerBase fileOpener = nullptr 
)

Load the GeneratorInputOutput from a file.

Parameters
fullFileNameThe filename from where to load the GeneratorInputOutput.
fileOpenerA custom file opener to access files. By default, if no fileOpener is set, the DefaultFileOpener will be used. Note: after a call to Load(), the GeneratorSector m_userData are nullptr. you can set it with GetSectorWithGuid()->SetUserData(userData).
+ Examples:
KyResult Kaim::GeneratorInputOutput::Save ( const char *  fullFileName,
FileOpenerBase fileOpener = nullptr 
) const

Save the GeneratorInputOutput in a file.

Parameters
fullFileNameThe filename where to save the GeneratorInputOutput.
fileOpenerA custom file opener to access files. By default, if no fileOpener is set, the DefaultFileOpener will be used.
+ Examples:
void Kaim::GeneratorInputOutput::SetInputSourceForAllSectors ( GenFlags::SectorInputSource  inputSource)

Set inputSource for all sectors (regular and patches)

void Kaim::GeneratorInputOutput::SetSectorChangeForAllSectors ( GenFlags::SectorChange  sectorChange)

Set sectorChange for all sectors (regular and patches)


The documentation for this class was generated from the following files: