summaryrefslogtreecommitdiffstats
path: root/courgette/streams.h
diff options
context:
space:
mode:
Diffstat (limited to 'courgette/streams.h')
-rw-r--r--courgette/streams.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/courgette/streams.h b/courgette/streams.h
index 144dca7..3dbc2b7 100644
--- a/courgette/streams.h
+++ b/courgette/streams.h
@@ -147,6 +147,9 @@ class SinkStream {
// Hints that the stream will grow by an additional |length| bytes.
void Reserve(size_t length) { buffer_.reserve(length + buffer_.length()); }
+ // Finished with this stream and any storage it has.
+ void Retire();
+
private:
std::string buffer_; // Use a string to manage the stream's memory.
@@ -187,6 +190,11 @@ class SourceStreamSet {
DISALLOW_COPY_AND_ASSIGN(SourceStreamSet);
};
+// A SinkStreamSet is a set of SinkStreams. Data is collected by writing to the
+// component streams. When data collection is complete, it is destructively
+// transferred, either by flattening into one stream (CopyTo), or transfering
+// data pairwise into another SinkStreamSet by calling that SinkStreamSet's
+// WriteSet method.
class SinkStreamSet {
public:
SinkStreamSet();
@@ -199,8 +207,8 @@ class SinkStreamSet {
// Returns a pointer to a substream.
SinkStream* stream(size_t id) { return id < count_ ? &streams_[id] : NULL; }
- // CopyTo serializes the streams in the SinkStreamSet into a single target
- // stream or file. The serialized format may be re-read by initializing a
+ // CopyTo serializes the streams in this SinkStreamSet into a single target
+ // stream. The serialized format may be re-read by initializing a
// SourceStreamSet with a buffer containing the data.
bool CopyTo(SinkStream* combined_stream);