Registry for executable generators and their reflection metadata. 更多...
#include <GeneratorRegistry.h>
Public 成员函数 | |
| void | registerAlgorithm (const std::string &id, GeneratorFn fn) |
| Register an algorithm without metadata for backward compatibility. | |
| void | registerAlgorithm (GeneratorDescriptor descriptor, GeneratorFn fn) |
| Register an algorithm together with its dynamic-editor schema. | |
| bool | has (const std::string &id) const |
| Return true when an executable algorithm is registered. | |
| bool | generate (const std::string &id, const Params ¶ms, Grid2D &out, std::string &error) const |
| Execute one registered algorithm. | |
| std::vector< std::string > | list () const |
| Return sorted registered algorithm ids. | |
| const GeneratorDescriptor * | descriptor (const std::string &id) const |
| Return reflection metadata for an algorithm. | |
| bool | applyDefaults (const std::string &id, Params ¶ms) const |
| Fill only missing algorithm-specific values from the registered schema. | |
| void | registerBuiltins () |
| Register built-in DTL / custom map algorithms (idempotent). | |
静态 Public 成员函数 | |
| static GeneratorRegistry & | instance () |
| Return the process-wide generator registry. | |
详细描述
Registry for executable generators and their reflection metadata.
在文件 GeneratorRegistry.h 第 23 行定义.
成员函数说明
◆ applyDefaults()
| bool eve::procgen::GeneratorRegistry::applyDefaults | ( | const std::string & | id, |
| Params & | params | ||
| ) | const |
Fill only missing algorithm-specific values from the registered schema.
- 参数
-
id Algorithm id. params Parameters to update.
- 返回
- Whether a schema exists.
在文件 GeneratorRegistry.cpp 第 42 行定义.
引用了 eve::procgen::RecipeDescriptor::applyDefaults(), descriptor , 以及 params.
◆ descriptor()
| const GeneratorDescriptor * eve::procgen::GeneratorRegistry::descriptor | ( | const std::string & | id | ) | const |
Return reflection metadata for an algorithm.
- 参数
-
id Algorithm id.
- 返回
- Descriptor or nullptr.
在文件 GeneratorRegistry.cpp 第 37 行定义.
被这些函数引用 eve::procgen::Procgen::getAlgorithmCategory(), eve::procgen::Procgen::getAlgorithmDisplayName(), eve::procgen::Procgen::getAlgorithmParamCount() , 以及 eve::procgen::Procgen::getAlgorithmSchema().
◆ generate()
| bool eve::procgen::GeneratorRegistry::generate | ( | const std::string & | id, |
| const Params & | params, | ||
| Grid2D & | out, | ||
| std::string & | error | ||
| ) | const |
Execute one registered algorithm.
- 参数
-
id Algorithm id. params Input parameters. out Output grid. error Error text.
- 返回
- Whether generation succeeded.
在文件 GeneratorRegistry.cpp 第 27 行定义.
◆ has()
| bool eve::procgen::GeneratorRegistry::has | ( | const std::string & | id | ) | const |
Return true when an executable algorithm is registered.
- 参数
-
id Algorithm id.
- 返回
- Whether it exists.
在文件 GeneratorRegistry.cpp 第 23 行定义.
◆ instance()
|
static |
Return the process-wide generator registry.
在文件 GeneratorRegistry.cpp 第 6 行定义.
被这些函数引用 eve::procgen::Procgen::applyAlgorithmDefaults(), eve::procgen::Procgen::getAlgorithmCategory(), eve::procgen::Procgen::getAlgorithmCount(), eve::procgen::Procgen::getAlgorithmDisplayName(), eve::procgen::Procgen::getAlgorithmId(), eve::procgen::Procgen::getAlgorithmParamCount(), eve::procgen::Procgen::getAlgorithmSchema(), eve::procgen::Procgen::hasAlgorithm() , 以及 eve::procgen::Procgen::Procgen().
◆ list()
| std::vector< std::string > eve::procgen::GeneratorRegistry::list | ( | ) | const |
Return sorted registered algorithm ids.
在文件 GeneratorRegistry.cpp 第 49 行定义.
引用了 ids.
被这些函数引用 eve::procgen::Procgen::getAlgorithmCount() , 以及 eve::procgen::Procgen::getAlgorithmId().
◆ registerAlgorithm() [1/2]
| void eve::procgen::GeneratorRegistry::registerAlgorithm | ( | const std::string & | id, |
| GeneratorFn | fn | ||
| ) |
Register an algorithm without metadata for backward compatibility.
- 参数
-
id Stable id. fn Generator callback.
在文件 GeneratorRegistry.cpp 第 11 行定义.
引用了 descriptor, fn, id, eve::procgen::RecipeDescriptor::id , 以及 registerAlgorithm().
被这些函数引用 registerAlgorithm(), registerBuiltins(), eve::procgen::registerHexTerrainAlgorithms(), eve::procgen::registerRoguelikeGenerator(), eve::procgen::registerTerrainHeightmapAlgorithm(), eve::procgen::urban::registerUrbanGenerators() , 以及 eve::procgen::registerWfcSimple().
◆ registerAlgorithm() [2/2]
| void eve::procgen::GeneratorRegistry::registerAlgorithm | ( | GeneratorDescriptor | descriptor, |
| GeneratorFn | fn | ||
| ) |
Register an algorithm together with its dynamic-editor schema.
- 参数
-
descriptor Schema and id. fn Generator callback.
在文件 GeneratorRegistry.cpp 第 18 行定义.
引用了 descriptor, fn , 以及 id.
◆ registerBuiltins()
| void eve::procgen::GeneratorRegistry::registerBuiltins | ( | ) |
Register built-in DTL / custom map algorithms (idempotent).
在文件 BuiltinAlgorithms.cpp 第 226 行定义.
引用了 eve::procgen::ParamDescriptor::floating(), eve::procgen::RecipeDescriptor::grid(), eve::procgen::ParamDescriptor::integer(), registerAlgorithm(), eve::procgen::registerHexTerrainAlgorithms(), eve::procgen::registerRoguelikeGenerator(), eve::procgen::registerTerrainHeightmapAlgorithm(), eve::procgen::urban::registerUrbanGenerators() , 以及 eve::procgen::registerWfcSimple().
被这些函数引用 eve::procgen::Procgen::Procgen().
该类的文档由以下文件生成:
- src/modules/procgen/GeneratorRegistry.h
- src/modules/procgen/algorithms/BuiltinAlgorithms.cpp
- src/modules/procgen/GeneratorRegistry.cpp