Index: courgette/streams.h |
=================================================================== |
--- courgette/streams.h (revision 75361) |
+++ courgette/streams.h (working copy) |
@@ -147,6 +147,9 @@ |
// 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 @@ |
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 @@ |
// 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); |