\brief Return result of builder as a Buffer object. The builder is reset and can be reused afterwards. \param[out] out the finalized Buffer object \param shrink_to_fit if the buffer size is smaller than its capacity, reallocate to fit more tightly in memory. Set to false to avoid a reallocation, at the expense of potentially more memory consumption. \return Status
| 163 | /// a reallocation, at the expense of potentially more memory consumption. |
| 164 | /// \return Status |
| 165 | Status Finish(std::shared_ptr<Buffer>* out, bool shrink_to_fit = true) { |
| 166 | ARROW_RETURN_NOT_OK(Resize(size_, shrink_to_fit)); |
| 167 | if (size_ != 0) buffer_->ZeroPadding(); |
| 168 | *out = buffer_; |
| 169 | if (*out == NULLPTR) { |
| 170 | ARROW_ASSIGN_OR_RAISE(*out, AllocateBuffer(0, alignment_, pool_)); |
| 171 | } |
| 172 | Reset(); |
| 173 | return Status::OK(); |
| 174 | } |
| 175 | |
| 176 | Result<std::shared_ptr<Buffer>> Finish(bool shrink_to_fit = true) { |
| 177 | std::shared_ptr<Buffer> out; |
no test coverage detected