OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ArrayBinaryConverter.h
Go to the documentation of this file.
1#pragma once
3{
4 class __declspec(dllexport) ArrayBinaryConverter
5 {
6 public:
7 template<typename T> static bsoncxx::types::b_binary convertArrayToBinary(T arr[], const size_t size) {
8 bsoncxx::types::b_binary bin_val{
9 bsoncxx::binary_sub_type::k_binary, static_cast<std::uint32_t>(size * sizeof(T)), reinterpret_cast<std::uint8_t*>(arr) };
10 return bin_val;
11 }
12 template<typename T> static T* convertBinaryToArray(bsoncxx::types::b_binary data) {
13 T* arrayRef = (T*)data.bytes;
14 return arrayRef;
15 }
16 };
17}
Definition ArrayBinaryConverter.h:3