ApolloInput Nova 0.2.0
Standalone virtual gamepad library
Loading...
Searching...
No Matches
apollo::input::Backend Class Referenceabstract

Factory for virtual input devices. More...

#include <backend.hpp>

Public Member Functions

virtual ~Backend ()=default
virtual const char * name () const =0
 Stable backend name.
virtual bool available (std::string *error=nullptr) const =0
 Check whether the backend can work on this machine.
virtual std::unique_ptr< Device > create (Profile profile, const std::string &name, std::string *error=nullptr)=0
 Create a virtual device.
std::unique_ptr< Device > create_compatible (Profile profile, const std::string &name, std::string *error=nullptr)
 Create a device, falling back to a simpler compatible profile.
virtual std::vector< Profile > supported_profiles () const =0
 Profiles supported by this backend.

Detailed Description

Factory for virtual input devices.

Definition at line 136 of file backend.hpp.

Constructor & Destructor Documentation

◆ ~Backend()

virtual apollo::input::Backend::~Backend ( )
virtualdefault

Member Function Documentation

◆ available()

virtual bool apollo::input::Backend::available ( std::string * error = nullptr) const
pure virtual

Check whether the backend can work on this machine.

Parameters
errorOptional human-readable reason when unavailable.
Returns
True when a device can be created.

◆ create()

virtual std::unique_ptr< Device > apollo::input::Backend::create ( Profile profile,
const std::string & name,
std::string * error = nullptr )
pure virtual

Create a virtual device.

Parameters
profileRequested controller profile.
nameName shown by the operating system.
errorOptional human-readable reason when creation fails.
Returns
Device, or null when the profile or backend is unavailable.

◆ create_compatible()

std::unique_ptr< Device > apollo::input::Backend::create_compatible ( Profile profile,
const std::string & name,
std::string * error = nullptr )

Create a device, falling back to a simpler compatible profile.

The requested profile is tried first. When the backend cannot create it, progressively simpler profiles from profile_compatibility_chain() are tried. The created device reports the profile it actually emulates in DeviceInfo::profile.

Parameters
profilePreferred controller profile.
nameName shown by the operating system.
errorOptional human-readable reason when every profile fails.
Returns
Device, or null when no compatible profile is available.

Definition at line 80 of file backend.cpp.

◆ name()

virtual const char * apollo::input::Backend::name ( ) const
pure virtual

Stable backend name.

Returns
Static string such as "vigem".

◆ supported_profiles()

virtual std::vector< Profile > apollo::input::Backend::supported_profiles ( ) const
pure virtual

Profiles supported by this backend.

Returns
Supported profile list.

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