You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/Module/GeoSigmaDraw/InterfaceStream.cpp

38 lines
1.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "stdafx.h"
#include "StreamManager.h"
#include "NativeStream.h"
// ---------------------------------------------------------------------------
// Stream 导出接口,供 C# P/Invoke 调用真流式Open 时指定 pView+importTypeWrite 即边解析边导入)
// ---------------------------------------------------------------------------
extern "C" __declspec(dllexport)
int64_t Stream_Open(CSigmaView* pView, int importType, int* outError)
{
if (outError == nullptr)
{
return -1;
}
StreamError err = StreamError::STREAM_OK;
int64_t handle = StreamManager::Instance().Open(pView, importType, err);
*outError = static_cast<int>(err);
return handle;
}
extern "C" __declspec(dllexport) int Stream_Write(int64_t handle, const void* data, int size)
{
if (data == nullptr || size < 0)
{
return static_cast<int>(StreamError::STREAM_WRITE_FAILED);
}
StreamError err = StreamManager::Instance().Write(handle, data, static_cast<size_t>(size));
return static_cast<int>(err);
}
extern "C" __declspec(dllexport) int Stream_Close(int64_t handle)
{
StreamError err = StreamManager::Instance().Close(handle);
return static_cast<int>(err);
}