8#ifdef MOMENTUM_WITH_FBX_SDK
14FbxMemoryStream::FbxMemoryStream(std::span<const std::byte> buffer,
int pReaderId)
16 length_(buffer.size()),
18 state_(EState::eClosed),
19 readerId_(pReaderId) {}
21FbxMemoryStream::~FbxMemoryStream() {
25FbxStream::EState FbxMemoryStream::GetState() {
29bool FbxMemoryStream::Open(
void* ) {
31 state_ = EState::eOpen;
35bool FbxMemoryStream::Close() {
37 state_ = EState::eClosed;
41bool FbxMemoryStream::Flush() {
45#if FBX_VERSION_GE(2020, 3, 2)
46size_t FbxMemoryStream::Write(
const void* , FbxUInt64 ) {
48int FbxMemoryStream::Write(
const void* ,
int ) {
54#if FBX_VERSION_GE(2020, 3, 2)
55size_t FbxMemoryStream::Read(
void* buffer, FbxUInt64 count)
const {
57int FbxMemoryStream::Read(
void* buffer,
int count)
const {
59 long remaining = length_ - position_;
60 if (count > remaining) {
65 memcpy(buffer, buffer_.data() + position_, count);
70int FbxMemoryStream::GetReaderID()
const {
74int FbxMemoryStream::GetWriterID()
const {
78void FbxMemoryStream::Seek(
const FbxInt64& pOffset,
const FbxFile::ESeekPos& pSeekPos) {
79 long offset = (long)pOffset;
81 case FbxFile::ESeekPos::eCurrent:
84 case FbxFile::ESeekPos::eEnd:
85 position_ = length_ - offset;
94 }
else if (position_ > length_) {
99#if FBX_VERSION_GE(2020, 3, 2)
100FbxInt64 FbxMemoryStream::GetPosition()
const {
102long FbxMemoryStream::GetPosition()
const {
107#if FBX_VERSION_GE(2020, 3, 2)
108void FbxMemoryStream::SetPosition(FbxInt64 pPosition) {
110void FbxMemoryStream::SetPosition(
long pPosition) {
112 position_ = pPosition;
115int FbxMemoryStream::GetError()
const {
119void FbxMemoryStream::ClearError() {