Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef avro_AvroSerialize_hh__
00020 #define avro_AvroSerialize_hh__
00021 
00022 #include "Config.hh"
00023 #include <boost/static_assert.hpp>
00024 #include "AvroTraits.hh"
00025 
00029 
00030 namespace avro {
00031     
00034 
00035 template <typename Writer, typename T>
00036 void serialize(Writer &s, const T& val)
00037 {
00038     serialize(s, val, is_serializable<T>());
00039 }
00040 
00042 
00043 template <typename Writer, typename T>
00044 void serialize(Writer &s, const T& val, const boost::false_type &)
00045 {
00046     BOOST_STATIC_ASSERT(sizeof(T)==0);
00047 }
00048 
00050 
00051 
00052 
00053 template <typename Writer, typename T>
00054 void serialize(Writer &s, T val, const boost::true_type &) {
00055     s.writeValue(val);
00056 }
00057 
00058 template <typename Writer>
00059 void serialize(Writer &s, const std::vector<uint8_t> &val, const boost::true_type &) {
00060     s.writeBytes(&val[0], val.size());
00061 }
00062 
00063 
00064 
00065 } 
00066 
00067 #endif