| 231 | std::shared_ptr<Buffer>* out); |
| 232 | |
| 233 | static inline Result<std::shared_ptr<Buffer>> WriteFlatbufferBuilder( |
| 234 | flatbuffers::FlatBufferBuilder& fbb, // NOLINT non-const reference |
| 235 | MemoryPool* pool = default_memory_pool()) { |
| 236 | int32_t size = fbb.GetSize(); |
| 237 | |
| 238 | ARROW_ASSIGN_OR_RAISE(auto result, AllocateBuffer(size, pool)); |
| 239 | |
| 240 | uint8_t* dst = result->mutable_data(); |
| 241 | memcpy(dst, fbb.GetBufferPointer(), size); |
| 242 | // R build with openSUSE155 requires an explicit shared_ptr construction |
| 243 | return std::shared_ptr<Buffer>(std::move(result)); |
| 244 | } |
| 245 | |
| 246 | ARROW_EXPORT |
| 247 | flatbuf::TimeUnit ToFlatbufferUnit(TimeUnit::type unit); |