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/ ?
561
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
562
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
563
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
564
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
565
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
566
Name:
Anonymous
2011-07-04 8:34
OP here.
Stopped reading right there.
567
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
568
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
569
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
570
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
571
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
572
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
573
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
574
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
575
Name:
Anonymous
2011-07-04 8:35
OP here.
Stopped reading right there.
576
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
577
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
578
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
579
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
580
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
581
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
582
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
583
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
584
Name:
Anonymous
2011-07-04 8:36
OP here.
Stopped reading right there.
585
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
586
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
587
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
588
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
589
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
590
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
591
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
592
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
593
Name:
Anonymous
2011-07-04 8:37
OP here.
Stopped reading right there.
594
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
595
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
596
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
597
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
598
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
599
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
600
Name:
Anonymous
2011-07-04 8:38
OP here.
Stopped reading right there.
Newer Posts