The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

a/math: Add C++ RelationHistory interface class

+59
+59
src/xrt/auxiliary/math/m_relation_history.h
··· 76 76 #ifdef __cplusplus 77 77 } 78 78 #endif 79 + 80 + 81 + #ifdef __cplusplus 82 + namespace xrt::auxiliary::math { 83 + 84 + /*! 85 + * C++ interface for @ref m_relation_history, non-copyable/deletable. 86 + * 87 + * @ingroup aux_math 88 + */ 89 + class RelationHistory 90 + { 91 + public: 92 + /*! 93 + * @copydoc m_relation_history_result 94 + */ 95 + typedef m_relation_history_result Result; 96 + 97 + 98 + private: 99 + m_relation_history *mPtr{nullptr}; 100 + 101 + 102 + public: 103 + // clang-format off 104 + RelationHistory() noexcept { m_relation_history_create(&mPtr); } 105 + ~RelationHistory() { m_relation_history_destroy(&mPtr); } 106 + // clang-format on 107 + 108 + // Special non-copyable reference. 109 + RelationHistory(RelationHistory const &) = delete; 110 + RelationHistory(RelationHistory &&) = delete; 111 + RelationHistory & 112 + operator=(RelationHistory const &) = delete; 113 + RelationHistory & 114 + operator=(RelationHistory &&) = delete; 115 + 116 + 117 + /*! 118 + * @copydoc m_relation_history_push 119 + */ 120 + void 121 + push(xrt_space_relation const &relation, uint64_t ts) noexcept 122 + { 123 + m_relation_history_push(mPtr, &relation, ts); 124 + } 125 + 126 + /*! 127 + * @copydoc m_relation_history_get 128 + */ 129 + Result 130 + get(uint64_t at_time_ns, xrt_space_relation *out_relation) noexcept 131 + { 132 + return m_relation_history_get(mPtr, at_time_ns, out_relation); 133 + } 134 + }; 135 + 136 + } // namespace xrt::auxiliary::math 137 + #endif