|
While using BufBuilder, BSONObjBuilder, and BSONArrayBuilder to generate BSON in C++, it would be nice to be able to associate a pool of BSONObjBuilder and BSONArrayBuilder objects with a BufBuilder so these objects can be efficiently obtained and re-used. This is currently not possible, since there is no way to inform a BSONObjBuilder that its _offset field should be reset to the current 'len' of its underlying BufBuilder, so these objects are one and done.
BSONObjBuilder and BSONArrayBuilder should offer a method that resynchronizes the builder with the current position in the underlying BufBuilder. I haven't been able to come up with a particularly good name for this method, so I'm open to suggestions, but something like 'resynchronizeWithBufBuilder' might do. Given that this is a sort of special case method, it is probably OK for it to have a sort of ugly name.
|