evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::AXrAction Class Referenceabstract

Represents an OpenXR action and its associated properties. More...

#include <headers/evan/openxr/actions/AXrAction.hpp>

Inheritance diagram for evan::AXrAction:
Collaboration diagram for evan::AXrAction:

Classes

struct  PropertiesXrActions
 Encapsulates properties required for creating an OpenXR action. More...
 

Public Member Functions

virtual ~AXrAction ()
 Destructor for AXrAction, responsible for cleaning up OpenXR resources.
 
virtual std::vector< std::shared_ptr< utility::event::Event > > getEvent (XrDeviceBackend &deviceBackend, std::shared_ptr< utility::event::HandMotionEvent > handMotionEvent)=0
 Polls the OpenXR runtime and produces events for this action.
 
XrAction getAction () const
 Retrieves the XrAction handle associated with this AXrAction.
 
const std::string & getActionName () const
 Retrieves the name of the action.
 
const std::string & getBindingPath () const
 Retrieves the binding path of the action.
 
void createAction (const PropertiesXrActions &properties)
 Creates an OpenXR action based on the provided properties.
 

Detailed Description

Represents an OpenXR action and its associated properties.

This class encapsulates the creation and management of an OpenXR action, including its name, binding path, and the underlying XrAction handle. It provides methods to retrieve the action's properties and to create the action based on specified properties. The class also ensures proper cleanup of the OpenXR resources when the object is destroyed.

Definition at line 36 of file AXrAction.hpp.

Constructor & Destructor Documentation

◆ ~AXrAction()

virtual evan::AXrAction::~AXrAction ( )
inlinevirtual

Destructor for AXrAction, responsible for cleaning up OpenXR resources.

This destructor ensures that the XrAction handle is properly destroyed when the AXrAction object goes out of scope. It also checks if the associated action space is valid and destroys it if necessary, ensuring that all OpenXR resources are released correctly to prevent memory leaks and other issues.

Definition at line 85 of file AXrAction.hpp.

Member Function Documentation

◆ createAction()

void evan::AXrAction::createAction ( const PropertiesXrActions &  properties)

Creates an OpenXR action based on the provided properties.

This method takes a PropertiesXrActions structure containing all necessary parameters for creating an OpenXR action, such as the action's name, binding path, associated action set, and type. It uses this information to create the action using the OpenXR API and stores the resulting XrAction handle for later use. If the action creation fails, it throws a runtime error with details about the failure.

Parameters
propertiesA structure containing all necessary parameters for creating an OpenXR action.
Exceptions
std::runtime_errorIf action creation fails, providing details about the failure.

Definition at line 29 of file AXrAction.cpp.

◆ getAction()

XrAction evan::AXrAction::getAction ( ) const

Retrieves the XrAction handle associated with this AXrAction.

This method returns the XrAction handle that represents the OpenXR action managed by this class. The handle can be used in OpenXR API calls to interact with the action, such as binding it to input devices or querying its state.

Returns
XrAction The handle of the OpenXR action.

Definition at line 14 of file AXrAction.cpp.

◆ getActionName()

const std::string & evan::AXrAction::getActionName ( ) const

Retrieves the name of the action.

This method returns the name of the action, which is used for identification and debugging purposes. The name should be unique within the action set to avoid conflicts with other actions.

Returns
const std::string& The name of the action.

Definition at line 19 of file AXrAction.cpp.

◆ getBindingPath()

const std::string & evan::AXrAction::getBindingPath ( ) const

Retrieves the binding path of the action.

This method returns the binding path for the action, which specifies how the action is bound to input devices. The binding path should follow OpenXR's binding syntax and conventions to ensure proper functionality when interacting with input devices.

Returns
const std::string& The binding path of the action.

Definition at line 24 of file AXrAction.cpp.

◆ getEvent()

virtual std::vector< std::shared_ptr< utility::event::Event > > evan::AXrAction::getEvent ( XrDeviceBackend &  deviceBackend,
std::shared_ptr< utility::event::HandMotionEvent >  handMotionEvent 
)
pure virtual

Polls the OpenXR runtime and produces events for this action.

Query the OpenXR runtime for the current state of this action and translate any relevant state changes into a list of runtime events. Implementations should create and return a vector of unique pointers to utility::event::Event that represent meaningful input occurrences (e.g. button pressed/released, axis movement, pose updates) detected since the last poll.

Parameters
deviceBackendReference to the XrDeviceBackend used to communicate with the OpenXR session and query action state.
handMotionEventOptional shared pointer to a HandMotionEvent that may be used to provide context for hand-related actions. This parameter can be nullptr if the action is not related to hand motion.
Returns
std::vector<std::shared_ptr<utility::event::Event>> A vector of allocated events describing input changes; may be empty if no changes were detected.

Implemented in evan::XrHandThumbStickAction, and evan::XrButtonAction.


The documentation for this class was generated from the following files: