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