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/ ?
241
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
242
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
243
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
244
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
245
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
246
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
247
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
248
Name:
Anonymous
2011-07-04 7:56
OP here.
Stopped reading right there.
249
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
250
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
251
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
252
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
253
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
254
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
255
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
256
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
257
Name:
Anonymous
2011-07-04 7:57
OP here.
Stopped reading right there.
258
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
259
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
260
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
261
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
262
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
263
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
264
Name:
Anonymous
2011-07-04 7:58
OP here.
Stopped reading right there.
265
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
266
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
267
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
268
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
269
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
270
Name:
Anonymous
2011-07-04 7:59
OP here.
Stopped reading right there.
271
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
272
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
273
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
274
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
275
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
276
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
277
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
278
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
279
Name:
Anonymous
2011-07-04 8:00
OP here.
Stopped reading right there.
280
Name:
Anonymous
2011-07-04 8:01
OP here.
Stopped reading right there.
Newer Posts