rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
rexlib::device_index Class Reference

Location of a device as a (backend, id) tuple. More...

#include <rexlib/core/hardware/device_index.hpp>

Public Member Functions

 device_index (const std::string &backend_name, std::size_t device_id)
 Construct a new device index from its components.
 
 device_index (std::string &&backend_name, std::size_t device_id)
 Construct a new device index from its components.
 
 device_index (const device_index &other)
 
 device_index (device_index &&other) noexcept
 
device_index & operator= (const device_index &other)
 
device_index & operator= (device_index &&other) noexcept
 
const std::string & get_backend_name () const noexcept
 Get the name of the device backend.
 
std::size_t get_device_id () const noexcept
 Get the ID of the device within the backend.
 

Friends

bool operator== (const device_index &lhs, const device_index &rhs) noexcept
 
bool operator!= (const device_index &lhs, const device_index &rhs) noexcept
 
bool operator< (const device_index &lhs, const device_index &rhs) noexcept
 
bool operator<= (const device_index &lhs, const device_index &rhs) noexcept
 
bool operator> (const device_index &lhs, const device_index &rhs) noexcept
 
bool operator>= (const device_index &lhs, const device_index &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const device_index &index)
 

Detailed Description

Location of a device as a (backend, id) tuple.

A device_index is a unique identifier within a device_manager of a physical device.

Default-constructed indices hold an empty backend name and a zero device id; such an index does not refer to any real device and is intended only as a placeholder before assignment or parsing.

Constructor & Destructor Documentation

◆ device_index() [1/2]

rexlib::device_index::device_index ( const std::string &  backend_name,
std::size_t  device_id 
)

Construct a new device index from its components.

Parameters
backend_nameName of the backend. Must match the name reported by the target device_backend for the index to refer to a real device.
device_idID of the device within backend_name, as returned by device_backend::enumerate_devices.

◆ device_index() [2/2]

rexlib::device_index::device_index ( std::string &&  backend_name,
std::size_t  device_id 
)

Construct a new device index from its components.

Move overload that avoids copying backend_name.

Parameters
backend_nameName of the backend (moved from).
device_idID of the device within backend_name, as returned by device_backend::enumerate_devices.

Member Function Documentation

◆ get_backend_name()

const std::string & rexlib::device_index::get_backend_name ( ) const
noexcept

Get the name of the device backend.

Returns
const std::string& Reference to the stored backend name. The reference is valid for the lifetime of this device_index and is invalidated by assignment to or destruction of the object.

◆ get_device_id()

std::size_t rexlib::device_index::get_device_id ( ) const
noexcept

Get the ID of the device within the backend.

Returns
std::size_t The backend-local device ID. The value is only meaningful when interpreted by the backend identified by get_backend_name.

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