aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/zerocopy_output.h
diff options
context:
space:
mode:
authornikitamorozov <nikitamorozov@yandex-team.ru>2022-02-10 16:49:20 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:20 +0300
commit523d26598d9784601932189f7fceb34d61bf7641 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/zerocopy_output.h
parent2342f2b56e674c21307fcb92a37853f950224d31 (diff)
downloadydb-523d26598d9784601932189f7fceb34d61bf7641.tar.gz
Restoring authorship annotation for <nikitamorozov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/zerocopy_output.h')
-rw-r--r--util/stream/zerocopy_output.h114
1 files changed, 57 insertions, 57 deletions
diff --git a/util/stream/zerocopy_output.h b/util/stream/zerocopy_output.h
index 1986e761431..a388be04b04 100644
--- a/util/stream/zerocopy_output.h
+++ b/util/stream/zerocopy_output.h
@@ -1,57 +1,57 @@
-#pragma once
-
-#include <util/system/yassert.h>
-
-#include "output.h"
-
-/**
- * @addtogroup Streams
- * @{
- */
-
-/**
- * Output stream with direct access to the output buffer.
- *
- * Derived classes must implement `DoNext` and `DoUndo` methods.
- */
-class IZeroCopyOutput: public IOutputStream {
-public:
- IZeroCopyOutput() noexcept = default;
- ~IZeroCopyOutput() override = default;
-
- IZeroCopyOutput(IZeroCopyOutput&&) noexcept = default;
- IZeroCopyOutput& operator=(IZeroCopyOutput&&) noexcept = default;
-
- /**
- * Returns the next buffer to write to from this output stream.
- *
- * @param ptr[out] Pointer to the start of the buffer.
- * @returns Size of the returned buffer, in bytes.
- * Return value is always nonzero.
- */
- template <class T>
- inline size_t Next(T** ptr) {
- Y_ASSERT(ptr);
-
- return DoNext((void**)ptr);
- }
-
- /**
- * Tells the stream that `len` bytes at the end of the buffer returned previously
- * by Next were actually not written so the current position in stream must be moved backwards.
- * `len` must not be greater than the size of the buffer previously returned by `Next`.
- *
- * @param len[in] Number of bytes at the end to move the position by.
- *
- */
- inline void Undo(size_t len) {
- return DoUndo(len);
- }
-
-protected:
- void DoWrite(const void* buf, size_t len) override;
- virtual size_t DoNext(void** ptr) = 0;
- virtual void DoUndo(size_t len) = 0;
-};
-
-/** @} */
+#pragma once
+
+#include <util/system/yassert.h>
+
+#include "output.h"
+
+/**
+ * @addtogroup Streams
+ * @{
+ */
+
+/**
+ * Output stream with direct access to the output buffer.
+ *
+ * Derived classes must implement `DoNext` and `DoUndo` methods.
+ */
+class IZeroCopyOutput: public IOutputStream {
+public:
+ IZeroCopyOutput() noexcept = default;
+ ~IZeroCopyOutput() override = default;
+
+ IZeroCopyOutput(IZeroCopyOutput&&) noexcept = default;
+ IZeroCopyOutput& operator=(IZeroCopyOutput&&) noexcept = default;
+
+ /**
+ * Returns the next buffer to write to from this output stream.
+ *
+ * @param ptr[out] Pointer to the start of the buffer.
+ * @returns Size of the returned buffer, in bytes.
+ * Return value is always nonzero.
+ */
+ template <class T>
+ inline size_t Next(T** ptr) {
+ Y_ASSERT(ptr);
+
+ return DoNext((void**)ptr);
+ }
+
+ /**
+ * Tells the stream that `len` bytes at the end of the buffer returned previously
+ * by Next were actually not written so the current position in stream must be moved backwards.
+ * `len` must not be greater than the size of the buffer previously returned by `Next`.
+ *
+ * @param len[in] Number of bytes at the end to move the position by.
+ *
+ */
+ inline void Undo(size_t len) {
+ return DoUndo(len);
+ }
+
+protected:
+ void DoWrite(const void* buf, size_t len) override;
+ virtual size_t DoNext(void** ptr) = 0;
+ virtual void DoUndo(size_t len) = 0;
+};
+
+/** @} */