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/ ?
881
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
882
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
883
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
884
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
885
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
886
Name:
Anonymous
2011-07-04 9:11
OP here.
Stopped reading right there.
887
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
888
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
889
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
890
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
891
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
892
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
893
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
894
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
895
Name:
Anonymous
2011-07-04 9:12
OP here.
Stopped reading right there.
896
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
897
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
898
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
899
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
900
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
901
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
902
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
903
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
904
Name:
Anonymous
2011-07-04 9:13
OP here.
Stopped reading right there.
905
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
906
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
907
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
908
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
909
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
910
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
911
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
912
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
913
Name:
Anonymous
2011-07-04 9:14
OP here.
Stopped reading right there.
914
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
915
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
916
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
917
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
918
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
919
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
920
Name:
Anonymous
2011-07-04 9:15
OP here.
Stopped reading right there.
Newer Posts