Debian Codegraph @

3rdparty/osgXR/src/ActionSet.h

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #ifndef OSGXR_ACTION_SET
5 #define OSGXR_ACTION_SET 1
6
7 #include <osgXR/ActionSet>
8 #include <osgXR/Action>
9
10 #include "OpenXR/Path.h"
11
12 #include "Subaction.h"
13
14 #include <osg/observer_ptr>
15 #include <osg/ref_ptr>
16
17 #include <memory>
18 #include <string>
19 #include <set>
20
21 namespace osgXR {
22
23 class Action;
24 class XRState;
25
26 namespace OpenXR {
27 class ActionSet;
28 class Instance;
29 class Session;
30 };
31
32 class ActionSet::Private
33 {
34 public:
35
36 static Private *get(ActionSet *pub)
37 {
38 return pub->_private.get();
39 }
40
41 Private(XRState *state);
42 ~Private();
43
44 void setName(const std::string &name);
45 const std::string &getName() const;
46
47 void setLocalizedName(const std::string &localizedName);
48 const std::string &getLocalizedName() const;
49
50 void setPriority(uint32_t priority);
51 uint32_t getPriority() const;
52
53 bool getUpdated() const;
54
55 void activate(std::shared_ptr<Subaction::Private> subaction = nullptr);
56 void deactivate(std::shared_ptr<Subaction::Private> subaction = nullptr);
57 bool isActive();
58
59 void registerAction(Action::Private *action);
60 void unregisterAction(Action::Private *action);
61
62 /// Setup action set with an OpenXR instance
63 OpenXR::ActionSet *setup(OpenXR::Instance *instance);
64 /// Setup action set with an OpenXR session
65 bool setup(OpenXR::Session *session);
66 /// Clean up action before an OpenXR session is destroyed
67 void cleanupSession();
68 /// Clean up action before an OpenXR instance is destroyed
69 void cleanupInstance();
70
71 OpenXR::Session *getSession()
72 {
73 return _session.get();
74 }
75
76 protected:
77
78 osg::observer_ptr<XRState> _state;
79 std::string _name;
80 std::string _localizedName;
81 uint32_t _priority;
82 std::set<std::shared_ptr<Subaction::Private>> _activeSubactions;
83
84 std::set<Action::Private *> _actions;
85
86 bool _updated;
87 osg::ref_ptr<OpenXR::ActionSet> _actionSet;
88 osg::observer_ptr<OpenXR::Session> _session;
89 };
90
91 } // osgXR
92
93 #endif