EduArt Sensor Ring Library 4.0.0
Loading...
Searching...
No Matches
Command.hpp
Go to the documentation of this file.
1// Copyright (c) 2026 EduArt Robotik GmbH
2
9
10#pragma once
11
12#include <deque>
13#include <functional>
14#include <string_view>
15#include <unordered_map>
16
17namespace eduart {
18
19namespace sensorring {
20
21using Action = std::function<void()>;
22using ActionKey = std::string_view;
23
25
26struct Command {
28 Action execute;
29
31 const ActionDispatcher* owner = nullptr;
32
34 ActionKey key{};
35
37 bool isReplaceable() const { return owner != nullptr && !key.empty(); }
38};
39
40} // namespace sensorring
41
42} // namespace eduart
Base class that executes actions either immediately or via a managed queue.
Definition ActionDispatcher.hpp:29
Definition Command.hpp:26
bool isReplaceable() const
Returns true if this command is replaceable (i.e. has a non-null owner and a non-empty key).
Definition Command.hpp:37
const ActionDispatcher * owner
Owner of the command used to identify replaceable actions. If owner == nullptr, this task is non-repl...
Definition Command.hpp:31
Action execute
Callable to execute the action.
Definition Command.hpp:28
ActionKey key
Key used to identify replaceable actions for a specific owner instance. If key is empty,...
Definition Command.hpp:34