aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/length.h
diff options
context:
space:
mode:
authorAlexander Fokin <apfokin@gmail.com>2022-02-10 16:45:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:38 +0300
commit863a59a65247c24db7cb06789bc5cf79d04da32f (patch)
tree139dc000c8cd4a40f5659e421b7c75135d080307 /util/stream/length.h
parentf64e95a9eb9ab03240599eb9581c5a9102426a96 (diff)
downloadydb-863a59a65247c24db7cb06789bc5cf79d04da32f.tar.gz
Restoring authorship annotation for Alexander Fokin <apfokin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/stream/length.h')
-rw-r--r--util/stream/length.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/util/stream/length.h b/util/stream/length.h
index 4d508ae24d..049b91c05b 100644
--- a/util/stream/length.h
+++ b/util/stream/length.h
@@ -1,17 +1,17 @@
#pragma once
#include "input.h"
-#include "output.h"
+#include "output.h"
#include <util/generic/utility.h>
-/**
- * Proxy input stream that can read a limited number of characters from a slave
- * stream.
- *
- * This can be useful for breaking up the slave stream into small chunks and
- * treat these as separate streams.
- */
+/**
+ * Proxy input stream that can read a limited number of characters from a slave
+ * stream.
+ *
+ * This can be useful for breaking up the slave stream into small chunks and
+ * treat these as separate streams.
+ */
class TLengthLimitedInput: public IInputStream {
public:
inline TLengthLimitedInput(IInputStream* slave, ui64 length) noexcept
@@ -35,9 +35,9 @@ private:
ui64 Length_;
};
-/**
- * Proxy input stream that counts the number of characters read.
- */
+/**
+ * Proxy input stream that counts the number of characters read.
+ */
class TCountingInput: public IInputStream {
public:
inline TCountingInput(IInputStream* slave) noexcept
@@ -48,10 +48,10 @@ public:
~TCountingInput() override = default;
- /**
- * \returns The total number of characters read from
- * this stream.
- */
+ /**
+ * \returns The total number of characters read from
+ * this stream.
+ */
inline ui64 Counter() const noexcept {
return Count_;
}
@@ -66,35 +66,35 @@ private:
IInputStream* Slave_;
ui64 Count_;
};
-
-/**
- * Proxy output stream that counts the number of characters written.
- */
+
+/**
+ * Proxy output stream that counts the number of characters written.
+ */
class TCountingOutput: public IOutputStream {
-public:
+public:
inline TCountingOutput(IOutputStream* slave) noexcept
: Slave_(slave)
, Count_()
{
- }
-
+ }
+
~TCountingOutput() override = default;
-
+
TCountingOutput(TCountingOutput&&) noexcept = default;
TCountingOutput& operator=(TCountingOutput&&) noexcept = default;
- /**
- * \returns The total number of characters written
- * into this stream.
- */
+ /**
+ * \returns The total number of characters written
+ * into this stream.
+ */
inline ui64 Counter() const noexcept {
- return Count_;
- }
-
-private:
+ return Count_;
+ }
+
+private:
void DoWrite(const void* buf, size_t len) override;
-
-private:
+
+private:
IOutputStream* Slave_;
- ui64 Count_;
-};
+ ui64 Count_;
+};