aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/pipe.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/pipe.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/pipe.h')
-rw-r--r--util/stream/pipe.h102
1 files changed, 51 insertions, 51 deletions
diff --git a/util/stream/pipe.h b/util/stream/pipe.h
index 18525b9517..15ad8fd910 100644
--- a/util/stream/pipe.h
+++ b/util/stream/pipe.h
@@ -1,29 +1,29 @@
#pragma once
-#include "input.h"
-#include "output.h"
+#include "input.h"
+#include "output.h"
#include <util/system/pipe.h>
#include <util/generic/ptr.h>
#include <util/generic/string.h>
-/**
- * @addtogroup Streams_Pipes
- * @{
- */
-
-/**
- * Base class for starting a process and communicating with it via pipes.
- */
+/**
+ * @addtogroup Streams_Pipes
+ * @{
+ */
+
+/**
+ * Base class for starting a process and communicating with it via pipes.
+ */
class TPipeBase {
protected:
- /**
- * Starts a new process and opens a pipe.
- *
- * @param command Command line to start a process with.
- * @param mode Data transfer mode for the pipe. Use
- * "r" for reading and "w" for writing.
- */
+ /**
+ * Starts a new process and opens a pipe.
+ *
+ * @param command Command line to start a process with.
+ * @param mode Data transfer mode for the pipe. Use
+ * "r" for reading and "w" for writing.
+ */
TPipeBase(const TString& command, const char* mode);
virtual ~TPipeBase();
@@ -32,44 +32,44 @@ protected:
THolder<TImpl> Impl_;
};
-/**
- * Input stream that binds to a standard output stream of a newly started process.
- *
- * Note that if the process ends with non-zero exit status, `Read` function will
- * throw an exception.
- */
+/**
+ * Input stream that binds to a standard output stream of a newly started process.
+ *
+ * Note that if the process ends with non-zero exit status, `Read` function will
+ * throw an exception.
+ */
class TPipeInput: protected TPipeBase, public IInputStream {
public:
- /**
- * Starts a new process and opens a pipe.
- *
- * @param command Command line to start a process with.
- */
+ /**
+ * Starts a new process and opens a pipe.
+ *
+ * @param command Command line to start a process with.
+ */
TPipeInput(const TString& command);
private:
size_t DoRead(void* buf, size_t len) override;
};
-/**
- * Output stream that binds to a standard input stream of a newly started process.
- *
- * Note that if the process ends with non-zero exit status, `Close` function will
- * throw an exception.
- */
+/**
+ * Output stream that binds to a standard input stream of a newly started process.
+ *
+ * Note that if the process ends with non-zero exit status, `Close` function will
+ * throw an exception.
+ */
class TPipeOutput: protected TPipeBase, public IOutputStream {
public:
- /**
- * Starts a new process and opens a pipe.
- *
- * @param command Command line to start a process with.
- */
+ /**
+ * Starts a new process and opens a pipe.
+ *
+ * @param command Command line to start a process with.
+ */
TPipeOutput(const TString& command);
-
- /**
- * Waits for the process to terminate and throws an exception if it ended
- * with a non-zero exit status.
- */
+
+ /**
+ * Waits for the process to terminate and throws an exception if it ended
+ * with a non-zero exit status.
+ */
void Close();
private:
@@ -85,9 +85,9 @@ protected:
TPipeHandle Handle_;
};
-/**
- * Input stream that binds to a standard output stream of an existing process.
- */
+/**
+ * Input stream that binds to a standard output stream of an existing process.
+ */
class TPipedInput: public TPipedBase, public IInputStream {
public:
TPipedInput(PIPEHANDLE fd);
@@ -97,9 +97,9 @@ private:
size_t DoRead(void* buf, size_t len) override;
};
-/**
- * Output stream that binds to a standard input stream of an existing process.
- */
+/**
+ * Output stream that binds to a standard input stream of an existing process.
+ */
class TPipedOutput: public TPipedBase, public IOutputStream {
public:
TPipedOutput(PIPEHANDLE fd);
@@ -109,4 +109,4 @@ private:
void DoWrite(const void* buf, size_t len) override;
};
-/** @} */
+/** @} */