| 30 | namespace oid::host { |
| 31 | |
| 32 | BufferRecord make_buffer_record(std::string variable_name, |
| 33 | std::string display_name, |
| 34 | std::string pixel_layout, |
| 35 | bool transpose, |
| 36 | int width, |
| 37 | int height, |
| 38 | int channels, |
| 39 | int stride, |
| 40 | oid::BufferType type, |
| 41 | std::vector<std::byte> bytes) { |
| 42 | BufferRecord record; |
| 43 | record.variable_name = std::move(variable_name); |
| 44 | record.display_name = std::move(display_name); |
| 45 | record.pixel_layout = std::move(pixel_layout); |
| 46 | record.transpose = transpose; |
| 47 | record.width = width; |
| 48 | record.height = height; |
| 49 | record.channels = channels; |
| 50 | record.step = stride; |
| 51 | record.type = type; |
| 52 | |
| 53 | if (type == oid::BufferType::Float64) { |
| 54 | record.bytes = oid::make_float_buffer_from_double(bytes); |
| 55 | } else { |
| 56 | record.bytes = std::move(bytes); |
| 57 | } |
| 58 | |
| 59 | return record; |
| 60 | } |
| 61 | |
| 62 | } // namespace oid::host |