Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

update k4a c++ functions to support function chaining #1514

Open
diablodale opened this issue Feb 27, 2021 · 0 comments · May be fixed by #1536
Open

update k4a c++ functions to support function chaining #1514

diablodale opened this issue Feb 27, 2021 · 0 comments · May be fixed by #1536
Assignees
Labels
Enhancement New feature or request

Comments

@diablodale
Copy link

I request all possible k4a C++ functions be updated to support function chaining.
In general this means all possible functions do not return void. Instead, they return references to their own class.

For example

void set_timestamp(std::chrono::microseconds timestamp);  // old
k4a::image& set_timestamp(std::chrono::microseconds timestamp);  // new

void set_depth_image(const image &depth_image);  // old
k4a::capture& set_depth_image(const image &depth_image);  // new

// this enables function chaining...
k4a::capture capture;
k4a::image image;
image.set_timestamp(1234).set_exposure_time(7500);
capture.set_depth_image(image).set_color_image(image).set_temperature_c(30.2);

The sdk code changes are trivial. For example...

// existing SDK 1.4.1 code
void set_temperature_c(float temperature_c) noexcept
{
    k4a_capture_set_temperature_c(m_handle, temperature_c);
}

// new code
k4a::image& set_temperature_c(float temperature_c) noexcept
{
    k4a_capture_set_temperature_c(m_handle, temperature_c);
    return *this;
}
@diablodale diablodale added Enhancement New feature or request Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. labels Feb 27, 2021
@qm13 qm13 self-assigned this Mar 1, 2021
@qm13 qm13 removed the Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. label Mar 1, 2021
@HlibKazakov2000 HlibKazakov2000 self-assigned this Mar 18, 2021
@HlibKazakov2000 HlibKazakov2000 linked a pull request Mar 19, 2021 that will close this issue
7 tasks
@qm13 qm13 assigned dasparli and unassigned qm13 and HlibKazakov2000 Apr 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants