Byte stream with multiple internal buffers

Hi, I am writing a network sniffer that receives a variable number of TCP packets with payload strings of variable length that i need to concatenate. Using std string concatination is too expensive because of extra copying and possible reallocation of the internal buffer when it runs out of capacity. Better would be a special byte stream that stores its data in multiple variable-length buffers with an interface that works as if the buffers are just one buffer, with operations similar to std string. I was wondering if boost provides a supporting library for this. Thanks, Andrej

On Apr 14, 2011, at 2:03 AM, Andrej van der Zee
Better would be a special byte stream that stores its data in multiple variable-length buffers with an interface that works as if the buffers are just one buffer, with operations similar to std string.
You are looking for a "rope". Some have been proposed here but none reviewed. Original SGI STL has one. HTH Gordon

Hi, Thanks for your email.
You are looking for a "rope". Some have been proposed here but none reviewed. Original SGI STL has one.
The GNU extension has one too I found, but it looks like not action there for years and very limited documentation. Moreover, a rope seems a bit overkill for my application as my data stream only concatenates new incoming byte buffers and is read-only. Also, I need to have control over pointer-to-buffer ownerships by using smart pointers and the GNU extension seems not to be templated. Well, I am going for my own implementation... Cheers, Andrej
participants (2)
-
Andrej van der Zee
-
Gordon Woodhull