bolar_2 backup

This commit is contained in:
2026-11-27 16:38:11 +08:00
commit e96d6d19df
305 changed files with 43350 additions and 0 deletions

41
main/app/application.h Normal file
View File

@@ -0,0 +1,41 @@
#pragma once
#include "app/app_event_queue.h"
#include "core/runtime_state.h"
#include "ports/effect_sink.h"
#include "ports/event_publisher.h"
#include "ports/application_observer.h"
#include <array>
namespace borla {
class Application final : public IEventPublisher {
public:
explicit Application(IEffectSink& effects);
[[noreturn]] void Run();
bool Publish(const AppEvent& event) override;
bool AddObserver(IApplicationObserver* observer)
{
if (observer == nullptr || observer_count_ >= observers_.size()) {
return false;
}
observers_[observer_count_++] = observer;
return true;
}
const RuntimeState& state() const { return state_; }
private:
void ProcessEvent(const AppEvent& event);
void LogState(const AppEvent& event) const;
IEffectSink& effects_;
AppEventQueue events_;
RuntimeState state_;
std::array<IApplicationObserver*, 4> observers_{};
size_t observer_count_ = 0;
};
} // namespace borla