onnxruntime/winml/lib/Api.Core/ZeroCopyInputStreamWrapper.h
Paul McDaniel 5350abe19d
LearningModelSession is cleaned up to use the adapter, and parts of b… (#2382)
this is a big PR.    we are going to move it up to layer_dev , which is still a L3 so we are still safe to do work there agile.

we are going to move this into the L3 so that ryan can start doing intergration testing.   

we will pause for a full code review and integration test result prior to going into the L2.

>>>> raw comments from previous commits >>> 

* LearningModelSession is cleaned up to use the adapter, and parts of binding are.
* moved everything in the winmladapter
made it all nano-com using, WRL to construct objects in the ORT side.
base interfaces for everythign for winml to call
cleaned up a bunch of winml to use the base interfaces.
* more pieces
* GetData across the abi.
* renamed some namepsace
cleaned up OrtValue
cleaned up Tensor
cleaned up custom ops.
everything *but* learnignmodel should be clean
* make sure it's building.   winml.dll is still a monolith.
2019-11-14 17:44:07 -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