载入中...
搜索中...
未找到
eve::procgen::ModuleAssemblyPlan类 参考

Deterministic owner of a validated modular assembly plan. 更多...

#include <ModuleAssembly.h>

Public 成员函数

 ModuleAssemblyPlan ()=default
 Construct an empty plan with default constraints.
 
 ModuleAssemblyPlan (ModuleAssemblyConstraints constraints)
 Construct an empty plan with a copied constraint configuration.
 
Result< void > configure (float cellSize, float floorHeight, int minCellX, int maxCellX, int minCellZ, int maxCellZ, int maxLevels, bool bounded, bool requireConnection)
 Configure an empty plan before definitions or placements are added.
 
Result< void > setAllowedQuarterTurns (bool turn0, bool turn90, bool turn180, bool turn270)
 Configure the four permitted quarter-turn rotations before registration or placement.
 
Result< void > setMinimumSupportRatio (float ratio)
 Require this fraction of an elevated module's bottom cells to be supported from below.
 
Result< void > applyConfigJson (const std::string &json)
 Atomically replace an empty plan's constraints and module definitions from strict JSON. Schema eve.procgen.module-assembly, version 1 rejects unknown fields. Placements are never restored.
 
Result< void > registerModuleType (std::string id, int widthCells, int depthCells)
 Register a module footprint using scalar script-friendly fields.
 
Result< void > registerVolumeModuleType (std::string id, int widthCells, int depthCells, int heightLevels)
 Register a three-dimensional module volume using scalar script-friendly fields.
 
Result< void > addConnector (const std::string &moduleId, int cellX, int cellZ, int facing, std::string tag, std::string accepts)
 Append a typed connector to a registered, not-yet-placed module.
 
Result< void > addVolumeConnector (const std::string &moduleId, int cellX, int cellZ, int levelOffset, int facing, std::string tag, std::string accepts)
 Append a typed connector to one face of a cell in a module volume.
 
Result< void > registerModule (ModuleDefinition definition)
 Register one module definition before it is placed.
 
Result< void > place (ModulePlacement placement)
 Validate and atomically append one placement. @cost Linear in existing occupied cells and connectors.
 
const std::vector< ModulePlacement > & placements () const noexcept
 Borrow the accepted placements in deterministic insertion order.
 
int getPlacementCount () const noexcept
 Return the number of accepted placements.
 
std::string getPlacementModule (int index) const
 Return one accepted placement's module id, or empty text for an invalid index.
 
float getPlacementX (int index) const noexcept
 Return one placement's world X coordinate, or zero for an invalid index.
 
float getPlacementY (int index) const noexcept
 Return one placement's world Y coordinate, or zero for an invalid index.
 
float getPlacementZ (int index) const noexcept
 Return one placement's world Z coordinate, or zero for an invalid index.
 
float getPlacementYawDegrees (int index) const noexcept
 Return one placement's yaw in degrees, or zero for an invalid index.
 
const ModuleAssemblyConstraints & constraints () const noexcept
 Return the immutable constraint configuration.
 

详细描述

Deterministic owner of a validated modular assembly plan.

Definitions are registered before placement. A placement is committed only after its rotated footprint, bounds, occupancy and every touching connector have been validated. Failed placements leave the plan unchanged.

@ownership Owns definitions and placements by value. @thread Affine to the caller; external synchronization is required. @reentrancy Does not invoke callbacks.

在文件 ModuleAssembly.h 第 69 行定义.

构造及析构函数说明

◆ ModuleAssemblyPlan() [1/2]

eve::procgen::ModuleAssemblyPlan::ModuleAssemblyPlan ( )
default

Construct an empty plan with default constraints.

◆ ModuleAssemblyPlan() [2/2]

eve::procgen::ModuleAssemblyPlan::ModuleAssemblyPlan ( ModuleAssemblyConstraints  constraints)
explicit

Construct an empty plan with a copied constraint configuration.

在文件 ModuleAssembly.cpp 第 132 行定义.

成员函数说明

◆ addConnector()

Result< void > eve::procgen::ModuleAssemblyPlan::addConnector ( const std::string &  moduleId,
int  cellX,
int  cellZ,
int  facing,
std::string  tag,
std::string  accepts 
)

Append a typed connector to a registered, not-yet-placed module.

在文件 ModuleAssembly.cpp 第 269 行定义.

引用了 accepts, addVolumeConnector(), facing , 以及 tag.

◆ addVolumeConnector()

Result< void > eve::procgen::ModuleAssemblyPlan::addVolumeConnector ( const std::string &  moduleId,
int  cellX,
int  cellZ,
int  levelOffset,
int  facing,
std::string  tag,
std::string  accepts 
)

Append a typed connector to one face of a cell in a module volume.

在文件 ModuleAssembly.cpp 第 274 行定义.

引用了 accepts, eve::Applied, facing, eve::InvalidArgument, eve::NotFound, eve::PreconditionViolation, eve::Status::success(), eve::Result< T >::success() , 以及 tag.

被这些函数引用 addConnector() , 以及 applyConfigJson().

◆ applyConfigJson()

Result< void > eve::procgen::ModuleAssemblyPlan::applyConfigJson ( const std::string &  json)

Atomically replace an empty plan's constraints and module definitions from strict JSON. Schema eve.procgen.module-assembly, version 1 rejects unknown fields. Placements are never restored.

参数
jsonUTF-8 configuration, limited to 1 MiB, owning no external references.
返回
Parse/validation failure without mutation, or an applied empty configured plan. @thread Caller-affine, synchronous, callback-free. @cost Linear in JSON bytes plus module and connector count; intended for one-time setup.

在文件 ModuleAssembly.cpp 第 175 行定义.

引用了 accepts, addVolumeConnector(), eve::Applied, bounds, configure(), constraints(), depth, enabled, facing, eve::Result< T >::failure(), eve::Value::fromJson(), height, eve::InvalidArgument, level, number, eve::PreconditionViolation, registerVolumeModuleType(), root, setAllowedQuarterTurns(), setMinimumSupportRatio(), eve::Status::success(), eve::Result< T >::success(), tag, turns, width, x , 以及 z.

◆ configure()

◆ constraints()

const ModuleAssemblyConstraints & eve::procgen::ModuleAssemblyPlan::constraints ( ) const
inlinenoexcept

Return the immutable constraint configuration.

在文件 ModuleAssembly.h 第 139 行定义.

被这些函数引用 applyConfigJson().

◆ getPlacementCount()

int eve::procgen::ModuleAssemblyPlan::getPlacementCount ( ) const
inlinenoexcept

Return the number of accepted placements.

在文件 ModuleAssembly.h 第 127 行定义.

◆ getPlacementModule()

std::string eve::procgen::ModuleAssemblyPlan::getPlacementModule ( int  index) const

Return one accepted placement's module id, or empty text for an invalid index.

在文件 ModuleAssembly.cpp 第 406 行定义.

引用了 index.

◆ getPlacementX()

float eve::procgen::ModuleAssemblyPlan::getPlacementX ( int  index) const
noexcept

Return one placement's world X coordinate, or zero for an invalid index.

在文件 ModuleAssembly.cpp 第 412 行定义.

引用了 index.

◆ getPlacementY()

float eve::procgen::ModuleAssemblyPlan::getPlacementY ( int  index) const
noexcept

Return one placement's world Y coordinate, or zero for an invalid index.

在文件 ModuleAssembly.cpp 第 418 行定义.

引用了 index , 以及 level.

◆ getPlacementYawDegrees()

float eve::procgen::ModuleAssemblyPlan::getPlacementYawDegrees ( int  index) const
noexcept

Return one placement's yaw in degrees, or zero for an invalid index.

在文件 ModuleAssembly.cpp 第 430 行定义.

引用了 index.

◆ getPlacementZ()

float eve::procgen::ModuleAssemblyPlan::getPlacementZ ( int  index) const
noexcept

Return one placement's world Z coordinate, or zero for an invalid index.

在文件 ModuleAssembly.cpp 第 424 行定义.

引用了 index.

◆ place()

◆ placements()

const std::vector< ModulePlacement > & eve::procgen::ModuleAssemblyPlan::placements ( ) const
inlinenoexcept

Borrow the accepted placements in deterministic insertion order.

在文件 ModuleAssembly.h 第 125 行定义.

◆ registerModule()

Result< void > eve::procgen::ModuleAssemblyPlan::registerModule ( ModuleDefinition  definition)

Register one module definition before it is placed.

在文件 ModuleAssembly.cpp 第 293 行定义.

引用了 eve::AlreadyExists, eve::Applied, eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 registerModuleType() , 以及 registerVolumeModuleType().

◆ registerModuleType()

Result< void > eve::procgen::ModuleAssemblyPlan::registerModuleType ( std::string  id,
int  widthCells,
int  depthCells 
)

Register a module footprint using scalar script-friendly fields.

在文件 ModuleAssembly.cpp 第 258 行定义.

引用了 registerModule().

◆ registerVolumeModuleType()

Result< void > eve::procgen::ModuleAssemblyPlan::registerVolumeModuleType ( std::string  id,
int  widthCells,
int  depthCells,
int  heightLevels 
)

Register a three-dimensional module volume using scalar script-friendly fields.

在文件 ModuleAssembly.cpp 第 262 行定义.

引用了 registerModule().

被这些函数引用 applyConfigJson().

◆ setAllowedQuarterTurns()

Result< void > eve::procgen::ModuleAssemblyPlan::setAllowedQuarterTurns ( bool  turn0,
bool  turn90,
bool  turn180,
bool  turn270 
)

Configure the four permitted quarter-turn rotations before registration or placement.

在文件 ModuleAssembly.cpp 第 154 行定义.

引用了 eve::procgen::ModuleAssemblyConstraints::allowedQuarterTurns, eve::Applied, eve::InvalidArgument, eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 applyConfigJson().

◆ setMinimumSupportRatio()

Result< void > eve::procgen::ModuleAssemblyPlan::setMinimumSupportRatio ( float  ratio)

Require this fraction of an elevated module's bottom cells to be supported from below.

A value of zero permits cantilevered modules; one requires every bottom cell to have an occupied cell directly beneath it. Touching vertical faces still require compatible Up/Down connectors.

在文件 ModuleAssembly.cpp 第 164 行定义.

引用了 eve::Applied, eve::InvalidArgument, eve::procgen::ModuleAssemblyConstraints::minimumSupportRatio, eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().

被这些函数引用 applyConfigJson().


该类的文档由以下文件生成: