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
{
40
vtkTracker
tracker
;
41
vtkValuator
valuator
;
42
vtkButton
button
;
43
};
44
45
struct
vtkVREvent
46
{
47
std::string
connId
;
48
std::string
name
;
// Specified from configuration
49
unsigned
int
eventType
;
50
vtkVREventCommonData
data
;
51
unsigned
int
timeStamp
;
52
};
53
54
class
VTKPVINCUBATORCAVEINTERACTIONSTYLES_EXPORT
vtkVRQueue
:
public
vtkObject
55
{
56
public
:
57
static
vtkVRQueue
* New();
58
vtkTypeMacro(
vtkVRQueue
,
vtkObject
);
59
void
PrintSelf(ostream& os,
vtkIndent
indent)
override
;
60
61
void
Enqueue(
const
vtkVREvent
& event);
62
bool
IsEmpty()
const
;
63
bool
TryDequeue(
vtkVREvent
& event);
64
bool
TryDequeue(std::queue<vtkVREvent>& event);
65
void
Dequeue(
vtkVREvent
& event);
66
67
protected
:
68
vtkVRQueue
();
69
~
vtkVRQueue
();
70
71
private
:
72
vtkVRQueue
(
const
vtkVRQueue
&) =
delete
;
73
void
operator=(
const
vtkVRQueue
&) =
delete
;
74
75
std::queue<vtkVREvent> Queue;
76
mutable
std::mutex Mutex;
77
std::condition_variable_any CondVar;
78
};
79
#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:51
vtkVREvent::name
std::string name
Definition:
vtkVRQueue.h:48
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:42
vtkIndent
vtkTracker::sensor
long sensor
Definition:
vtkVRQueue.h:22
vtkVREventCommonData::valuator
vtkValuator valuator
Definition:
vtkVRQueue.h:41
vtkVREvent
Definition:
vtkVRQueue.h:45
vtkVREvent::connId
std::string connId
Definition:
vtkVRQueue.h:47
vtkVREvent::data
vtkVREventCommonData data
Definition:
vtkVRQueue.h:50
vtkTracker
Definition:
vtkVRQueue.h:20
vtkValuator::num_channels
int num_channels
Definition:
vtkVRQueue.h:28
vtkNew.h
vtkVREventCommonData::tracker
vtkTracker tracker
Definition:
vtkVRQueue.h:40
vtkButton::state
int state
Definition:
vtkVRQueue.h:35
vtkVRQueue
Definition:
vtkVRQueue.h:54
vtkObject.h
vtkVREvent::eventType
unsigned int eventType
Definition:
vtkVRQueue.h:49
VTK_VALUATOR_CHANNEL_MAX
#define VTK_VALUATOR_CHANNEL_MAX
Definition:
vtkVRQueue.h:18
Generated by
1.8.13 on Fri Aug 1 2025