onnxruntime/winml/adapter/ZeroCopyInputStreamWrapper.h
Paul McDaniel c615002f5d
Layer dev paulm (#2533)
* commetns for dml graph transformer
fixed ort value passing using the allocatir info

* fixed and coded maps and sequences across the abi

* cleaned up w4's
cleaned up the model info ABI
delayload directml.dll from winml

* cleaned up namepsace aliases.
renamed _winmla to winmla
this was good PR feedback from tiago a while back.

* moved files from inc to lib\api.core
cleaned up some of the cmake

* staged changes
2019-12-03 15:31:22 -08:00

43 lines
No EOL
1 KiB
C++

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#pragma once
#include "winrt/Windows.Storage.Streams.h"
#include <robuffer.h>
namespace Windows::AI::MachineLearning {
// _ZeroCopyInputStreamWrapper is a helper class that allows a ZeroCopyInputStream,
// which is a protobuf type, to read from an IRandomAccessStreamReference, which is
// a winrt type.
class ZeroCopyInputStreamWrapper : public google::protobuf::io::ZeroCopyInputStream {
public:
ZeroCopyInputStreamWrapper() = delete;
ZeroCopyInputStreamWrapper(
ABI::Windows::Storage::Streams::IRandomAccessStreamReference* stream);
// ModelProto load only uses "Next" method
bool
Next(
const void** data,
int* size);
void
BackUp(
int count);
bool
Skip(
int count);
__int64
ByteCount() const;
private:
wss::IRandomAccessStreamReference stream_;
bool finished_reading_ = false;
winrt::com_ptr<::Windows::Storage::Streams::IBufferByteAccess> bytes_;
};
} // namespace Windows::AI::MachineLearning