onnxruntime/winml/lib/Api/VectorBackedBuffer.cpp
Sheil Kumar 84c1340f9b
Refactor implementation of Tensor<T> and underlying buffer stores to improve binary size and maintainability (#5836)
* refactor tensor buffers to make cleaner

* refactor to make tensor backing buffer implementation smaller and cleaner

* missed virtual on destructor

* remove unnecessary static_pointer_cast

* add string vector accessor

Co-authored-by: Sheil Kumar <sheilk@microsoft.com>
2020-11-18 14:56:47 -08:00

29 lines
No EOL
706 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "pch.h"
#include "VectorBackedBuffer.h"
namespace _winml {
vector_backed_buffer::vector_backed_buffer(size_t size) : buffer_(size) {}
uint32_t vector_backed_buffer::Capacity() const {
return static_cast<uint32_t>(buffer_.size());
}
uint32_t vector_backed_buffer::Length() const {
throw winrt::hresult_error(E_NOTIMPL);
}
void vector_backed_buffer::Length(uint32_t /*value*/) {
throw winrt::hresult_error(E_NOTIMPL);
}
STDMETHODIMP vector_backed_buffer::Buffer(uint8_t** value) {
RETURN_HR_IF_NULL(E_POINTER, value);
*value = buffer_.data();
return S_OK;
}
} // namespace _winml