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/ ?
161
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
162
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
163
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
164
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
165
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
166
Name:
Anonymous
2011-07-04 7:46
OP here.
Stopped reading right there.
167
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
168
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
169
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
170
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
171
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
172
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
173
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
174
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
175
Name:
Anonymous
2011-07-04 7:47
OP here.
Stopped reading right there.
176
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
177
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
178
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
179
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
180
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
181
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
182
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
183
Name:
Anonymous
2011-07-04 7:48
OP here.
Stopped reading right there.
184
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
185
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
186
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
187
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
188
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
189
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
190
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
191
Name:
Anonymous
2011-07-04 7:49
OP here.
Stopped reading right there.
192
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
193
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
194
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
195
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
196
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
197
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
198
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
199
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
200
Name:
Anonymous
2011-07-04 7:50
OP here.
Stopped reading right there.
Newer Posts