Debian Codegraph @

3rdparty/osgXR/src/Subaction.h

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #ifndef OSGXR_SUBACTION
5 #define OSGXR_SUBACTION 1
6
7 #include <osgXR/Subaction>
8
9 #include "OpenXR/Path.h"
10
11 #include <set>
12 #include <string>
13
14 namespace osgXR {
15
16 class XRState;
17
18 namespace OpenXR {
19 class Instance;
20 };
21
22 class Subaction::Private
23 {
24 public:
25
26 static std::shared_ptr<Private> get(Subaction *pub)
27 {
28 if (pub)
29 return pub->_private;
30 else
31 return nullptr;
32 }
33
34 Private(XRState *state, const std::string &path);
35
36 // Public object registration
37 void registerPublic(Subaction *subaction);
38 void unregisterPublic(Subaction *subaction);
39
40 // Accessors
41
42 /// Get the subaction's path as a string.
43 const std::string &getPathString() const
44 {
45 return _pathString;
46 }
47
48 /// Find the current interaction profile.
49 InteractionProfile *getCurrentProfile();
50
51 // Events
52
53 /// Notify that an interaction profile has changed.
54 void onInteractionProfileChanged(OpenXR::Session *session);
55
56 /// Setup path with an OpenXR instance.
57 const OpenXR::Path &setup(OpenXR::Instance *instance);
58 /// Clean up current profile before an OpenXR session is destroyed.
59 void cleanupSession();
60 /// Clean up path before an OpenXR instance is destroyed.
61 void cleanupInstance();
62
63 private:
64
65 XRState *_state;
66 std::string _pathString;
67 std::set<Subaction *> _publics;
68
69 OpenXR::Path _path;
70 osg::ref_ptr<InteractionProfile> _currentProfile;
71 };
72
73 } // osgXR
74
75 #endif