54 explicit Device(
const std::string& device_type,
int device_id)
55 :
Device(device_type +
":" +
std::to_string(device_id)) {}
58 explicit Device(
const std::string& type_colon_id)
104 std::vector<std::string> tokens =
106 if (tokens.size() == 2) {
108 if (device_name_lower ==
"cpu") {
110 }
else if (device_name_lower ==
"cuda") {
121 std::vector<std::string> tokens =
123 if (tokens.size() == 2) {
124 return std::stoi(tokens[1]);
142 return std::hash<std::string>{}(device.
ToString());
std::size_t operator()(const open3d::core::Device &device) const
Definition: Device.h:141
bool operator!=(const Device &other) const
Definition: Device.h:69
std::vector< std::string > SplitString(const std::string &str, const std::string &delimiters, bool trim_empty_str)
Definition: Helper.cpp:45
DeviceType GetType() const
Definition: Device.h:91
bool operator==(const Device &other) const
Definition: Device.h:64
int device_id_
Definition: Device.h:132
Device(const std::string &type_colon_id)
Constructor from string, e.g. "CUDA:0".
Definition: Device.h:58
DeviceType device_type_
Definition: Device.h:131
static int StringToDeviceId(const std::string &type_colon_id)
Definition: Device.h:120
DeviceType
Type for device.
Definition: Device.h:42
void AssertCPUDeviceIDIsZero()
Definition: Device.h:96
bool operator<(const Device &other) const
Definition: Device.h:71
Device()=default
Default constructor.
static DeviceType StringToDeviceType(const std::string &type_colon_id)
Definition: Device.h:103
Definition: PinholeCameraIntrinsic.cpp:35
Device(DeviceType device_type, int device_id)
Constructor with device specified.
Definition: Device.h:48
const char const char value recording_handle imu_sample recording_handle uint8_t size_t data_size k4a_record_configuration_t config target_format k4a_capture_t capture_handle k4a_imu_sample_t imu_sample playback_handle k4a_logging_message_cb_t void min_level device_handle k4a_imu_sample_t timeout_in_ms capture_handle capture_handle capture_handle image_handle temperature_c k4a_image_t image_handle uint8_t image_handle image_handle image_handle image_handle image_handle timestamp_usec white_balance image_handle k4a_device_configuration_t config device_handle char size_t serial_number_size bool int32_t int32_t int32_t int32_t k4a_color_control_mode_t default_mode value const const k4a_calibration_t calibration char size_t
Definition: K4aPlugin.cpp:724
std::string ToString() const
Definition: Device.h:75
Device(const std::string &device_type, int device_id)
Constructor from device type string and device id.
Definition: Device.h:54
#define LogError(...)
Definition: Logging.h:72
int GetID() const
Definition: Device.h:93
std::string ToLower(const std::string &str)
Convert string to the lower case.
Definition: Helper.cpp:102