MCPcopy Create free account
hub / github.com/activeloopai/deeplake / write

Method write

cpp/format/serializer.hpp:52–65  ·  view source on GitHub ↗

* @brief Writes the given object in the given buffer at the given offset. * Returns the new offset end of the written data. * * @param o Object. * @param bytes Buffer to write. * @param offset Offset to write at. * @return int64_t The new offset. */

Source from the content-addressed store, hash-verified

50 * @return int64_t The new offset.
51 */
52 inline static int64_t write(const T& o, buffer_t& bytes, int64_t offset)
53 {
54 if constexpr (impl::has_output_size_member_function_v<serializable<T>>) {
55 auto size = serializable<T>::output_size(o);
56 bytes.resize(std::max(offset + size, static_cast<int64_t>(bytes.size())));
57 serializable<T>::write(o, bytes, offset);
58 return offset + size;
59 } else {
60 auto buf = serializable<T>::write(o);
61 bytes.insert(bytes.begin() + offset, std::make_move_iterator(buf.begin()),
62 std::make_move_iterator(buf.end()));
63 return offset + buf.size();
64 }
65 }
66};
67
68template <typename T>

Callers

nothing calls this directly

Calls 6

writeFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected