Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

K2API: (6) Optional responses

公彦赤屋先 edited this page Aug 30, 2021 · 1 revision

Faster, or safer calls?

In K2PAI, you may request a function not to return anything.
Instead, it will shove an std::monostate up to you.

The code in K2API: https://github.com/KinectToVR/k2vr-application/blob/master/KinectToVR_API/KinectToVR_API.h#L1005
As you may see, it is conditional based on either if you want the reply or not.
Also, the server will not construct a reply if asked not to.

This may make the whole operation easier and faster.
By default, everything will return, until asked not to.

You can find a sample in KTVR:
This will return success? whereas this won't, and will be nearly 2 times faster. (still ~1ms or so)

// KinectSettings.cpp#L974 920dc87@experiments
ktvr::update_tracker_pose<false>(
	trackerVector.at(0).getTrackerBase
	(
		calibration_rotation,
		calibration_translation,
		calibration_origin,
		posOption, t_NoOrientationTrackingFilter
	));

Note that if something fails, you won't be noticed about it in any place other than the server's log file.