22#define _G3_DATAIO_H
33
44#include < string>
5- #include < memory>
65#include < iostream>
76
87/* *
98 * Configure a filtering stream for G3Frame decompression from a local or remote
109 * file source.
1110 *
11+ * @param stream A reference to the input stream to be configured by this
12+ * function.
1213 * @param path A valid filename on disk, or a TCP socket address. If a
1314 * filename, the compression scheme is determined from the file
1415 * extension. Supported compression schemes are gzip or bzip2.
1920 * read until EOF.
2021 * @param timeout Timeout in seconds for socket connections.
2122 * @param buffersize Advisory buffer size in bytes for aggregating reads
22- * @return stream The input stream configured by this function.
2323 */
24- std::shared_ptr<std::istream>
25- g3_istream_from_path (const std::string &path, float timeout=- 1.0 ,
26- size_t buffersize=1024 *1024 );
24+ void
25+ g3_istream_from_path (std::istream &stream, const std::string &path,
26+ float timeout=- 1.0 , size_t buffersize=1024 *1024 );
2727
2828/* *
2929 * Return the file descriptor handle for socket connections.
@@ -32,22 +32,32 @@ g3_istream_from_path(const std::string &path, float timeout=-1.0,
3232 * g3_istream_from_path.
3333 * @return fd The socket file descriptor.
3434 */
35- int g3_istream_handle (std::shared_ptr<std::istream> &stream);
35+ int g3_istream_handle (std::istream &stream);
36+
37+ /* *
38+ * Clean up the input stream.
39+ *
40+ * @param stream A reference to the input stream, as configured by
41+ * g3_istream_from_path.
42+ */
43+ void g3_istream_close (std::istream &stream);
3644
3745/* *
3846 * Configure a filtering stream for G3Frame compression to a local file.
3947 *
48+ * @param stream A reference to the output stream to be configured by this
49+ * function.
4050 * @param path A valid filename on disk. If a filename, the compression
4151 * scheme is determined from the file extension. Supported
4252 * compression schemes are gzip or bzip2.
4353 * @param append If true, append to an existing file on disk. Otherwise,
4454 * Create a new file or overwrite an existing file.
4555 * @param counter If true, add a counter filter to the stream configuration,
4656 * for use by the g3_ostream_count function.
47- * @return stream The output stream configured by this function.
4857 */
49- std::shared_ptr<std::ostream>
50- g3_ostream_to_path (const std::string &path, bool append=false , bool counter=false );
58+ void
59+ g3_ostream_to_path (std::ostream &stream, const std::string &path, bool append=false ,
60+ bool counter=false );
5161
5262/* *
5363 * Count the number of bytes written to the output file stream.
@@ -56,15 +66,23 @@ g3_ostream_to_path(const std::string &path, bool append=false, bool counter=fals
5666 * g3_ostream_to_path with the counter argument set to true.
5767 * @return Number of bytes written to disk.
5868 */
59- size_t g3_ostream_count (std::shared_ptr<std:: ostream> &stream);
69+ size_t g3_ostream_count (std::ostream &stream);
6070
6171/* *
6272 * Flush the output file stream.
6373 *
6474 * @param stream A reference to the output stream, as configured by
6575 * g3_ostream_to_path.
6676 */
67- void g3_ostream_flush (std::shared_ptr<std::ostream> &stream);
77+ void g3_ostream_flush (std::ostream &stream);
78+
79+ /* *
80+ * Clean up the output stream.
81+ *
82+ * @param stream A reference to the output stream, as configured by
83+ * g3_istream_from_path.
84+ */
85+ void g3_ostream_close (std::ostream &stream);
6886
6987/* *
7088 * Check that the input filename is a valid filename on disk.
0 commit comments