Set getters to const in ultraleap

This commit is contained in:
rodolpheh 2023-12-08 09:08:05 +00:00
parent e46bc2e49f
commit 8a9caca7d1
2 changed files with 21 additions and 26 deletions

View file

@ -495,7 +495,7 @@ void UltraleapHandTracking::serviceMessageLoop() {
is_running = false; is_running = false;
} }
UltraleapTypes::TrackingMode UltraleapHandTracking::get_tracking_mode() { UltraleapTypes::TrackingMode UltraleapHandTracking::get_tracking_mode() const {
if (primary_device == NULL) { if (primary_device == NULL) {
return UltraleapTypes::TrackingMode::Desktop; return UltraleapTypes::TrackingMode::Desktop;
} }
@ -556,11 +556,11 @@ void UltraleapHandTracking::set_policy(UltraleapTypes::PolicyFlag flag, bool val
LeapSetPolicyFlags(connectionHandle, set_flags, clear_flags); LeapSetPolicyFlags(connectionHandle, set_flags, clear_flags);
} }
bool UltraleapHandTracking::get_images_policy() { bool UltraleapHandTracking::get_images_policy() const {
return get_policy(UltraleapTypes::PolicyFlag::Images); return get_policy(UltraleapTypes::PolicyFlag::Images);
} }
bool UltraleapHandTracking::get_policy(UltraleapTypes::PolicyFlag flag) { bool UltraleapHandTracking::get_policy(UltraleapTypes::PolicyFlag flag) const {
return UltraleapTypes::read_policy_flag(policy_flags, flag); return UltraleapTypes::read_policy_flag(policy_flags, flag);
} }
@ -819,11 +819,11 @@ void UltraleapHandTracking::set_primary_device(Ref<UltraleapDevice> device) {
LeapSetPrimaryDevice(connectionHandle, device->device, false); LeapSetPrimaryDevice(connectionHandle, device->device, false);
} }
Ref<UltraleapDevice> UltraleapHandTracking::get_primary_device() { Ref<UltraleapDevice> UltraleapHandTracking::get_primary_device() const {
return primary_device; return primary_device;
} }
Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() { Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() const {
if (primary_device == NULL) { if (primary_device == NULL) {
return NULL; return NULL;
} }
@ -831,7 +831,7 @@ Ref<UltraleapFrame> UltraleapHandTracking::get_last_frame() {
return primary_device->get_last_frame(); return primary_device->get_last_frame();
} }
Ref<UltraleapImage> UltraleapHandTracking::get_left_image() { Ref<UltraleapImage> UltraleapHandTracking::get_left_image() const {
if (primary_device == NULL) { if (primary_device == NULL) {
return NULL; return NULL;
} }
@ -839,7 +839,7 @@ Ref<UltraleapImage> UltraleapHandTracking::get_left_image() {
return primary_device->get_left_image(); return primary_device->get_left_image();
} }
Ref<UltraleapImage> UltraleapHandTracking::get_right_image() { Ref<UltraleapImage> UltraleapHandTracking::get_right_image() const {
if (primary_device == NULL) { if (primary_device == NULL) {
return NULL; return NULL;
} }

View file

@ -35,11 +35,6 @@ public:
UltraleapTypes::TrackingMode default_tracking_mode = UltraleapTypes::TrackingMode::Desktop; UltraleapTypes::TrackingMode default_tracking_mode = UltraleapTypes::TrackingMode::Desktop;
bool interpolate = true;
bool get_interpolate();
void set_interpolate(bool value);
Ref<UltraleapDeviceList> devices; Ref<UltraleapDeviceList> devices;
String service_ip = String("127.0.0.1"); String service_ip = String("127.0.0.1");
@ -48,30 +43,30 @@ public:
bool autostart = true; bool autostart = true;
bool enable_images = true; bool enable_images = true;
UltraleapTypes::TrackingMode get_tracking_mode(); UltraleapTypes::TrackingMode get_tracking_mode() const;
void set_tracking_mode(UltraleapTypes::TrackingMode value); void set_tracking_mode(UltraleapTypes::TrackingMode value);
Ref<UltraleapFrame> get_last_frame(); Ref<UltraleapFrame> get_last_frame() const;
Ref<UltraleapImage> get_left_image(); Ref<UltraleapImage> get_left_image() const;
Ref<UltraleapImage> get_right_image(); Ref<UltraleapImage> get_right_image() const;
Array get_devices() { return devices->devices; } Array get_devices() const { return devices->devices; }
void set_devices(Array value) { devices->devices = value; } void set_devices(Array value) { devices->devices = value; }
String get_service_ip() { return service_ip; } String get_service_ip() const { return service_ip; }
void set_service_ip(String value) { service_ip = value; } void set_service_ip(String value) { service_ip = value; }
int get_service_port() { return service_port; } int get_service_port() const { return service_port; }
void set_service_port(int value) { service_port = value; } void set_service_port(int value) { service_port = value; }
bool get_autostart() { return autostart; } bool get_autostart() const { return autostart; }
void set_autostart(bool value) { autostart = value; } void set_autostart(bool value) { autostart = value; }
bool get_enable_images() { return enable_images; } bool get_enable_images() const { return enable_images; }
void set_enable_images(bool value) { enable_images = value; } void set_enable_images(bool value) { enable_images = value; }
bool is_connected() { return connected; } bool is_connected() const { return connected; }
bool is_started() { return started; } bool is_started() const { return started; }
// Policy setters // Policy setters
void set_images_policy(bool value); void set_images_policy(bool value);
@ -81,11 +76,11 @@ public:
// Policy getters // Policy getters
// Only reimplementing the things we know do something // Only reimplementing the things we know do something
bool get_images_policy(); bool get_images_policy() const;
// Set and get primary device // Set and get primary device
void set_primary_device(Ref<UltraleapDevice> device); void set_primary_device(Ref<UltraleapDevice> device);
Ref<UltraleapDevice> get_primary_device(); Ref<UltraleapDevice> get_primary_device() const;
void set_pause(bool value); void set_pause(bool value);
@ -122,7 +117,7 @@ private:
void handle_device_status_change_event(const LEAP_DEVICE_STATUS_CHANGE_EVENT* event, uint32_t device_id); void handle_device_status_change_event(const LEAP_DEVICE_STATUS_CHANGE_EVENT* event, uint32_t device_id);
void set_policy(UltraleapTypes::PolicyFlag flag, bool value); void set_policy(UltraleapTypes::PolicyFlag flag, bool value);
bool get_policy(UltraleapTypes::PolicyFlag flag); bool get_policy(UltraleapTypes::PolicyFlag flag) const;
String generate_connection_payload(); String generate_connection_payload();