SimpleStatusHandler.h
Go to the documentation of this file.
1#pragma once
2
3#include <mutex>
4#include <vector>
5
7
9{
10
11 /**
12 * @brief Dispatches gaze target lifecycle updates to registered callbacks.
13 *
14 * Base of both delivery modes (MemorySubscriber, MemoryPolling), so instrumentation and
15 * dispatch exist once regardless of how the updates were obtained.
16 */
18 {
19 public:
20 void onRequested(const Callback& callback) override;
21 void onScheduled(const Callback& callback) override;
22 void onReached(const Callback& callback) override;
23 void onPreempted(const Callback& callback) override;
24 void onReleased(const Callback& callback) override;
25 void onAborted(const Callback& callback) override;
26 void onAny(const Callback& callback) override;
27
28 /// Logs the update and hands it to the matching callbacks.
30
31 private:
32 std::mutex callbackMutex;
33
34 struct
35 {
36 std::vector<Callback> requested;
37 std::vector<Callback> scheduled;
38 std::vector<Callback> reached;
39 std::vector<Callback> preempted;
40 std::vector<Callback> released;
41 std::vector<Callback> aborted;
42 std::vector<Callback> any;
43 } subscriptions;
44 };
45
46} // namespace armarx::view_selection::client
Dispatches gaze target lifecycle updates to registered callbacks.
void onReleased(const Callback &callback) override
void onAny(const Callback &callback) override
Called for every update, whatever its status.
void handleStatus(const gaze_targets::GazeTargetStatus &status)
Logs the update and hands it to the matching callbacks.
void onScheduled(const Callback &callback) override
void onAborted(const Callback &callback) override
void onRequested(const Callback &callback) override
void onReached(const Callback &callback) override
void onPreempted(const Callback &callback) override
Registration of callbacks for gaze target lifecycle updates.
std::function< void(const gaze_targets::GazeTargetStatus &)> Callback
Business Object (BO) class of GazeTargetStatus: the lifecycle of one gaze target request,...