Incubator
CAVEInteractionStyles
vtkVRQueue.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3
// SPDX-License-Identifier: BSD-3-Clause
4
#ifndef vtkVRQueue_h
5
#define vtkVRQueue_h
6
7
#include "
vtkNew.h
"
8
#include "
vtkObject.h
"
9
#include "vtkPVIncubatorCAVEInteractionStylesModule.h"
// for export macro
10
11
#include <condition_variable>
12
#include <mutex>
13
#include <queue>
14
15
#define BUTTON_EVENT 1
16
#define VALUATOR_EVENT 2
17
#define TRACKER_EVENT 3
18
#define VTK_VALUATOR_CHANNEL_MAX 128
19
20
struct
vtkTracker
21
{
22
long
sensor
;
// Which sensor is reporting
23
double
matrix
[16];
// The matrix with transformations applied
24
};
25
26
struct
vtkValuator
27
{
28
int
num_channels
;
// how many channels
29
double
channel[
VTK_VALUATOR_CHANNEL_MAX
];
// channel diliever valuator values
30
};
31
32
struct
vtkButton
33
{
34
int
button
;
// Which button (zero-based)
35
int
state
;
// New state (0 = off, 1 = on)
36
};
37
38
union
vtkVREventCommonData
{
39
vtkTracker
tracker
;
40
vtkValuator
valuator
;
41
vtkButton
button
;
42
};
43
44
struct
vtkVREvent
45
{
46
std::string
connId
;
47
std::string
name
;
// Specified from configuration
48
unsigned
int
eventType
;
49
vtkVREventCommonData
data
;
50
unsigned
int
timeStamp
;
51
};
52
53
class
VTKPVINCUBATORCAVEINTERACTIONSTYLES_EXPORT
vtkVRQueue
:
public
vtkObject
54
{
55
public
:
56
static
vtkVRQueue
* New();
57
vtkTypeMacro(
vtkVRQueue
,
vtkObject
);
58
void
PrintSelf(ostream& os,
vtkIndent
indent)
override
;
59
60
void
Enqueue(
const
vtkVREvent
& event);
61
bool
IsEmpty()
const
;
62
bool
TryDequeue(
vtkVREvent
& event);
63
bool
TryDequeue(std::queue<vtkVREvent>& event);
64
void
Dequeue(
vtkVREvent
& event);
65
66
protected
:
67
vtkVRQueue
();
68
~
vtkVRQueue
();
69
70
private
:
71
vtkVRQueue
(
const
vtkVRQueue
&) =
delete
;
72
void
operator=(
const
vtkVRQueue
&) =
delete
;
73
74
std::queue<vtkVREvent> Queue;
75
mutable
std::mutex Mutex;
76
std::condition_variable_any CondVar;
77
};
78
#endif // vtkVRQueue_h
vtkButton::button
int button
Definition:
vtkVRQueue.h:34
vtkVREventCommonData
Definition:
vtkVRQueue.h:38
vtkObject
vtkVREvent::timeStamp
unsigned int timeStamp
Definition:
vtkVRQueue.h:50
vtkVREvent::name
std::string name
Definition:
vtkVRQueue.h:47
vtkValuator
Definition:
vtkVRQueue.h:26
vtkTracker::matrix
double matrix[16]
Definition:
vtkVRQueue.h:23
vtkButton
Definition:
vtkVRQueue.h:32
vtkVREventCommonData::button
vtkButton button
Definition:
vtkVRQueue.h:41
vtkIndent
vtkTracker::sensor
long sensor
Definition:
vtkVRQueue.h:22
vtkVREventCommonData::valuator
vtkValuator valuator
Definition:
vtkVRQueue.h:40
vtkVREvent
Definition:
vtkVRQueue.h:44
vtkVREvent::connId
std::string connId
Definition:
vtkVRQueue.h:46
vtkVREvent::data
vtkVREventCommonData data
Definition:
vtkVRQueue.h:49
vtkTracker
Definition:
vtkVRQueue.h:20
vtkValuator::num_channels
int num_channels
Definition:
vtkVRQueue.h:28
vtkNew.h
vtkVREventCommonData::tracker
vtkTracker tracker
Definition:
vtkVRQueue.h:39
vtkButton::state
int state
Definition:
vtkVRQueue.h:35
vtkVRQueue
Definition:
vtkVRQueue.h:53
vtkObject.h
vtkVREvent::eventType
unsigned int eventType
Definition:
vtkVRQueue.h:48
VTK_VALUATOR_CHANNEL_MAX
#define VTK_VALUATOR_CHANNEL_MAX
Definition:
vtkVRQueue.h:18
Generated by
1.8.13 on Tue Jan 21 2025