Files
kinect/core/contract/contract_layout_dump.cpp
kinect-bot e6d4e510d3
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python tracker (pytest) (push) Canceled after 0s
feat(contract,spikes): frozen IPC data contract + Linux/Windows spikes (wave 2)
2026-11-25 03:54:41 -05:00

101 lines
6.1 KiB
C++

#include <cstdio>
#include "contract/contract.h"
// Prints every golden sizeof/offsetof pair from contract.h as KEY=VALUE lines.
// tests/test_contract_py.py runs this binary and diffs its output against the
// ctypes mirror in tracker/contract.py, so the Python side is checked against
// whatever the C header ACTUALLY compiles to today, never a hardcoded copy
// that could silently drift from the real layout.
using namespace nui::contract;
int main() {
std::printf("CONTRACT_VERSION=%u\n", kContractVersion);
std::printf("JOINT_COUNT=%zu\n", kJointCount);
std::printf("FRAME_SLOT_COUNT=%zu\n", kFrameSlotCount);
std::printf("sizeof(Vector4)=%zu\n", sizeof(Vector4));
std::printf("offsetof(Vector4,x)=%zu\n", offsetof(Vector4, x));
std::printf("offsetof(Vector4,y)=%zu\n", offsetof(Vector4, y));
std::printf("offsetof(Vector4,z)=%zu\n", offsetof(Vector4, z));
std::printf("offsetof(Vector4,w)=%zu\n", offsetof(Vector4, w));
std::printf("sizeof(JointData)=%zu\n", sizeof(JointData));
std::printf("offsetof(JointData,position)=%zu\n", offsetof(JointData, position));
std::printf("offsetof(JointData,tracking_state)=%zu\n", offsetof(JointData, tracking_state));
std::printf("sizeof(SkeletonFrame)=%zu\n", sizeof(SkeletonFrame));
std::printf("offsetof(SkeletonFrame,joints)=%zu\n", offsetof(SkeletonFrame, joints));
std::printf("offsetof(SkeletonFrame,skeleton_tracking_id)=%zu\n",
offsetof(SkeletonFrame, skeleton_tracking_id));
std::printf("offsetof(SkeletonFrame,quality_flags)=%zu\n", offsetof(SkeletonFrame, quality_flags));
std::printf("sizeof(DepthBufferDescriptor)=%zu\n", sizeof(DepthBufferDescriptor));
std::printf("offsetof(DepthBufferDescriptor,width)=%zu\n", offsetof(DepthBufferDescriptor, width));
std::printf("offsetof(DepthBufferDescriptor,height)=%zu\n", offsetof(DepthBufferDescriptor, height));
std::printf("offsetof(DepthBufferDescriptor,pitch)=%zu\n", offsetof(DepthBufferDescriptor, pitch));
std::printf("offsetof(DepthBufferDescriptor,byte_offset)=%zu\n",
offsetof(DepthBufferDescriptor, byte_offset));
std::printf("sizeof(ColorBufferDescriptor)=%zu\n", sizeof(ColorBufferDescriptor));
std::printf("offsetof(ColorBufferDescriptor,width)=%zu\n", offsetof(ColorBufferDescriptor, width));
std::printf("offsetof(ColorBufferDescriptor,height)=%zu\n", offsetof(ColorBufferDescriptor, height));
std::printf("offsetof(ColorBufferDescriptor,pitch)=%zu\n", offsetof(ColorBufferDescriptor, pitch));
std::printf("offsetof(ColorBufferDescriptor,byte_offset)=%zu\n",
offsetof(ColorBufferDescriptor, byte_offset));
std::printf("sizeof(FrameData)=%zu\n", sizeof(FrameData));
std::printf("offsetof(FrameData,frame_number)=%zu\n", offsetof(FrameData, frame_number));
std::printf("offsetof(FrameData,timestamp_micros)=%zu\n", offsetof(FrameData, timestamp_micros));
std::printf("offsetof(FrameData,skeleton)=%zu\n", offsetof(FrameData, skeleton));
std::printf("offsetof(FrameData,depth)=%zu\n", offsetof(FrameData, depth));
std::printf("offsetof(FrameData,color)=%zu\n", offsetof(FrameData, color));
std::printf("sizeof(FrameSlot)=%zu\n", sizeof(FrameSlot));
std::printf("offsetof(FrameSlot,sequence)=%zu\n", offsetof(FrameSlot, sequence));
std::printf("offsetof(FrameSlot,data)=%zu\n", offsetof(FrameSlot, data));
std::printf("sizeof(FrameContract)=%zu\n", sizeof(FrameContract));
std::printf("offsetof(FrameContract,contract_version)=%zu\n", offsetof(FrameContract, contract_version));
std::printf("offsetof(FrameContract,reserved)=%zu\n", offsetof(FrameContract, reserved));
std::printf("offsetof(FrameContract,published_sequence)=%zu\n",
offsetof(FrameContract, published_sequence));
std::printf("offsetof(FrameContract,slots)=%zu\n", offsetof(FrameContract, slots));
std::printf("sizeof(ControlMessageHeader)=%zu\n", sizeof(ControlMessageHeader));
std::printf("offsetof(ControlMessageHeader,message_type)=%zu\n",
offsetof(ControlMessageHeader, message_type));
std::printf("offsetof(ControlMessageHeader,contract_version)=%zu\n",
offsetof(ControlMessageHeader, contract_version));
std::printf("offsetof(ControlMessageHeader,payload_size)=%zu\n",
offsetof(ControlMessageHeader, payload_size));
std::printf("offsetof(ControlMessageHeader,reserved)=%zu\n", offsetof(ControlMessageHeader, reserved));
std::printf("sizeof(HandshakeMessage)=%zu\n", sizeof(HandshakeMessage));
std::printf("offsetof(HandshakeMessage,header)=%zu\n", offsetof(HandshakeMessage, header));
std::printf("offsetof(HandshakeMessage,client_version)=%zu\n",
offsetof(HandshakeMessage, client_version));
std::printf("offsetof(HandshakeMessage,capabilities)=%zu\n", offsetof(HandshakeMessage, capabilities));
std::printf("sizeof(ConfigMessage)=%zu\n", sizeof(ConfigMessage));
std::printf("offsetof(ConfigMessage,header)=%zu\n", offsetof(ConfigMessage, header));
std::printf("offsetof(ConfigMessage,depth_width)=%zu\n", offsetof(ConfigMessage, depth_width));
std::printf("offsetof(ConfigMessage,depth_height)=%zu\n", offsetof(ConfigMessage, depth_height));
std::printf("offsetof(ConfigMessage,color_width)=%zu\n", offsetof(ConfigMessage, color_width));
std::printf("offsetof(ConfigMessage,color_height)=%zu\n", offsetof(ConfigMessage, color_height));
std::printf("sizeof(CalibrationMessage)=%zu\n", sizeof(CalibrationMessage));
std::printf("offsetof(CalibrationMessage,header)=%zu\n", offsetof(CalibrationMessage, header));
std::printf("offsetof(CalibrationMessage,z0_meters)=%zu\n", offsetof(CalibrationMessage, z0_meters));
std::printf("offsetof(CalibrationMessage,mirror)=%zu\n", offsetof(CalibrationMessage, mirror));
std::printf("offsetof(CalibrationMessage,floor_plane)=%zu\n", offsetof(CalibrationMessage, floor_plane));
std::printf("sizeof(HeartbeatMessage)=%zu\n", sizeof(HeartbeatMessage));
std::printf("offsetof(HeartbeatMessage,header)=%zu\n", offsetof(HeartbeatMessage, header));
std::printf("offsetof(HeartbeatMessage,timestamp_micros)=%zu\n",
offsetof(HeartbeatMessage, timestamp_micros));
std::printf("offsetof(HeartbeatMessage,sequence)=%zu\n", offsetof(HeartbeatMessage, sequence));
return 0;
}