IRSOL
C++ code implementing socket server for interacting with Baumer camera.
monitor.hpp
Go to the documentation of this file.
1
23#pragma once
24
26#include "irsol/types.hpp"
27
28#include <atomic>
29#include <chrono>
30#include <thread>
31
32namespace irsol {
33namespace camera {
34
44{
45public:
52 const Interface& cam,
53 irsol::types::duration_t monitorInterval = std::chrono::milliseconds(100));
54
59
64 void start();
65
70 void stop();
71
72protected:
79 virtual void runMonitor() const;
80
81private:
84
87
89 std::atomic<bool> m_hasStartedMonitor;
90
92 std::thread m_monitorThread;
93};
94
95} // namespace camera
96} // namespace irsol
High-level wrapper around the NeoAPI camera for synchronized access.
Definition interface.hpp:61
Class that offers an easy way to run a background monitorin thread that periodically inspects and rep...
Definition monitor.hpp:44
void start()
Starts the monitoring thread. If the monitor is already running, this call has no effect.
Definition monitor.cpp:42
~StatusMonitor()
Destructor stops the monitoring thread if running.
Definition monitor.cpp:15
virtual void runMonitor() const
The main monitoring loop executed on the background thread.
Definition monitor.cpp:24
void stop()
Stops the monitoring thread and waits for it to finish. If the monitor is not running,...
Definition monitor.cpp:52
std::thread m_monitorThread
Thread running the periodic monitoring loop.
Definition monitor.hpp:92
std::atomic< bool > m_hasStartedMonitor
Flag indicating if the monitor thread has been started.
Definition monitor.hpp:89
const irsol::camera::Interface & m_cam
Reference to the camera interface being monitored.
Definition monitor.hpp:83
irsol::types::duration_t m_monitorInterval
Interval at which the monitor thread executes runMonitor()
Definition monitor.hpp:86
High-level wrapper around NeoAPI camera control for the irsol library.
clock_t::duration duration_t
Alias for a duration of time as defined by clock_t.
Definition types.hpp:128
Core type definitions for networking, time handling, and protocol values used throughout the irsol li...