aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/binsaver/util_stream_io.h
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/binsaver/util_stream_io.h
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/binsaver/util_stream_io.h')
-rw-r--r--library/cpp/binsaver/util_stream_io.h76
1 files changed, 38 insertions, 38 deletions
diff --git a/library/cpp/binsaver/util_stream_io.h b/library/cpp/binsaver/util_stream_io.h
index bc560cd5c3..d65d630b93 100644
--- a/library/cpp/binsaver/util_stream_io.h
+++ b/library/cpp/binsaver/util_stream_io.h
@@ -1,37 +1,37 @@
#pragma once
-
+
#include "bin_saver.h"
#include <util/stream/input.h>
#include <util/stream/output.h>
#include <util/stream/file.h>
-class TYaStreamInput: public IBinaryStream {
- IInputStream& Stream;
+class TYaStreamInput: public IBinaryStream {
+ IInputStream& Stream;
- int WriteImpl(const void*, int) override {
+ int WriteImpl(const void*, int) override {
Y_ASSERT(0);
return 0;
}
- int ReadImpl(void* userBuffer, int size) override {
- return (int)Stream.Read(userBuffer, (size_t)size);
+ int ReadImpl(void* userBuffer, int size) override {
+ return (int)Stream.Read(userBuffer, (size_t)size);
+ }
+ bool IsValid() const override {
+ return true;
+ }
+ bool IsFailed() const override {
+ return false;
}
- bool IsValid() const override {
- return true;
- }
- bool IsFailed() const override {
- return false;
- }
-
+
public:
- TYaStreamInput(IInputStream& stream)
- : Stream(stream)
- {
+ TYaStreamInput(IInputStream& stream)
+ : Stream(stream)
+ {
}
};
-template <class T>
-inline void SerializeFromStream(IInputStream& stream, T& c) {
+template <class T>
+inline void SerializeFromStream(IInputStream& stream, T& c) {
TYaStreamInput f(stream);
{
IBinSaver bs(f, true);
@@ -39,38 +39,38 @@ inline void SerializeFromStream(IInputStream& stream, T& c) {
}
}
-template <class T>
-inline void SerializeFromFile(const TString& fileName, T& c) {
+template <class T>
+inline void SerializeFromFile(const TString& fileName, T& c) {
TIFStream in(fileName);
SerializeFromStream(in, c);
}
-class TYaStreamOutput: public IBinaryStream {
- IOutputStream& Stream;
+class TYaStreamOutput: public IBinaryStream {
+ IOutputStream& Stream;
- int WriteImpl(const void* what, int size) override {
- Stream.Write(what, (size_t)size);
+ int WriteImpl(const void* what, int size) override {
+ Stream.Write(what, (size_t)size);
return size;
}
- int ReadImpl(void*, int) override {
+ int ReadImpl(void*, int) override {
Y_ASSERT(0);
return 0;
}
- bool IsValid() const override {
- return true;
- }
- bool IsFailed() const override {
- return false;
- }
-
+ bool IsValid() const override {
+ return true;
+ }
+ bool IsFailed() const override {
+ return false;
+ }
+
public:
- TYaStreamOutput(IOutputStream& stream)
- : Stream(stream)
- {
+ TYaStreamOutput(IOutputStream& stream)
+ : Stream(stream)
+ {
}
};
-template <class T>
+template <class T>
inline void SerializeToArcadiaStream(IOutputStream& stream, T& c) {
TYaStreamOutput f(stream);
{
@@ -79,8 +79,8 @@ inline void SerializeToArcadiaStream(IOutputStream& stream, T& c) {
}
}
-template <class T>
-inline void SerializeToFile(const TString& fileName, T& c) {
+template <class T>
+inline void SerializeToFile(const TString& fileName, T& c) {
TOFStream out(fileName);
SerializeToArcadiaStream(out, c);
}