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/ ?
801
Name:
Anonymous
2011-07-04 9:01
OP here.
Stopped reading right there.
802
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
803
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
804
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
805
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
806
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
807
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
808
Name:
Anonymous
2011-07-04 9:02
OP here.
Stopped reading right there.
809
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
810
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
811
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
812
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
813
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
814
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
815
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
816
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
817
Name:
Anonymous
2011-07-04 9:03
OP here.
Stopped reading right there.
818
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
819
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
820
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
821
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
822
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
823
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
824
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
825
Name:
Anonymous
2011-07-04 9:04
OP here.
Stopped reading right there.
826
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
827
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
828
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
829
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
830
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
831
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
832
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
833
Name:
Anonymous
2011-07-04 9:05
OP here.
Stopped reading right there.
834
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
835
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
836
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
837
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
838
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
839
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
840
Name:
Anonymous
2011-07-04 9:06
OP here.
Stopped reading right there.
Newer Posts