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/ ?
921
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
922
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
923
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
924
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
925
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
926
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
927
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
928
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
929
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
930
Name:
Anonymous
2011-07-04 9:16
OP here.
Stopped reading right there.
931
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
932
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
933
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
934
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
935
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
936
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
937
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
938
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
939
Name:
Anonymous
2011-07-04 9:17
OP here.
Stopped reading right there.
940
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
941
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
942
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
943
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
944
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
945
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
946
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
947
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
948
Name:
Anonymous
2011-07-04 9:18
OP here.
Stopped reading right there.
949
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
950
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
951
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
952
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
953
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
954
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
955
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
956
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
957
Name:
Anonymous
2011-07-04 9:19
OP here.
Stopped reading right there.
958
Name:
Anonymous
2011-07-04 9:20
OP here.
Stopped reading right there.
959
Name:
Anonymous
2011-07-04 9:20
OP here.
Stopped reading right there.
960
Name:
Anonymous
2011-07-04 9:20
OP here.
Stopped reading right there.
Newer Posts