49 lines
1.0 KiB
C++
49 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
class ControlServer;
|
|
class OpenGLComposite;
|
|
class OscServer;
|
|
class RuntimeHost;
|
|
|
|
struct RuntimePollEvents
|
|
{
|
|
bool registryChanged = false;
|
|
bool reloadRequested = false;
|
|
bool failed = false;
|
|
std::string error;
|
|
};
|
|
|
|
class RuntimeServices
|
|
{
|
|
public:
|
|
RuntimeServices();
|
|
~RuntimeServices();
|
|
|
|
bool Start(OpenGLComposite& composite, RuntimeHost& runtimeHost, std::string& error);
|
|
void BeginPolling(RuntimeHost& runtimeHost);
|
|
void Stop();
|
|
void BroadcastState();
|
|
RuntimePollEvents ConsumePollEvents();
|
|
|
|
private:
|
|
void StartPolling(RuntimeHost& runtimeHost);
|
|
void StopPolling();
|
|
void PollLoop(RuntimeHost& runtimeHost);
|
|
|
|
std::unique_ptr<ControlServer> mControlServer;
|
|
std::unique_ptr<OscServer> mOscServer;
|
|
std::thread mPollThread;
|
|
std::atomic<bool> mPollRunning;
|
|
std::atomic<bool> mRegistryChanged;
|
|
std::atomic<bool> mReloadRequested;
|
|
std::atomic<bool> mPollFailed;
|
|
std::mutex mPollErrorMutex;
|
|
std::string mPollError;
|
|
};
|