aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/streams/zc_memory_input
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.ru>2022-02-10 16:46:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:32 +0300
commit298c6da79f1d8f35089a67f463f0b541bec36d9b (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/streams/zc_memory_input
parent00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (diff)
downloadydb-298c6da79f1d8f35089a67f463f0b541bec36d9b.tar.gz
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/streams/zc_memory_input')
-rw-r--r--library/cpp/streams/zc_memory_input/zc_memory_input.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/streams/zc_memory_input/zc_memory_input.h b/library/cpp/streams/zc_memory_input/zc_memory_input.h
index 3880959afd..c939d8e426 100644
--- a/library/cpp/streams/zc_memory_input/zc_memory_input.h
+++ b/library/cpp/streams/zc_memory_input/zc_memory_input.h
@@ -1,48 +1,48 @@
-#pragma once
-
-#include <util/stream/mem.h>
-#include <util/system/defaults.h>
+#pragma once
+
+#include <util/stream/mem.h>
+#include <util/system/defaults.h>
#include <util/generic/yexception.h>
-
-/// Zero-copy memory input with fixed read
+
+/// Zero-copy memory input with fixed read
class TZCMemoryInput: public TMemoryInput {
-public:
+public:
TZCMemoryInput() {
}
- TZCMemoryInput(const char* dataPtr, size_t size)
- : TMemoryInput(dataPtr, size)
+ TZCMemoryInput(const char* dataPtr, size_t size)
+ : TMemoryInput(dataPtr, size)
{
}
- TZCMemoryInput(TMemoryInput& rhs)
- : TMemoryInput(rhs.Buf(), rhs.Avail())
+ TZCMemoryInput(TMemoryInput& rhs)
+ : TMemoryInput(rhs.Buf(), rhs.Avail())
{
}
- /// if there's 'size' data read it, otherwise just return false
+ /// if there's 'size' data read it, otherwise just return false
Y_FORCE_INLINE bool ReadFixed(const char*& buf, size_t size) {
- if (Avail() >= size) {
- buf = Buf();
- Reset(Buf() + size, Avail() - size);
- return true;
- }
- return false;
- }
-
+ if (Avail() >= size) {
+ buf = Buf();
+ Reset(Buf() + size, Avail() - size);
+ return true;
+ }
+ return false;
+ }
+
template <class T>
Y_FORCE_INLINE T LoadPOD() {
const char* buf = nullptr;
- if (!ReadFixed(buf, sizeof(T)))
+ if (!ReadFixed(buf, sizeof(T)))
ythrow yexception() << "TZCMemoryInput::LoadPOD failed: not enough data ("
- << Avail() << " of " << sizeof(T) << " bytes)";
+ << Avail() << " of " << sizeof(T) << " bytes)";
T res;
memcpy(&res, buf, sizeof(T));
return res;
}
-
+
template <class T>
Y_FORCE_INLINE void ReadPOD(T& x) {
- x = LoadPOD<T>();
- }
-};
+ x = LoadPOD<T>();
+ }
+};