Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
bertini::AnyEvent Class Reference

Strawman Event type, enabling polymorphism. More...

#include <events.hpp>

Inheritance diagram for bertini::AnyEvent:
[legend]

Public Member Functions

virtual ~AnyEvent ()=default

Detailed Description

Strawman Event type, enabling polymorphism.

This class is abstract, and should never actually be created.

Lifetime contract (important!)
Events are short-lived stack temporaries. An observable emits one with NotifyObservers(SomeEvent<T>(*this)), so the event lives only for the duration of that NotifyObservers call — i.e. only while Observe() is running. Moreover, the concrete event subclasses hold their payload by const& into the emitter's internal buffers (e.g. resulting_point_, start_point_), which may themselves be reused on the next step.

Therefore an observer must not store a reference or pointer to an event (or to anything it returns by reference) past the return of Observe(). If you need to keep data, copy it out by value inside Observe(). This is exactly what the Python observer layer does: it reads values during the call and copies them into its own storage.

Constructor & Destructor Documentation

◆ ~AnyEvent()

virtual bertini::AnyEvent::~AnyEvent ( )
virtualdefault