diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-10-11 14:44:58 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-10-11 14:44:58 -0400 |
commit | 027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe (patch) | |
tree | 5a17059ea764321a0b6e43f1083dcd6c7db363f1 /cpp/include/Ice/StreamHelpers.h | |
parent | ICE-4829 - Certificate failure on W2003 (diff) | |
download | ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.tar.bz2 ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.tar.xz ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.zip |
Partial fix for ICE-4869: C++ stream read/write for structs (and structs-as-class)
is now generated as templates.
Removed most slice2cpp --stream uses (but not all)
Also fixed various build failures on Solaris.
Diffstat (limited to 'cpp/include/Ice/StreamHelpers.h')
-rw-r--r-- | cpp/include/Ice/StreamHelpers.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/cpp/include/Ice/StreamHelpers.h b/cpp/include/Ice/StreamHelpers.h index e075276de3d..9e69a02964e 100644 --- a/cpp/include/Ice/StreamHelpers.h +++ b/cpp/include/Ice/StreamHelpers.h @@ -275,38 +275,49 @@ struct StreamHelper<T, StreamHelperCategoryBuiltin> } }; -// Helper for structs, uses generated __read/__write methods +// "helpers" for the StreamHelper<T, StreamHelperCategoryStruct[Class]> below +// We generate specializations, which can be instantiated explicitly and exported from DLLs +// + +template<typename T, typename S> +struct StreamWriter; + +template<typename T, typename S> +struct StreamReader; + +// Helper for structs template<typename T> struct StreamHelper<T, StreamHelperCategoryStruct> { template<class S> static inline void write(S* stream, const T& v) { - v.__write(stream); + StreamWriter<T, S>::write(stream, v); } template<class S> static inline void read(S* stream, T& v) { - v.__read(stream); + StreamReader<T, S>::read(stream, v); } }; -// Helper for class structs, uses generated __read/__write methods + +// Helper for class structs template<typename T> struct StreamHelper<T, StreamHelperCategoryStructClass> { template<class S> static inline void write(S* stream, const T& v) { - v->__write(stream); + StreamWriter<T, S>::write(stream, v); } template<class S> static inline void read(S* stream, T& v) { - v = new typename T::element_type(); - v->__read(stream); + v = new typename T::element_type; + StreamReader<T, S>::read(stream, v); } }; |