diff --git a/source/mock/ur_mock_helpers.hpp b/source/mock/ur_mock_helpers.hpp index 034d47c02d..b2cb9ca203 100644 --- a/source/mock/ur_mock_helpers.hpp +++ b/source/mock/ur_mock_helpers.hpp @@ -15,6 +15,7 @@ #include "ur_api.h" #include +#include #include #include #include @@ -36,6 +37,16 @@ struct dummy_handle_t_ { std::vector MStorage; unsigned char *MData = nullptr; size_t MSize; + + template T getDataAs() { + assert(MStorage.size() >= sizeof(T)); + return *reinterpret_cast(MStorage.data()); + } + + template T setDataAs(T Val) { + assert(MStorage.size() >= sizeof(T)); + return *reinterpret_cast(MStorage.data()) = Val; + } }; using dummy_handle_t = dummy_handle_t_ *;