MCPcopy Create free account
hub / github.com/bytedance/Fastbot_Android / ResizeVector

Function ResizeVector

native/thirdpart/flatbuffers/reflection.h:438–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436
437template<typename T>
438void ResizeVector(const reflection::Schema &schema, uoffset_t newsize, T val,
439 const Vector<T> *vec, std::vector<uint8_t> *flatbuf,
440 const reflection::Object *root_table = nullptr) {
441 auto delta_elem = static_cast<int>(newsize) - static_cast<int>(vec->size());
442 auto newelems = ResizeAnyVector(
443 schema, newsize, reinterpret_cast<const VectorOfAny *>(vec), vec->size(),
444 static_cast<uoffset_t>(sizeof(T)), flatbuf, root_table);
445 // Set new elements to "val".
446 for (int i = 0; i < delta_elem; i++) {
447 auto loc = newelems + i * sizeof(T);
448 auto is_scalar = flatbuffers::is_scalar<T>::value;
449 if (is_scalar) {
450 WriteScalar(loc, val);
451 } else { // struct
452 *reinterpret_cast<T *>(loc) = val;
453 }
454 }
455}
456
457// Adds any new data (in the form of a new FlatBuffer) to an existing
458// FlatBuffer. This can be used when any of the above methods are not

Callers

nothing calls this directly

Calls 3

ResizeAnyVectorFunction · 0.85
WriteScalarFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected