-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathOutputFileStream.h
More file actions
24 lines (20 loc) · 845 Bytes
/
Copy pathOutputFileStream.h
File metadata and controls
24 lines (20 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once
#include <cstddef>
#include <ios>
#include <memory>
#include <ostream>
#include <string>
// Open and finalize output files through one backend-selection point. Files
// ending in .gz or .gzip are written as BGZF and receive a standard .gzi
// sidecar index. Parallel block compression is used when parallelGzip is true
// and sufficient gzip worker capacity is available. Other files use std::ofstream.
std::unique_ptr<std::ostream> openOutputFile(
const std::string& filename,
std::ios_base::openmode mode,
size_t bufferSize = 0,
bool parallelGzip = true);
// Flushes, closes, and validates an output stream. This is deliberately
// explicit because destructors cannot safely report delayed write failures.
void finalizeOutputFile(
std::unique_ptr<std::ostream>& stream,
const std::string& filename);