|
Infinity Engine v0.6.20
C++ API Documentation
|
Description and configuration data for a ProceduralComponent instance. More...
#include <ProceduralComponentDescription.hpp>
Public Member Functions | |
| ProceduralComponentDescription (const std::filesystem::path &loadPath) | |
| Loads a ProceduralComponentDescription from a file. | |
| ProceduralComponentDescription (const std::string &yamlString, const std::filesystem::path &loadPath={}) | |
| Creates a ProceduralComponentDescription from a YAML string. | |
| ProceduralComponentDescription (const uint8_t *buffer, const size_t size, const std::filesystem::path &loadPath={}) | |
| Creates a ProceduralComponentDescription from a binary FlatBuffer. | |
| ProceduralComponentDescription (ProceduralComponentDescription &&other) | |
| Move constructor. | |
| ProceduralComponentDescription (const ProceduralComponentDescription ©) | |
| Copy constructor. | |
| ~ProceduralComponentDescription () | |
| Destructor. | |
| ProceduralComponentDescription & | operator= (ProceduralComponentDescription &&other) |
| Move assignment operator. | |
| ProceduralComponentDescription & | operator= (const ProceduralComponentDescription ©) |
| Copy assignment operator. | |
| bool | isFilePCDFlatbuffer (const std::filesystem::path &filepath) |
| Checks if a file is a FlatBuffer-format component description. | |
| void | dump (const std::filesystem::path &path, Infinity::IO::Filetype type=Infinity::IO::Filetype::Flatbuffer) const |
| Serializes this description to a file. | |
| const std::filesystem::path & | getLoadPath () const |
| Gets the package path associated with this description. | |
Friends | |
| class | Infinity::Procedural::ProceduralComponentDescriptionImpl |
| INFINITY_API_PUBLIC std::ostream & | operator<< (std::ostream &os, const ProceduralComponentDescription &desc) |
| Stream insertion operator for debugging and logging. | |
Description and configuration data for a ProceduralComponent instance.
ProceduralComponentDescription encapsulates all the metadata, configuration, and connection information needed to instantiate and initialize a ProceduralComponent. Descriptions can be loaded from files (YAML or FlatBuffer formats), created from strings or binary buffers, and serialized back to disk.
The description includes:
Example usage:
| Infinity::Procedural::ProceduralComponentDescription::ProceduralComponentDescription | ( | const std::filesystem::path & | loadPath | ) |
Loads a ProceduralComponentDescription from a file.
Automatically detects whether the file is in YAML or FlatBuffer format and deserializes accordingly. FlatBuffer files load significantly faster than YAML files.
| loadPath | Path to the component description file (.prcc). |
| std::runtime_error | if the file cannot be read or parsed. |
| Infinity::Procedural::ProceduralComponentDescription::ProceduralComponentDescription | ( | const std::string & | yamlString, |
| const std::filesystem::path & | loadPath = {} |
||
| ) |
Creates a ProceduralComponentDescription from a YAML string.
| yamlString | YAML-formatted string containing the component description. |
| loadPath | Optional path indicating where this description conceptually resides (used as the package path for loading component files). |
| std::runtime_error | if the YAML cannot be parsed. |
| Infinity::Procedural::ProceduralComponentDescription::ProceduralComponentDescription | ( | const uint8_t * | buffer, |
| const size_t | size, | ||
| const std::filesystem::path & | loadPath = {} |
||
| ) |
Creates a ProceduralComponentDescription from a binary FlatBuffer.
| buffer | Pointer to the FlatBuffer binary data. |
| size | Size of the buffer in bytes. |
| loadPath | Optional path indicating where this description conceptually resides (used as the package path for loading component files). |
| std::runtime_error | if the buffer is invalid or cannot be parsed. |
| Infinity::Procedural::ProceduralComponentDescription::ProceduralComponentDescription | ( | ProceduralComponentDescription && | other | ) |
Move constructor.
| other | The ProceduralComponentDescription to move from. |
| Infinity::Procedural::ProceduralComponentDescription::ProceduralComponentDescription | ( | const ProceduralComponentDescription & | copy | ) |
Copy constructor.
| copy | The ProceduralComponentDescription to copy from. |
| Infinity::Procedural::ProceduralComponentDescription::~ProceduralComponentDescription | ( | ) |
Destructor.
| void Infinity::Procedural::ProceduralComponentDescription::dump | ( | const std::filesystem::path & | path, |
| Infinity::IO::Filetype | type = Infinity::IO::Filetype::Flatbuffer |
||
| ) | const |
Serializes this description to a file.
Writes the component description to disk in either YAML (human-readable) or FlatBuffer (compact binary) format.
| path | The filesystem path where the description should be written. |
| type | The file format to use (default: FlatBuffer). |
| const std::filesystem::path & Infinity::Procedural::ProceduralComponentDescription::getLoadPath | ( | ) | const |
Gets the package path associated with this description.
The load path is the base directory containing all ProceduralComponent files, including the shared library itself (if not statically linked or scripted). This path is used for loading the component's initial data and can optionally be used to load component-specific default assets, though these may be overridden by the containing ProceduralSystem if configured to use different assets.
| bool Infinity::Procedural::ProceduralComponentDescription::isFilePCDFlatbuffer | ( | const std::filesystem::path & | filepath | ) |
Checks if a file is a FlatBuffer-format component description.
Examines the file to determine if it's in binary FlatBuffer format rather than YAML format.
| filepath | Path to the file to check. |
| ProceduralComponentDescription & Infinity::Procedural::ProceduralComponentDescription::operator= | ( | const ProceduralComponentDescription & | copy | ) |
Copy assignment operator.
| copy | The ProceduralComponentDescription to copy from. |
| ProceduralComponentDescription & Infinity::Procedural::ProceduralComponentDescription::operator= | ( | ProceduralComponentDescription && | other | ) |
Move assignment operator.
| other | The ProceduralComponentDescription to move from. |
|
friend |
|
friend |
Stream insertion operator for debugging and logging.
| os | Output stream to write to. |
| desc | The ProceduralComponentDescription to output. |