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/ ?
441
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
442
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
443
Name:
Anonymous
2011-07-04 8:20
OP here.
Stopped reading right there.
444
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
445
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
446
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
447
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
448
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
449
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
450
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
451
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
452
Name:
Anonymous
2011-07-04 8:21
OP here.
Stopped reading right there.
453
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
454
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
455
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
456
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
457
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
458
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
459
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
460
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
461
Name:
Anonymous
2011-07-04 8:22
OP here.
Stopped reading right there.
462
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
463
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
464
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
465
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
466
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
467
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
468
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
469
Name:
Anonymous
2011-07-04 8:23
OP here.
Stopped reading right there.
470
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
471
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
472
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
473
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
474
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
475
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
476
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
477
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
478
Name:
Anonymous
2011-07-04 8:24
OP here.
Stopped reading right there.
479
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
480
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
Newer Posts