utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
hand_event.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <concepts>
26#include <memory>
27#include <type_traits>
28#include <ostream>
29
30#include "utility/event/event.hpp"
31
32#include "utility/graphic/pose.hpp"
33
34namespace utility::event
35{
36
44 class HandEvent: public Event
45 {
46 public:
51 enum class HandType {
52 Unknown = 0,
53 Left = 1,
54 Right = 2,
55 };
56
57 private:
58 HandType _handType {
60 };
61 graphic::PoseF _pose {};
62 graphic::PoseF _aim {};
63 graphic::PoseF _grip {};
64 graphic::PoseF _gripSurface {};
66 public:
70 explicit HandEvent(void);
71
75 virtual ~HandEvent(void) override;
76
82 HandEvent &setHandType(const HandType handType) noexcept;
83
88 HandType getHandType(void) const noexcept;
89
95 HandEvent &setPose(const graphic::PoseF &pose) noexcept;
96
101 graphic::PoseF getPose(void) const noexcept;
102
108 HandEvent &setAim(const graphic::PoseF &aim) noexcept;
109
114 graphic::PoseF getAim(void) const noexcept;
115
121 HandEvent &setGrip(const graphic::PoseF &grip) noexcept;
122
127 graphic::PoseF getGrip(void) const noexcept;
128
134 HandEvent &setGripSurface(const graphic::PoseF &gripSurface) noexcept;
135
140 graphic::PoseF getGripSurface(void) const noexcept;
141 };
142
147 template<typename Type>
148 concept InheritFromHandEvent = std::is_base_of_v<HandEvent, Type>;
149
156 std::ostream &operator<<(std::ostream &stream,
157 const HandEvent::HandType handType);
158} // namespace utility::event
Base class for events in the event system.
Definition event.hpp:38
Abstract base class for hand events.
HandEvent & setHandType(const HandType handType) noexcept
Set the type of hand involved in the event.
graphic::PoseF getGripSurface(void) const noexcept
Get grip_surface pose.
HandEvent & setPose(const graphic::PoseF &pose) noexcept
Set the pose of the hand.
virtual ~HandEvent(void) override
Default destructor.
HandEvent & setGrip(const graphic::PoseF &grip) noexcept
Set grip pose.
graphic::PoseF getPose(void) const noexcept
Get the pose of the hand.
graphic::PoseF getAim(void) const noexcept
Get aim pose.
HandEvent & setGripSurface(const graphic::PoseF &gripSurface) noexcept
Set grip_surface pose.
HandType
Hand types for hand events. Defines the type of hand involved in the event (e.g., left or right).
HandEvent(void)
Default constructor.
HandEvent & setAim(const graphic::PoseF &aim) noexcept
Set aim pose.
HandType getHandType(void) const noexcept
Get the type of hand involved in the event.
graphic::PoseF getGrip(void) const noexcept
Get grip pose.
Concept to ensure a type inherits from HandEvent.