3#include <Infinity/api.h>
4#include <Infinity/Procedural/ProceduralComponentDescription.hpp>
5#include <Infinity/Procedural/ComponentID.hpp>
6#include <Infinity/Engine/PRNG.hpp>
7#include <Infinity/Util/unordered_dense.h>
8#include <Infinity/Types/All.hpp>
26class ProceduralComponentImpl;
133 bool hasIn(
const std::string& name)
const;
141 bool hasOut(
const std::string& name)
const;
156 const T&
getIn(
const std::string& name)
const
158 if constexpr (std::is_base_of_v<Infinity::Types::Core::Data, T>)
160 return *
dynamic_cast<const T*
>(getInData(name));
177 void setOut(
const std::string& name, T&& val)
179 if constexpr (std::is_base_of_v<Infinity::Types::Core::Data, T>)
181 setOutData(name, std::make_shared<T>(std::move(val)));
198 void setOut(
const std::string& name,
const T& val)
200 if constexpr (std::is_base_of_v<Infinity::Types::Core::Data, T>)
202 setOutData(name, std::make_shared<T>(val));
216 void setOut(
const std::string& name,
const T* val)
218 setOutData(name, std::make_shared<T>(*val));
231 void forward(
const std::string& from,
const std::string& to);
278 void setOutData(
const std::string& name, std::shared_ptr<const Infinity::Types::Core::Base> data);
280 std::unique_ptr<ProceduralComponentImpl> _impl;
282 friend class Infinity::Procedural::ProceduralComponentImpl;
Pseudo-random number generator for procedural generation.
Definition PRNG.hpp:48
Description and configuration data for a ProceduralComponent instance.
Definition ProceduralComponentDescription.hpp:48
Base class for procedural generation components.
Definition ProceduralComponent.hpp:73
void setOut(const std::string &name, const T &val)
Sets typed data on an output port (const reference overload).
Definition ProceduralComponent.hpp:198
Infinity::Engine::PRNG prng
Pseudo-random number generator for reproducible randomness.
Definition ProceduralComponent.hpp:90
ComponentID id() const
Gets the ComponentID identifying this component's type.
bool hasIn(const std::string &name) const
Checks if an input port with the given name exists.
void logDebug(const std::string &msg) const
Logs a debug message.
void logInfo(const std::string &msg) const
Logs an informational message.
virtual ~ProceduralComponent()
Virtual destructor.
void setOut(const std::string &name, const T *val)
Sets typed data on an output port from a pointer (copied).
Definition ProceduralComponent.hpp:216
ProceduralComponent(const ProceduralComponentDescription &desc)
Constructs a ProceduralComponent from a component description.
const T & getIn(const std::string &name) const
Retrieves typed data from an input port.
Definition ProceduralComponent.hpp:156
void setOut(const std::string &name, T &&val)
Sets typed data on an output port (rvalue reference overload).
Definition ProceduralComponent.hpp:177
ProceduralComponentRuntime runtime()
Gets runtime information about this component instance.
bool hasOut(const std::string &name) const
Checks if an output port with the given name exists.
void logError(const std::string &msg) const
Logs an error message.
void forward(const std::string &from, const std::string &to)
Forwards data from an input port directly to an output port.
uint32_t random()
Generates a random uint32 value using the component's PRNG.
virtual void execute()=0
Executes the component's procedural generation logic.
void logWarning(const std::string &msg) const
Logs a warning message.
Abstract base class for all Infinity Engine data types.
Definition Base.hpp:43
Template wrapper for primitive types to integrate with the Infinity type system.
Definition Value.hpp:89
Definition ComponentException.hpp:7
ProceduralComponentRuntime
Definition ProceduralComponent.hpp:18
Unique identifier for a procedural component.
Definition ComponentID.hpp:35