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/ ?
681
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
682
Name:
Anonymous
2011-07-04 8:47
OP here.
Stopped reading right there.
683
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
684
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
685
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
686
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
687
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
688
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
689
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
690
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
691
Name:
Anonymous
2011-07-04 8:48
OP here.
Stopped reading right there.
692
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
693
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
694
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
695
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
696
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
697
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
698
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
699
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
700
Name:
Anonymous
2011-07-04 8:49
OP here.
Stopped reading right there.
701
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
702
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
703
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
704
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
705
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
706
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
707
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
708
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
709
Name:
Anonymous
2011-07-04 8:50
OP here.
Stopped reading right there.
710
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
711
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
712
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
713
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
714
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
715
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
716
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
717
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
718
Name:
Anonymous
2011-07-04 8:51
OP here.
Stopped reading right there.
719
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
720
Name:
Anonymous
2011-07-04 8:52
OP here.
Stopped reading right there.
Newer Posts