1 #ifndef BOOST_SERIALIZATION_FACTORY_HPP
2 #define BOOST_SERIALIZATION_FACTORY_HPP
4 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
5 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
10 // factory.hpp: create an instance from an extended_type_info instance.
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13 // Use, modification and distribution is subject to the Boost Software
14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <cstddef> // NULL
22 #include <boost/preprocessor/control/if.hpp>
23 #include <boost/preprocessor/comparison/greater.hpp>
24 #include <boost/preprocessor/facilities/empty.hpp>
27 #if defined(__LIBCOMO__)
33 namespace serialization
{
35 // default implementation does nothing.
36 template<class T
, int N
>
37 T
* factory(std::va_list){
39 // throw exception here?
43 } // namespace serialization
46 #define BOOST_SERIALIZATION_FACTORY(N, T, A0, A1, A2, A3) \
48 namespace serialization { \
50 T * factory<T, N>(std::va_list ap){ \
51 BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
52 ,A0 a0 = va_arg(ap, A0); \
53 ,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
54 ,A1 a1 = va_arg(ap, A1); \
55 ,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
56 ,A2 a2 = va_arg(ap, A2); \
57 ,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
58 ,A3 a3 = va_arg(ap, A3); \
62 BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
64 ,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
66 ,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
68 ,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
78 #define BOOST_SERIALIZATION_FACTORY_4(T, A0, A1, A2, A3) \
79 BOOST_SERIALIZATION_FACTORY(4, T, A0, A1, A2, A3)
81 #define BOOST_SERIALIZATION_FACTORY_3(T, A0, A1, A2) \
82 BOOST_SERIALIZATION_FACTORY(3, T, A0, A1, A2, 0)
84 #define BOOST_SERIALIZATION_FACTORY_2(T, A0, A1) \
85 BOOST_SERIALIZATION_FACTORY(2, T, A0, A1, 0, 0)
87 #define BOOST_SERIALIZATION_FACTORY_1(T, A0) \
88 BOOST_SERIALIZATION_FACTORY(1, T, A0, 0, 0, 0)
90 #define BOOST_SERIALIZATION_FACTORY_0(T) \
91 BOOST_SERIALIZATION_FACTORY(0, T, 0, 0, 0, 0)
93 #endif // BOOST_SERIALIZATION_FACTORY_HPP