Debian Codegraph @

3rdparty/osgXR/src/Action.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
5 #define OSGXR_ACTION 1
6
7 #include <osgXR/Action>
8
9 #include "Subaction.h"
10
11 #include <osg/ref_ptr>
12
13 #include <memory>
14 #include <set>
15 #include <string>
16
17 namespace osgXR {
18
19 namespace OpenXR {
20 class Action;
21 class Instance;
22 };
23
24 class Action::Private
25 {
26 public:
27
28 static Private *get(Action *pub)
29 {
30 return pub->_private.get();
31 }
32
33 Private(ActionSet *actionSet);
34 virtual ~Private();
35
36 void setName(const std::string &name);
37 const std::string &getName() const;
38
39 void setLocalizedName(const std::string &localizedName);
40 const std::string &getLocalizedName() const;
41
42 void addSubaction(std::shared_ptr<Subaction::Private> subaction);
43
44 bool getUpdated() const
45 {
46 return _updated;
47 }
48
49 /// Setup action with an OpenXR instance
50 virtual OpenXR::Action *setup(OpenXR::Instance *instance) = 0;
51 /// Clean up action before an OpenXR session is destroyed
52 virtual void cleanupSession() = 0;
53 /// Clean up action before an OpenXR instance is destroyed
54 void cleanupInstance();
55
56 /**
57 * Get a list of currently bound source paths for this action.
58 * @param sourcePaths[out] Vector of source paths to write into.
59 */
60 void getBoundSources(std::vector<std::string> &sourcePaths) const;
61
62 /**
63 * Get a list of currently bound source localized names for this action.
64 * @param whichComponents Which components to include.
65 * @param names[out] Vector of names to write into.
66 */
67 void getBoundSourcesLocalizedNames(XrInputSourceLocalizedNameFlags whichComponents,
68 std::vector<std::string> &names) const;
69
70 protected:
71
72 std::string _name;
73 std::string _localizedName;
74
75 osg::ref_ptr<ActionSet> _actionSet;
76 std::set<std::shared_ptr<Subaction::Private>> _subactions;
77
78 bool _updated;
79 osg::ref_ptr<OpenXR::Action> _action;
80 };
81
82 } // osgXR
83
84 #endif