λ61
Loading...
Searching...
No Matches
l61::Object Class Reference

#include <Object.hpp>

Inheritance diagram for l61::Object:
l61::EventSystem::Timing::AbstractTimer l61::ExtensionSystem::NativeExtension l61::RosettaSystem::EnvironmentVariable l61::ScriptEngine::ScriptEnvironment l61::EventSystem::Timing::AsyncTimer l61::ScriptEngine::FileBackedScriptEnvironment l61::ScriptEngine::RunnableScriptEnvironment l61::ScriptEngine::BuildScript

Public Member Functions

virtual ~Object ()=default
virtual std::string toString () const
 Returns a human-readable string representation of the object.
virtual std::size_t hashCode () const
 Returns a hash code for the object.
std::string typeName () const
 Returns the demangled name of the type.
const std::type_info & typeInfo () const
 Returns RTTI type information object.
virtual nlohmann::json toJsonValue () const
 Serializes the object into JSON form.
 operator std::string () const
 Explicit conversion operator to std::string.
 operator nlohmann::json () const
 Explicit conversion operator to nlohmann::json.

Constructor & Destructor Documentation

◆ ~Object()

virtual l61::Object::~Object ( )
virtualdefault

Member Function Documentation

◆ hashCode()

std::size_t l61::Object::hashCode ( ) const
virtual

Returns a hash code for the object.

This is useful for putting objects into unordered containers (e.g., std::unordered_map, std::unordered_set) or for comparisons by value. Derived classes should override this to compute a stable hash of their data.

Returns
std::size_t computed hash value.

Reimplemented in l61::RosettaSystem::EnvironmentVariable.

◆ operator nlohmann::json()

l61::Object::operator nlohmann::json ( ) const
explicit

Explicit conversion operator to nlohmann::json.

Delegates to toJsonValue().

Returns
nlohmann::json JSON representation of the object.

◆ operator std::string()

l61::Object::operator std::string ( ) const
explicit

Explicit conversion operator to std::string.

Enables syntax like:

Object* obj = ...;
std::string text = static_cast<std::string>(*obj);
Definition Object.hpp:47

By default, this should delegate to toString().

Returns
std::string representation of the object.

◆ toJsonValue()

nlohmann::json l61::Object::toJsonValue ( ) const
virtual

Serializes the object into JSON form.

Intended for persistence, logging, or communication. Derived classes should override this to produce structured JSON output representing their state.

Returns
nlohmann::json JSON representation of the object.

Reimplemented in l61::RosettaSystem::EnvironmentVariable.

◆ toString()

std::string l61::Object::toString ( ) const
virtual

Returns a human-readable string representation of the object.

Derived classes should override this to provide a meaningful textual description of their internal state. Default implementation may just return the type name or placeholder text.

Returns
std::string textual representation of the object.

Reimplemented in l61::ExtensionSystem::NativeExtension, l61::RosettaSystem::EnvironmentVariable, and l61::ScriptEngine::FileBackedScriptEnvironment.

◆ typeInfo()

const std::type_info & l61::Object::typeInfo ( ) const

Returns RTTI type information object.

This returns a reference to std::type_info for the actual dynamic type of the object, enabling type-safe runtime comparisons.

Returns
const std::type_info& reference to RTTI info.

◆ typeName()

std::string l61::Object::typeName ( ) const

Returns the demangled name of the type.

Provides the runtime name of the object’s dynamic type. Typically uses RTTI (typeid) internally and may demangle compiler-specific output.

Returns
std::string name of the dynamic type.

The documentation for this class was generated from the following files: