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/ ?
481
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
482
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
483
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
484
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
485
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
486
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
487
Name:
Anonymous
2011-07-04 8:25
OP here.
Stopped reading right there.
488
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
489
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
490
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
491
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
492
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
493
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
494
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
495
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
496
Name:
Anonymous
2011-07-04 8:26
OP here.
Stopped reading right there.
497
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
498
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
499
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
500
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
501
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
502
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
503
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
504
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
505
Name:
Anonymous
2011-07-04 8:27
OP here.
Stopped reading right there.
506
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
507
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
508
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
509
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
510
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
511
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
512
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
513
Name:
Anonymous
2011-07-04 8:28
OP here.
Stopped reading right there.
514
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
515
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
516
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
517
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
518
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
519
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
520
Name:
Anonymous
2011-07-04 8:29
OP here.
Stopped reading right there.
Newer Posts