AvroSerialize.hh

Go to the documentation of this file.
00001 
00019 #ifndef avro_AvroSerialize_hh__
00020 #define avro_AvroSerialize_hh__
00021 
00022 #include <boost/static_assert.hpp>
00023 #include "AvroTraits.hh"
00024 
00028 
00029 namespace avro {
00030     
00033 
00034 template <typename Writer, typename T>
00035 void serialize(Writer &s, const T& val)
00036 {
00037     serialize(s, val, is_serializable<T>());
00038 }
00039 
00041 
00042 template <typename Writer, typename T>
00043 void serialize(Writer &s, const T& val, const boost::false_type &)
00044 {
00045     BOOST_STATIC_ASSERT(sizeof(T)==0);
00046 }
00047 
00049 
00050 // @{
00051 
00052 template <typename Writer, typename T>
00053 void serialize(Writer &s, T val, const boost::true_type &) {
00054     s.writeValue(val);
00055 }
00056 
00057 template <typename Writer>
00058 void serialize(Writer &s, const std::vector<uint8_t> &val, const boost::true_type &) {
00059     s.writeBytes(&val[0], val.size());
00060 }
00061 
00062 // @}
00063 
00064 } // namespace avro
00065 
00066 #endif

Generated on Thu Mar 25 14:58:22 2010 for Avro C++ by  doxygen 1.6.1