#ifndef UHDK_EXAMPLE_PAYLOAD_HPP #define UHDK_EXAMPLE_PAYLOAD_HPP #include "uhdk.h" #include // Call only after checking the event/request discriminator. References are borrowed. template const T &UhdkData(const uhdk_event &event) { assert(event.data && event.data_size >= sizeof(T)); return *static_cast(event.data); } template const T &UhdkResult(const uhdk_request_result &result) { assert(result.status == UHDK_STATUS_OK && result.data && result.data_size >= sizeof(T)); return *static_cast(result.data); } #endif