Entity Generator 1.1.0
Composable, deterministic entity generation for C++23
Loading...
Searching...
No Matches
dasmig::generation_observer Class Reference

Observer interface for hooking into generation lifecycle events. More...

#include <entitygen.hpp>

Inheritance diagram for dasmig::generation_observer:
dasmig::ext::stats_observer

Public Member Functions

virtual ~generation_observer ()=default
 Virtual destructor.
 
Entity Lifecycle
virtual void on_before_generate ()
 Called before an entity is generated.
 
virtual void on_after_generate (const entity &e)
 Called after an entity is successfully generated.
 
Component Generation
virtual void on_before_component (const std::wstring &key)
 Called before a component is generated.
 
virtual void on_after_component (const std::wstring &key, const std::any &value)
 Called after a component is successfully generated.
 
Component Skip
virtual void on_skip (const std::wstring &key)
 Called when a component is skipped (weight roll or conditional exclusion).
 
Component Validation
virtual void on_before_retry (const std::wstring &key, std::size_t attempt)
 Called before a component validation retry.
 
virtual void on_after_retry (const std::wstring &key, std::size_t attempt, const std::any &value)
 Called after a component validation retry.
 
virtual void on_component_fail (const std::wstring &key)
 Called when component validation is exhausted (precedes exception).
 
Entity Validation
virtual void on_before_entity_retry (std::size_t attempt)
 Called before an entity validation retry.
 
virtual void on_after_entity_retry (std::size_t attempt)
 Called after an entity validation retry.
 
virtual void on_entity_fail ()
 Called when entity validation is exhausted (precedes exception).
 
Component Registration
virtual void on_before_add (const std::wstring &key)
 Called before a component is registered.
 
virtual void on_after_add (const std::wstring &key)
 Called after a component is registered.
 
virtual void on_before_remove (const std::wstring &key)
 Called before a component is removed.
 
virtual void on_after_remove (const std::wstring &key)
 Called after a component is removed.
 

Detailed Description

Observer interface for hooking into generation lifecycle events.

Override only the methods you care about; all default to no-ops. Multiple observers can be attached to a generator via eg::add_observer().

See also
eg::add_observer(), dasmig::ext::stats_observer

Definition at line 583 of file entitygen.hpp.

Member Function Documentation

◆ on_after_add()

virtual void dasmig::generation_observer::on_after_add ( const std::wstring &  key)
inlinevirtual

Called after a component is registered.

Parameters
keyThe component key that was added.

Definition at line 663 of file entitygen.hpp.

◆ on_after_component()

virtual void dasmig::generation_observer::on_after_component ( const std::wstring &  key,
const std::any &  value 
)
inlinevirtual

Called after a component is successfully generated.

Parameters
keyThe component key.
valueThe generated value.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 608 of file entitygen.hpp.

◆ on_after_entity_retry()

virtual void dasmig::generation_observer::on_after_entity_retry ( std::size_t  attempt)
inlinevirtual

Called after an entity validation retry.

Parameters
attemptThe entity retry attempt number.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 649 of file entitygen.hpp.

◆ on_after_generate()

virtual void dasmig::generation_observer::on_after_generate ( const entity e)
inlinevirtual

Called after an entity is successfully generated.

Parameters
eThe generated entity.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 596 of file entitygen.hpp.

◆ on_after_remove()

virtual void dasmig::generation_observer::on_after_remove ( const std::wstring &  key)
inlinevirtual

Called after a component is removed.

Parameters
keyThe component key that was removed.

Definition at line 670 of file entitygen.hpp.

◆ on_after_retry()

virtual void dasmig::generation_observer::on_after_retry ( const std::wstring &  key,
std::size_t  attempt,
const std::any &  value 
)
inlinevirtual

Called after a component validation retry.

Parameters
keyThe component key.
attemptThe retry attempt number.
valueThe newly generated value.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 632 of file entitygen.hpp.

◆ on_before_add()

virtual void dasmig::generation_observer::on_before_add ( const std::wstring &  key)
inlinevirtual

Called before a component is registered.

Parameters
keyThe component key being added.

Definition at line 660 of file entitygen.hpp.

◆ on_before_component()

virtual void dasmig::generation_observer::on_before_component ( const std::wstring &  key)
inlinevirtual

Called before a component is generated.

Parameters
keyThe component key about to be generated.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 604 of file entitygen.hpp.

◆ on_before_entity_retry()

virtual void dasmig::generation_observer::on_before_entity_retry ( std::size_t  attempt)
inlinevirtual

Called before an entity validation retry.

Parameters
attemptThe entity retry attempt number (1-based).

Definition at line 646 of file entitygen.hpp.

◆ on_before_generate()

virtual void dasmig::generation_observer::on_before_generate ( )
inlinevirtual

Called before an entity is generated.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 593 of file entitygen.hpp.

◆ on_before_remove()

virtual void dasmig::generation_observer::on_before_remove ( const std::wstring &  key)
inlinevirtual

Called before a component is removed.

Parameters
keyThe component key being removed.

Definition at line 667 of file entitygen.hpp.

◆ on_before_retry()

virtual void dasmig::generation_observer::on_before_retry ( const std::wstring &  key,
std::size_t  attempt 
)
inlinevirtual

Called before a component validation retry.

Parameters
keyThe component key being retried.
attemptThe retry attempt number (1-based).

Definition at line 626 of file entitygen.hpp.

◆ on_component_fail()

virtual void dasmig::generation_observer::on_component_fail ( const std::wstring &  key)
inlinevirtual

Called when component validation is exhausted (precedes exception).

Parameters
keyThe failed component key.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 638 of file entitygen.hpp.

◆ on_entity_fail()

virtual void dasmig::generation_observer::on_entity_fail ( )
inlinevirtual

Called when entity validation is exhausted (precedes exception).

Reimplemented in dasmig::ext::stats_observer.

Definition at line 652 of file entitygen.hpp.

◆ on_skip()

virtual void dasmig::generation_observer::on_skip ( const std::wstring &  key)
inlinevirtual

Called when a component is skipped (weight roll or conditional exclusion).

Parameters
keyThe skipped component key.

Reimplemented in dasmig::ext::stats_observer.

Definition at line 617 of file entitygen.hpp.


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