3#include <Infinity/api.h>
4#include <Infinity/Types/Util/Hash.hpp>
104 : tag(tag), hash(hash), name(name) { }
202 return tag == other.
tag;
213 return !(*
this == other);
262 return reinterpret_cast<size_t>(
id.tag);
285#define INFINITY_TYPE(...) \
286 template <> INFINITY_API_PUBLIC const ::Infinity::Types::TypeID& ::Infinity::Types::getTypeID<__VA_ARGS__>();
313#define INFINITY_TYPE_IMPL(...) \
315 const ::Infinity::Types::TypeID& ::Infinity::Types::getTypeID<__VA_ARGS__>() { \
316 static const char* name = #__VA_ARGS__; \
317 static ::Infinity::Types::TypeID id((::Infinity::Types::TypeTag)name, \
318 ::Infinity::Types::TypeID::create_stable_hash(name, std::strlen(name)), \
332#define INFINITY_TYPE_NAME(...)
343#define INFINITY_TYPE_CONVERT(...)
const void * TypeTag
Opaque pointer used as a unique compile-time identifier for types.
Definition TypeID.hpp:19
const TypeID & getTypeID()
Gets the TypeID for a given type T.
uint64_t TypeHash
64-bit hash value computed from a type's name.
Definition TypeID.hpp:30
Runtime type identifier for the Infinity type system.
Definition TypeID.hpp:71
bool canConvert(const TypeID &other) const
Checks if this type can be converted to another type.
constexpr bool operator!=(const TypeID &other) const
Inequality comparison operator.
Definition TypeID.hpp:211
TypeID()
Default constructor.
constexpr TypeID(TypeTag tag, TypeHash hash, const char *name)
Constructs a complete TypeID with all components.
Definition TypeID.hpp:103
TypeID(TypeHash hash)
Constructs a TypeID from a hash value.
TypeHash hash
Stable hash of the type name for serialization.
Definition TypeID.hpp:73
constexpr bool operator==(const TypeID &other) const
Equality comparison operator.
Definition TypeID.hpp:200
std::string hashStr() const
Gets the hash value as a hexadecimal string.
void read(std::istream &is)
Deserializes a TypeID from an input stream.
const char * name
Human-readable type name string.
Definition TypeID.hpp:74
void write(std::ostream &os) const
Serializes the TypeID to an output stream.
static TypeHash create_stable_hash(const char *name, size_t len)
Computes a stable hash from a type name string.
TypeTag tag
Unique compile-time identifier.
Definition TypeID.hpp:72
std::string str() const
Gets the human-readable type name string.
size_t operator()(const Infinity::Types::TypeID &id) const
Computes hash value for a TypeID.
Definition TypeID.hpp:260