virtual void notify(const PhaseEventInfo<PhaseEvent::PassEnd> *) { return; };
};
+// TODO Will be other mix-ins for Phase Runners?
+class PhaseRunnerMixinObservable
+{
+public:
+ PhaseRunnerMixinObservable() = default;
+
+public:
+ virtual ~PhaseRunnerMixinObservable() = default;
+
+public:
+ void attach(PhaseEventListener *listener) { _listener = listener; }
+
+public:
+ void notifyPhaseBegin(void) const
+ {
+ if (_listener)
+ {
+ PhaseEventInfo<PhaseEvent::PhaseBegin> info;
+
+ _listener->notify(&info);
+ }
+ }
+
+ void notifyPhaseEnd(void) const
+ {
+ if (_listener)
+ {
+ PhaseEventInfo<PhaseEvent::PhaseEnd> info;
+
+ _listener->notify(&info);
+ }
+ }
+
+ void notifyPassBegin(Pass *pass) const
+ {
+ if (_listener)
+ {
+ PhaseEventInfo<PhaseEvent::PassBegin> info;
+
+ info.pass(pass);
+
+ _listener->notify(&info);
+ }
+ }
+
+ void notifyPassEnd(Pass *pass, bool changed) const
+ {
+ if (_listener)
+ {
+ PhaseEventInfo<PhaseEvent::PassEnd> info;
+
+ info.pass(pass);
+ info.changed(changed);
+
+ _listener->notify(&info);
+ }
+ }
+
+private:
+ PhaseEventListener *_listener = nullptr;
+};
+
enum class PhaseStrategy
{
// Run all the passes until there is no pass that makes a change