|
Infinity Engine v0.6.20
C++ API Documentation
|
Base class for complex data types with memory wrapping and property support. More...
#include <Data.hpp>
Public Member Functions | |
| Data () | |
| Data (const Data &other) | |
| Data (Data &&other) | |
| Data & | operator= (const Data &other) |
| Data & | operator= (Data &&other) |
| std::unique_ptr< Base > | clone () const override |
| virtual const Infinity::Types::TypeID & | typeId () const override |
| Gets the runtime type identifier for this object. | |
| virtual | ~Data () |
| Virtual destructor. | |
| bool | hasProperty (const std::string &key) const |
| template<typename T > | |
| void | setProperty (const std::string &key, T &&value) |
| Sets a typed property value. | |
| template<typename T > | |
| void | setProperty (const std::string &key, const T &value) |
| Sets a typed property value. | |
| void | setProperty (const std::string &key, PropertyValue &&value) |
| Sets a typed property value. | |
| const PropertyValue & | getProperty (const std::string &key) const |
| Gets a property value without type checking. | |
| template<typename T > | |
| const T & | getProperty (const std::string &key) const |
| Gets a typed property value. | |
| void | removeProperty (const std::string &key) |
Public Member Functions inherited from Infinity::Types::Core::Base | |
| virtual | ~Base () |
| Virtual destructor. | |
| virtual std::istream & | legibleDataRead (std::istream &in) override |
| Deserializes the object from a single-line text representation. | |
| virtual std::ostream & | legibleDataWrite (std::ostream &out) const override |
| Serializes the object to a single-line text representation. | |
Public Attributes | |
| std::unordered_map< std::string, PropertyValue > | properties |
| Property storage for arbitrary metadata. | |
Base class for complex data types with memory wrapping and property support.
Data extends Base to provide support for types that:
Data types represent substantial content like meshes, textures, point clouds, and other large data structures used in procedural generation. Unlike simple value types, Data objects typically:
The property system allows attaching arbitrary metadata to data objects without modifying the core type definition, enabling extensibility and runtime customization.
Example usage:
| Infinity::Types::Core::Data::Data | ( | ) |
| Infinity::Types::Core::Data::Data | ( | const Data & | other | ) |
| Infinity::Types::Core::Data::Data | ( | Data && | other | ) |
|
virtual |
Virtual destructor.
Ensures proper cleanup of derived class resources.
|
overridevirtual |
Reimplemented from Infinity::Types::Core::Base.
Reimplemented in Infinity::Types::Containers::ImmutableMap, Infinity::Types::Containers::Map, Infinity::Types::Core::Value< T >, Infinity::Types::Math::Ramp< T >, Infinity::Types::Procedural::Landscape, Infinity::Types::Procedural::Noise, Infinity::Types::Rendering::IndexBuffer, Infinity::Types::Rendering::Material, Infinity::Types::Rendering::Mesh, Infinity::Types::Rendering::Renderable, Infinity::Types::Rendering::RenderObject, Infinity::Types::Rendering::VertexBuffer, Infinity::Types::Spatial::Spline2D, and Infinity::Types::Spatial::Spline3D.
| const PropertyValue & Infinity::Types::Core::Data::getProperty | ( | const std::string & | key | ) | const |
Gets a property value without type checking.
Retrieves the property value associated with the given key as a Base pointer. The caller is responsible for type checking or casting.
| key | The property name to look up. |
| const T & Infinity::Types::Core::Data::getProperty | ( | const std::string & | key | ) | const |
Gets a typed property value.
Retrieves the property value associated with the given key and attempts to cast it to the specified type. This is a type-safe convenience method that performs dynamic casting automatically.
| T | The expected type of the property value (must derive from Base). |
| key | The property name to look up. |
| bool Infinity::Types::Core::Data::hasProperty | ( | const std::string & | key | ) | const |
| void Infinity::Types::Core::Data::removeProperty | ( | const std::string & | key | ) |
| void Infinity::Types::Core::Data::setProperty | ( | const std::string & | key, |
| const T & | value | ||
| ) |
Sets a typed property value.
Adds or updates a property with the given key. If the key already exists, the previous value is replaced. The value is copied into the property container.
| key | The property name (e.g., "author", "lod_level"). |
| value | The property value. The value is copied. |
| void Infinity::Types::Core::Data::setProperty | ( | const std::string & | key, |
| PropertyValue && | value | ||
| ) |
Sets a typed property value.
Adds or updates a property with the given key. If the key already exists, the previous value is replaced.
| key | The property name (e.g., "author", "lod_level"). |
| value | Shared pointer to the property value (any Base-derived type). |
| void Infinity::Types::Core::Data::setProperty | ( | const std::string & | key, |
| T && | value | ||
| ) |
Sets a typed property value.
Adds or updates a property with the given key. If the key already exists, the previous value is replaced. The value is moved into the property container.
| key | The property name (e.g., "author", "lod_level"). |
| value | Shared pointer to the property value (any Base-derived type). |
|
overridevirtual |
Gets the runtime type identifier for this object.
Returns the TypeID corresponding to the actual concrete type of this object. This enables runtime type checking, dynamic casting, and type-specific dispatch without RTTI overhead.
Derived classes should override this to return their specific TypeID:
Reimplemented from Infinity::Types::Core::Base.
Reimplemented in Infinity::Types::Containers::Array< T >, Infinity::Types::Containers::Array< Infinity::Types::Containers::Array2D >, Infinity::Types::Containers::Array< Infinity::Types::Containers::Array2D< float > >, Infinity::Types::Containers::Array< Infinity::Types::Math::t_Vector2 >, Infinity::Types::Containers::Array< Infinity::Types::Math::t_Vector3 >, Infinity::Types::Containers::Array< Infinity::Types::Math::t_Vector4 >, Infinity::Types::Containers::Array< Infinity::Types::Rendering::Material >, Infinity::Types::Containers::Array< Infinity::Types::Rendering::SubMesh >, Infinity::Types::Containers::Array< Infinity::Types::Spatial::Transform >, Infinity::Types::Containers::Array< uint8_t >, Infinity::Types::Containers::Array2D< T >, Infinity::Types::Containers::Array3D< T >, Infinity::Types::Containers::ImmutableMap, Infinity::Types::Containers::Map, Infinity::Types::Core::Pair< L, R >, Infinity::Types::Core::Value< T >, Infinity::Types::Math::Ramp< T >, Infinity::Types::Procedural::Landscape, Infinity::Types::Procedural::Noise, Infinity::Types::Rendering::IndexBuffer, Infinity::Types::Rendering::Material, Infinity::Types::Rendering::Mesh, Infinity::Types::Rendering::Renderable, Infinity::Types::Rendering::RenderObject, Infinity::Types::Rendering::VertexBuffer, Infinity::Types::Spatial::Spline2D, Infinity::Types::Spatial::Spline3D, and Infinity::Types::Spatial::Spline4D.
| std::unordered_map<std::string, PropertyValue> Infinity::Types::Core::Data::properties |
Property storage for arbitrary metadata.
Stores key-value pairs where keys are strings and values are any type derived from Base. Properties provide a flexible extension mechanism for attaching metadata without modifying type definitions.
Common uses:
Primitive values should be wrapped in Value<T> template: