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/ ?
641
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
642
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
643
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
644
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
645
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
646
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
647
Name:
Anonymous
2011-07-04 8:43
OP here.
Stopped reading right there.
648
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
649
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
650
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
651
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
652
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
653
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
654
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
655
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
656
Name:
Anonymous
2011-07-04 8:44
OP here.
Stopped reading right there.
657
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
658
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
659
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
660
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
661
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
662
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
663
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
664
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
665
Name:
Anonymous
2011-07-04 8:45
OP here.
Stopped reading right there.
666
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
667
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
668
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
669
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
670
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
671
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
672
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
673
Name:
Anonymous
2011-07-04 8:46
OP here.
Stopped reading right there.
674
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
675
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
676
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
677
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
678
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
679
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
680
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
Newer Posts