Boost logo

Boost-Commit :

From: ramey_at_[hidden]
Date: 2007-12-22 21:06:32


Author: ramey
Date: 2007-12-22 21:06:32 EST (Sat, 22 Dec 2007)
New Revision: 42256
URL: http://svn.boost.org/trac/boost/changeset/42256

Log:
Corrections to address TRAK tickets
Added:
   branches/serialization_next_release/boost/boost/serialization/factory.hpp (contents, props changed)

Added: branches/serialization_next_release/boost/boost/serialization/factory.hpp
==============================================================================
--- (empty file)
+++ branches/serialization_next_release/boost/boost/serialization/factory.hpp 2007-12-22 21:06:32 EST (Sat, 22 Dec 2007)
@@ -0,0 +1,84 @@
+#ifndef BOOST_SERIALIZATION_FACTORY_HPP
+#define BOOST_SERIALIZATION_FACTORY_HPP
+
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// MS compatible compilers support #pragma once
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+// factory.hpp: create an instance from an extended_type_info instance.
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <cstdarg>
+
+#include <boost/preprocessor/control/if.hpp>
+#include <boost/preprocessor/comparison/greater.hpp>
+#include <boost/preprocessor/facilities/empty.hpp>
+
+namespace std{
+ #if defined(__LIBCOMO__)
+ using ::va_list;
+ #endif
+} // namespace std
+
+namespace boost {
+namespace serialization {
+
+// default implementation does nothing.
+template<class T, int N>
+T * factory(std::va_list){
+ assert(false);
+ // throw exception here?
+ return NULL;
+}
+
+} // namespace serialization
+} // namespace boost
+
+#define BOOST_SERIALIZATION_FACTORY(N, T, A0, A1, A2, A4) \
+namespace boost { \
+namespace serialization { \
+ template<> \
+ T * factory<T, N>(std::va_list ap){ \
+ return new T( \
+ BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
+ ,va_arg(ap, A0) \
+ ,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
+ ,va_arg(ap, A1) \
+ ,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
+ ,va_arg(ap, A2) \
+ ,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
+ ,va_arg(ap, A3) \
+ ,BOOST_PP_IF(BOOST_PP_GREATER(N,4) \
+ ,va_arg(ap, A4) \
+ ,BOOST_PP_EMPTY() \
+ ))))) \
+ ); \
+ } \
+} \
+} \
+/**/
+
+#define BOOST_SERIALIZATION_FACTORY_4(T, A0, A1, A2, A4) \
+ BOOST_SERIALIZATION_FACTORY(4, T, A0, A1, A2, A4)
+
+#define BOOST_SERIALIZATION_FACTORY_3(T, A0, A1, A2) \
+ BOOST_SERIALIZATION_FACTORY(3, T, A0, A1, A2, 0)
+
+#define BOOST_SERIALIZATION_FACTORY_2(T, A0, A1, A2) \
+ BOOST_SERIALIZATION_FACTORY(2, T, A0, A1, 0, 0)
+
+#define BOOST_SERIALIZATION_FACTORY_1(T, A0, A1, A2) \
+ BOOST_SERIALIZATION_FACTORY(1, T, A0, 0, 0, 0)
+
+#define BOOST_SERIALIZATION_FACTORY_0(T) \
+ BOOST_SERIALIZATION_FACTORY(0, T, 0, 0, 0, 0)
+
+#endif // BOOST_SERIALIZATION_FACTORY_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk