MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / resize

Method resize

src/include/buffer.hpp:251–270  ·  view source on GitHub ↗

\brief resize \param new_size the new size

Source from the content-addressed store, hash-verified

249 /// \brief resize
250 /// \param new_size the new size
251 void resize(size_t new_size) {
252#ifdef __XRT__
253 assert(!is_bo_owner_);
254#endif
255 if (data_ != nullptr && !is_owner_) {
256 throw std::runtime_error("Cannot resize a non-owner buffer");
257 }
258 if (new_size == 0) {
259 throw std::runtime_error("Cannot resize to zero size");
260 }
261 try {
262 owned_data_.reset(new uint8_t[new_size]);
263 }
264 catch (const std::bad_alloc& e) {
265 throw std::runtime_error(std::string("Failed to allocate bytes of size ") + std::to_string(new_size) + ": " + e.what());
266 }
267 data_ = owned_data_.get();
268 size_ = new_size;
269 is_owner_ = true;
270 }
271
272 /// \brief free, release the memory or the bo
273 void free() {

Callers 15

get_interactive_inputMethod · 0.45
handle_regular_keyMethod · 0.45
should_continue_inputMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 3

to_stringFunction · 0.50
resetMethod · 0.45
getMethod · 0.45

Tested by 13

mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36