2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2015-08-17 22:54:43 -07:00
|
|
|
|
2015-08-19 19:52:07 -07:00
|
|
|
#include <memory>
|
2015-08-25 18:34:56 -07:00
|
|
|
#include <list>
|
2015-08-19 19:52:07 -07:00
|
|
|
#include "CIOWin.hpp"
|
2015-08-25 18:34:56 -07:00
|
|
|
#include "rstl.hpp"
|
|
|
|
#include "CArchitectureQueue.hpp"
|
2015-08-19 19:52:07 -07:00
|
|
|
|
2016-03-04 15:04:53 -08:00
|
|
|
namespace urde
|
2015-08-17 22:54:43 -07:00
|
|
|
{
|
|
|
|
|
|
|
|
class CIOWinManager
|
|
|
|
{
|
2015-08-19 19:52:07 -07:00
|
|
|
struct IOWinPQNode
|
|
|
|
{
|
2016-02-04 17:27:03 -08:00
|
|
|
std::shared_ptr<CIOWin> x0_iowin;
|
2015-08-25 18:34:56 -07:00
|
|
|
int x4_prio;
|
2017-01-27 01:21:02 -08:00
|
|
|
CIOWinManager::IOWinPQNode* x8_next = nullptr;
|
2016-02-04 17:27:03 -08:00
|
|
|
IOWinPQNode(std::weak_ptr<CIOWin> iowin, int prio,
|
2015-08-25 18:34:56 -07:00
|
|
|
CIOWinManager::IOWinPQNode* next)
|
|
|
|
: x0_iowin(iowin), x4_prio(prio), x8_next(next) {}
|
2016-02-04 17:27:03 -08:00
|
|
|
std::shared_ptr<CIOWin> ShareIOWin() const {return std::shared_ptr<CIOWin>(x0_iowin);}
|
2015-08-25 23:38:45 -07:00
|
|
|
CIOWin* GetIOWin() const {return x0_iowin.get();}
|
2015-08-19 19:52:07 -07:00
|
|
|
};
|
2015-08-25 23:38:45 -07:00
|
|
|
IOWinPQNode* x0_drawRoot = nullptr;
|
|
|
|
IOWinPQNode* x4_pumpRoot = nullptr;
|
2015-08-26 17:23:46 -07:00
|
|
|
CArchitectureQueue x8_localGatherQueue;
|
2015-08-25 18:34:56 -07:00
|
|
|
public:
|
2015-08-19 19:52:07 -07:00
|
|
|
bool OnIOWinMessage(const CArchitectureMessage& msg);
|
2015-08-25 18:34:56 -07:00
|
|
|
void Draw() const;
|
|
|
|
bool DistributeOneMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
|
|
|
void PumpMessages(CArchitectureQueue& queue);
|
2017-11-12 22:19:18 -08:00
|
|
|
CIOWin* FindIOWin(std::string_view name);
|
|
|
|
std::shared_ptr<CIOWin> FindAndShareIOWin(std::string_view name);
|
2015-08-25 23:38:45 -07:00
|
|
|
void ChangeIOWinPriority(CIOWin* toChange, int pumpPrio, int drawPrio);
|
2015-08-25 18:34:56 -07:00
|
|
|
void RemoveAllIOWins();
|
2015-08-25 23:38:45 -07:00
|
|
|
void RemoveIOWin(CIOWin* toRemove);
|
2016-02-04 17:27:03 -08:00
|
|
|
void AddIOWin(std::weak_ptr<CIOWin> toAdd, int pumpPrio, int drawPrio);
|
2017-02-05 19:21:58 -08:00
|
|
|
bool IsEmpty() const { return x0_drawRoot == nullptr && x4_pumpRoot == nullptr; }
|
2015-08-17 22:54:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|