QxOrm  1.4.3
C++ Object Relational Mapping library
QxSerialize_std_tuple.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** http://www.qxorm.com/
00004 ** Copyright (C) 2013 Lionel Marty (contact@qxorm.com)
00005 **
00006 ** This file is part of the QxOrm library
00007 **
00008 ** This software is provided 'as-is', without any express or implied
00009 ** warranty. In no event will the authors be held liable for any
00010 ** damages arising from the use of this software
00011 **
00012 ** Commercial Usage
00013 ** Licensees holding valid commercial QxOrm licenses may use this file in
00014 ** accordance with the commercial license agreement provided with the
00015 ** Software or, alternatively, in accordance with the terms contained in
00016 ** a written agreement between you and Lionel Marty
00017 **
00018 ** GNU General Public License Usage
00019 ** Alternatively, this file may be used under the terms of the GNU
00020 ** General Public License version 3.0 as published by the Free Software
00021 ** Foundation and appearing in the file 'license.gpl3.txt' included in the
00022 ** packaging of this file. Please review the following information to
00023 ** ensure the GNU General Public License version 3.0 requirements will be
00024 ** met : http://www.gnu.org/copyleft/gpl.html
00025 **
00026 ** If you are unsure which license is appropriate for your use, or
00027 ** if you have questions regarding the use of this file, please contact :
00028 ** contact@qxorm.com
00029 **
00030 ****************************************************************************/
00031 
00032 #ifdef _QX_ENABLE_BOOST_SERIALIZATION
00033 #ifdef _QX_CPP_11_TUPLE
00034 #ifndef BOOST_NO_CXX11_HDR_TUPLE
00035 #ifndef _QX_SERIALIZE_STD_TUPLE_H_
00036 #define _QX_SERIALIZE_STD_TUPLE_H_
00037 
00038 #ifdef _MSC_VER
00039 #pragma once
00040 #endif
00041 
00042 #include <boost/serialization/serialization.hpp>
00043 #include <boost/serialization/split_free.hpp>
00044 #include <boost/serialization/nvp.hpp>
00045 
00046 #include <tuple>
00047 
00048 namespace boost {
00049 namespace serialization {
00050 
00051 template <class Archive, typename T0, typename T1>
00052 inline void serialize(Archive & ar, std::tuple<T0, T1> & t, const unsigned int file_version)
00053 {
00054    Q_UNUSED(file_version);
00055    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00056    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00057 }
00058 
00059 template <class Archive, typename T0, typename T1, typename T2>
00060 inline void serialize(Archive & ar, std::tuple<T0, T1, T2> & t, const unsigned int file_version)
00061 {
00062    Q_UNUSED(file_version);
00063    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00064    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00065    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00066 }
00067 
00068 template <class Archive, typename T0, typename T1, typename T2, typename T3>
00069 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3> & t, const unsigned int file_version)
00070 {
00071    Q_UNUSED(file_version);
00072    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00073    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00074    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00075    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00076 }
00077 
00078 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4>
00079 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4> & t, const unsigned int file_version)
00080 {
00081    Q_UNUSED(file_version);
00082    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00083    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00084    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00085    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00086    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00087 }
00088 
00089 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
00090 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4, T5> & t, const unsigned int file_version)
00091 {
00092    Q_UNUSED(file_version);
00093    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00094    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00095    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00096    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00097    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00098    ar & boost::serialization::make_nvp("tuple_6", std::get<5>(t));
00099 }
00100 
00101 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
00102 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4, T5, T6> & t, const unsigned int file_version)
00103 {
00104    Q_UNUSED(file_version);
00105    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00106    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00107    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00108    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00109    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00110    ar & boost::serialization::make_nvp("tuple_6", std::get<5>(t));
00111    ar & boost::serialization::make_nvp("tuple_7", std::get<6>(t));
00112 }
00113 
00114 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
00115 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7> & t, const unsigned int file_version)
00116 {
00117    Q_UNUSED(file_version);
00118    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00119    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00120    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00121    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00122    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00123    ar & boost::serialization::make_nvp("tuple_6", std::get<5>(t));
00124    ar & boost::serialization::make_nvp("tuple_7", std::get<6>(t));
00125    ar & boost::serialization::make_nvp("tuple_8", std::get<7>(t));
00126 }
00127 
00128 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
00129 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> & t, const unsigned int file_version)
00130 {
00131    Q_UNUSED(file_version);
00132    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00133    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00134    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00135    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00136    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00137    ar & boost::serialization::make_nvp("tuple_6", std::get<5>(t));
00138    ar & boost::serialization::make_nvp("tuple_7", std::get<6>(t));
00139    ar & boost::serialization::make_nvp("tuple_8", std::get<7>(t));
00140    ar & boost::serialization::make_nvp("tuple_9", std::get<8>(t));
00141 }
00142 
00143 template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
00144 inline void serialize(Archive & ar, std::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> & t, const unsigned int file_version)
00145 {
00146    Q_UNUSED(file_version);
00147    ar & boost::serialization::make_nvp("tuple_1", std::get<0>(t));
00148    ar & boost::serialization::make_nvp("tuple_2", std::get<1>(t));
00149    ar & boost::serialization::make_nvp("tuple_3", std::get<2>(t));
00150    ar & boost::serialization::make_nvp("tuple_4", std::get<3>(t));
00151    ar & boost::serialization::make_nvp("tuple_5", std::get<4>(t));
00152    ar & boost::serialization::make_nvp("tuple_6", std::get<5>(t));
00153    ar & boost::serialization::make_nvp("tuple_7", std::get<6>(t));
00154    ar & boost::serialization::make_nvp("tuple_8", std::get<7>(t));
00155    ar & boost::serialization::make_nvp("tuple_9", std::get<8>(t));
00156    ar & boost::serialization::make_nvp("tuple_10", std::get<9>(t));
00157 }
00158 
00159 } // namespace boost
00160 } // namespace serialization
00161 
00162 #endif // _QX_SERIALIZE_STD_TUPLE_H_
00163 #endif // BOOST_NO_CXX11_HDR_TUPLE
00164 #endif // _QX_CPP_11_TUPLE
00165 #endif // _QX_ENABLE_BOOST_SERIALIZATION