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.cpp
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#include "utility/event/hand_event.hpp"
24
25namespace utility::event
26{
27
28 HandEvent::HandEvent(void) = default;
29
30 HandEvent::~HandEvent(void) = default;
31
32 HandEvent &HandEvent::setHandType(const HandType handType) noexcept
33 {
34 _handType = handType;
35 return *this;
36 }
37
39 {
40 return _handType;
41 }
42
44 {
45 _pose = pose;
46 return *this;
47 }
48
50 {
51 return _pose;
52 }
53
55 {
56 _aim = aim;
57 return *this;
58 }
59
60 graphic::PoseF HandEvent::getAim(void) const noexcept
61 {
62 return _aim;
63 }
64
66 {
67 _grip = grip;
68 return *this;
69 }
70
72 {
73 return _grip;
74 }
75
76 HandEvent &
77 HandEvent::setGripSurface(const graphic::PoseF &gripSurface) noexcept
78 {
79 _gripSurface = gripSurface;
80 return *this;
81 }
82
84 {
85 return _gripSurface;
86 }
87
88 std::ostream &operator<<(std::ostream &stream,
89 const HandEvent::HandType handType)
90 {
91 switch (handType) {
93 stream << "Left";
94 break;
96 stream << "Right";
97 break;
98 default:
99 stream << "Unknown";
100 break;
101 }
102 return stream;
103 }
104} // namespace utility::event
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.