ComplexPlotting/src/PlotManager.hpp

42 lines
828 B
C++
Raw Normal View History

2020-09-01 14:02:37 +02:00
#pragma once
#include <vector>
2020-09-01 18:00:34 +02:00
#include <thread>
#include <future>
2020-09-01 14:02:37 +02:00
#include "PlotWindow.hpp"
typedef std::vector<PlotWindow> WList;
class PlotManager
{
public:
2020-09-01 18:00:34 +02:00
inline static const char* const QUIT_COMMANDS[2] = { "q", "quit" };
public:
static void NewPlot(std::string title);
2020-09-01 14:02:37 +02:00
static WList::iterator Remove(WList::iterator it);
static void Loop();
2020-09-01 18:00:34 +02:00
static void Close();
2020-09-01 14:02:37 +02:00
public:
inline static bool isOpen = true;
private:
inline static WList OpenWindows;
inline static int currentID = 0;
2020-09-01 18:00:34 +02:00
inline static std::promise<std::string> inputPromise;
inline static std::future<std::string> inputFuture = inputPromise.get_future();
inline static std::mutex PlotMgrMutex;
private:
static void InputThreadFunction();
private:
inline static std::thread inputThread = std::thread(&PlotManager::InputThreadFunction);
2020-09-01 14:02:37 +02:00
};