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/ ?
201
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
202
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
203
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
204
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
205
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
206
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
207
Name:
Anonymous
2011-07-04 7:51
OP here.
Stopped reading right there.
208
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
209
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
210
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
211
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
212
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
213
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
214
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
215
Name:
Anonymous
2011-07-04 7:52
OP here.
Stopped reading right there.
216
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
217
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
218
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
219
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
220
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
221
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
222
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
223
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
224
Name:
Anonymous
2011-07-04 7:53
OP here.
Stopped reading right there.
225
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
226
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
227
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
228
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
229
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
230
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
231
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
232
Name:
Anonymous
2011-07-04 7:54
OP here.
Stopped reading right there.
233
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
234
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
235
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
236
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
237
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
238
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
239
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
240
Name:
Anonymous
2011-07-04 7:55
OP here.
Stopped reading right there.
Newer Posts