Skip to content

Commit

Permalink
Add close method to proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed Jun 18, 2024
1 parent 92d4e0b commit 5af72b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions matlab/src/cpp/arrow/matlab/error/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ static const char* ARRAY_SLICE_FAILED_TO_CREATE_ARRAY_PROXY =
static const char* C_EXPORT_FAILED = "arrow:c:export:ExportFailed";
static const char* C_IMPORT_FAILED = "arrow:c:import:ImportFailed";
static const char* IPC_RECORD_BATCH_WRITE_FAILED = "arrow:io:ipc:FailedToWriteRecordBatch";
static const char* IPC_RECORD_BATCH_WRITE_CLOSE_FAILED = "arrow:io:ipc:CloseFailed";
static const char* IPC_RECORD_BATCH_READER_OPEN_FAILED = "arrow:io:ipc:FailedToOpenRecordBatchReader";
static const char* IPC_RECORD_BATCH_READ_INVALID_INDEX = "arrow:io:ipc:InvalidIndex";
static const char* IPC_RECORD_BATCH_READ_FAILED = "arrow:io:ipc:ReadFailed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace arrow::matlab::io::ipc::proxy {

RecordBatchFileWriter::RecordBatchFileWriter(const std::shared_ptr<arrow::ipc::RecordBatchWriter> writer)
: writer{std::move(writer)} {
REGISTER_METHOD(RecordBatchFileWriter, close);
REGISTER_METHOD(RecordBatchFileWriter, writeRecordBatch);
REGISTER_METHOD(RecordBatchFileWriter, writeTable);
}
Expand Down Expand Up @@ -95,4 +96,9 @@ void RecordBatchFileWriter::writeTable(libmexclass::proxy::method::Context& cont
context, error::IPC_RECORD_BATCH_WRITE_FAILED);
}

void RecordBatchFileWriter::close(libmexclass::proxy::method::Context& context) {
MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(writer->Close(), context, error::IPC_RECORD_BATCH_WRITE_CLOSE_FAILED);
}


} // namespace arrow::matlab::io::ipc::proxy
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class RecordBatchFileWriter : public libmexclass::proxy::Proxy {

void writeTable(libmexclass::proxy::method::Context& context);

void close(libmexclass::proxy::method::Context& context);

};

} // namespace arrow::matlab::io::ipc::proxy

0 comments on commit 5af72b4

Please sign in to comment.