Lysa  0.0
Lysa 3D Engine
Object Class Reference

Detailed Description

Base class providing a minimal signal/slot facility and a textual representation.

  • Allow users to connect named signals to handlers (slots).
  • Emit signals by name, invoking all connected handlers in connection order.
  • Provide a virtual toString() for debugging/logging and stream insertion.

Notes:

  • Signal handlers are stored per signal name; multiple handlers per name are supported and are invoked in the order they were connected.
  • This class does not manage thread-safety; external synchronization is required if used across threads.
+ Inheritance diagram for Object:

Public Member Functions

void connect (const Signal::signal &name, const Signal::Handler &handler)
 
void connect (const Signal::signal &name, const std::function< void ()> &handler)
 
void emit (const Signal::signal &name, void *params=nullptr)
 
virtual std::string toString () const
 
 Object () = default
 
virtual ~Object () = default
 

Friends

std::ostream & operator<< (std::ostream &os, const Object &obj)
 

Constructor & Destructor Documentation

Object ( )
default
virtual ~Object ( )
virtualdefault

Member Function Documentation

void connect ( const Signal::signal name,
const Signal::Handler handler 
)

Connects a signal by name to a member/function handler with parameters.

The concrete handler signature is defined by Signal::Handler and allows passing an optional opaque pointer when emitting.

Parameters
nameSignal name to bind to.
handlerCallable to invoke when emit() is called with the same name.
void connect ( const Signal::signal name,
const std::function< void ()> &  handler 
)

Connects a signal by name to a parameterless callable.

This overload is convenient for simple notifications that do not consume the params pointer passed to emit().

Parameters
nameSignal name to bind to.
handlerCallable with no arguments invoked on emit().
void emit ( const Signal::signal name,
void *  params = nullptr 
)

Emits a signal by name, invoking all connected handlers in connection order.

Handlers registered via the Signal::Handler overload receive the params pointer as provided here. Handlers registered via the parameterless overload are called without arguments.

Parameters
nameSignal name to emit.
paramsOptional opaque pointer forwarded to handlers (may be nullptr).
virtual std::string toString ( ) const
inlinevirtual

Returns a human-readable representation of the object for logging/debugging. Override in derived types to provide more context.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Object &  obj 
)
friend

Stream insertion operator that forwards to toString().