Fast and simple C++ byte stream abstraction
1
Name:
Anonymous
2011-07-04 6:04
I wanted a simple stream like class that was very light-weight and easy to use for binary serialization of variable-length structures. I didn't want it to be much more expensive than just dereferencing values with a pointer, but I wanted it to provide somewhat better type safety and endian byte-order independence for working with different file formats in a portable manner.
Furthermore, I wanted it to be usable on top of asynchronous file and network I/O, so you just serialize your stuff into a big block of memory that you specify, and then when you're done you asynchronously stream it to a file or socket. Same process in reverse for deserialization.
This is what I came up with:
byte_stream.hpp -
http://codepad.org/4IaQJwpi
byte_stream.cpp -
http://codepad.org/8iJiYraM
I've added it to my
libprog++ library, so it has some header dependencies, namely the stuff in byte_swap.hpp which maps to compiler intrinsics or inline assembly using the CPU's byte swapping instructions. I've also removed some ugly preprocessor macros for proper shared library/dll symbol exporting for sake of brevity.
So, what do you think
/prog/ ?
281
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
282
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
283
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
284
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
285
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
286
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
287
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
288
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
289
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
290
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
291
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
292
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
293
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
294
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
295
Name:
Anonymous
2011-07-04 8:02
OP here.
Stopped reading right there.
296
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
297
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
298
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
299
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
300
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
301
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
302
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
303
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
304
Name:
Anonymous
2011-07-04 8:03
OP here.
Stopped reading right there.
305
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
306
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
307
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
308
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
309
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
310
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
311
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
312
Name:
Anonymous
2011-07-04 8:04
OP here.
Stopped reading right there.
313
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
314
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
315
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
316
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
317
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
318
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
319
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
320
Name:
Anonymous
2011-07-04 8:05
OP here.
Stopped reading right there.
Newer Posts