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/ ?
401
Name:
Anonymous
2011-07-04 8:15
OP here.
Stopped reading right there.
402
Name:
Anonymous
2011-07-04 8:15
OP here.
Stopped reading right there.
403
Name:
Anonymous
2011-07-04 8:15
OP here.
Stopped reading right there.
404
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
405
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
406
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
407
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
408
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
409
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
410
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
411
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
412
Name:
Anonymous
2011-07-04 8:16
OP here.
Stopped reading right there.
413
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
414
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
415
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
416
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
417
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
418
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
419
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
420
Name:
Anonymous
2011-07-04 8:17
OP here.
Stopped reading right there.
421
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
422
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
423
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
424
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
425
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
426
Name:
Anonymous
2011-07-04 8:18
OP here.
Stopped reading right there.
427
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
428
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
429
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
430
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
431
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
432
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
433
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
434
Name:
Anonymous
2011-07-04 8:19
OP here.
Stopped reading right there.
435
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
436
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
437
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
438
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
439
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
440
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
Newer Posts