Skip to content

EntropyEngine::Core::Debug::INamed

Interface for objects that support debug naming. More…

#include <INamed.h>

Inherited by EntropyEngine::Core::Debug::Named

Name
virtual~INamed() =default
virtual voidsetName(std::string_view name) =0
Set the debug name for this object.
virtual boolhasName() const
Check if this object has a debug name set.
virtual std::string_viewgetName() const =0
Get the debug name of this object.
class EntropyEngine::Core::Debug::INamed;

Interface for objects that support debug naming.

Standardizes debug naming across objects. Implement when objects appear in logs, debug output, or profiler traces.

class MyComponent : public INamed {
std::string name;
public:
void setName(std::string_view n) override { name = n; }
std::string_view getName() const override { return name; }
};
// Meaningful log output
LOG_INFO("Processing component: {}", component->getName());
// Output: "Processing component: PlayerHealthUI"
virtual ~INamed() =default
virtual void setName(
std::string_view name
) =0

Set the debug name for this object.

Parameters:

  • name The debug name to assign (can be empty to clear)

Reimplemented by: EntropyEngine::Core::Debug::Named::setName

Assigns a name for use in logs and debug output. Choose descriptive names that indicate purpose (e.g., “MainMenuUI”, “PlayerHealthBar”).

inline virtual bool hasName() const

Check if this object has a debug name set.

Return: true if a non-empty debug name is set

Useful for conditional formatting with fallback to addresses.

std::string getObjectDescription(const INamed* obj) {
if (obj->hasName()) {
return std::format("'{}'", obj->getName());
} else {
return std::format("<unnamed at {}>", static_cast<const void*>(obj));
}
}
virtual std::string_view getName() const =0

Get the debug name of this object.

Return: The current debug name (may be empty)

Reimplemented by: EntropyEngine::Core::Debug::Named::getName

Returns the assigned name or empty string if unnamed.

if (object->hasName()) {
LOG_INFO("Found object: {}", object->getName());
} else {
LOG_INFO("Found unnamed object at {}", static_cast<void*>(object));
}

Updated on 2026-01-26 at 17:14:35 -0500