#pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include class LFR_Socket { public: using LFR_Telegram = char[1024]; using ListenerKey = void const*; using ExceptionCallback = std::function; using ListenerCallback = std::function; private: using ListenerPair = std::pair; using ListenerVector = std::vector; ListenerVector listeners; ExceptionCallback cb; bool stop; std::unique_ptr thread; mutable std::mutex mutex; int server_fd, new_socket, bytes_received; struct sockaddr_in address; int opt = 1; int addrlen = sizeof(address); char buffer[1024] = {0}; //void provideOutput(Mat originalImage, Mat processedImage, const FrameData& frameData, const Rect& roi); void createThread(); void setStop(bool val); public: LFR_Socket() = delete; LFR_Socket(ExceptionCallback cb); ~LFR_Socket(); void startLoop(); void endLoop(); void addListener(ListenerCallback cv, ListenerKey key); void removeListener(ListenerKey key); void isStopped() const noexcept; //const bool interpretMessage(co) };