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/ ?
721
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
722
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
723
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
724
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
725
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
726
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
727
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
728
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
729
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
730
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
731
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
732
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
733
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
734
Name:
Anonymous
2011-07-04 8:53
OP here.
Stopped reading right there.
735
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
736
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
737
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
738
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
739
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
740
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
741
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
742
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
743
Name:
Anonymous
2011-07-04 8:54
OP here.
Stopped reading right there.
744
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
745
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
746
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
747
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
748
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
749
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
750
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
751
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
752
Name:
Anonymous
2011-07-04 8:55
OP here.
Stopped reading right there.
753
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
754
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
755
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
756
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
757
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
758
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
759
Name:
Anonymous
2011-07-04 8:56
OP here.
Stopped reading right there.
760
Name:
Anonymous
2011-07-04 8:57
OP here.
Stopped reading right there.
Newer Posts