Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57625 - in sandbox/statistics/detail/fusion/boost/statistics/detail/fusion: map/serialization serialization
From: erwann.rogard_at_[hidden]
Date: 2009-11-12 21:57:34


Author: e_r
Date: 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
New Revision: 57625
URL: http://svn.boost.org/trac/boost/changeset/57625

Log:
a/d
Added:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/include.hpp (contents, props changed)
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/loader.hpp (contents, props changed)
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/saver.hpp (contents, props changed)
Removed:
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/include.hpp
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/loader.hpp
   sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/saver.hpp

Deleted: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/include.hpp
==============================================================================
--- sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/include.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
+++ (empty file)
@@ -1,15 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// detail::fusion::map::serialization::include.hpp //
-// //
-// (C) Copyright 2009 Erwann Rogard //
-// Use, modification and distribution are 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) //
-//////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_INCLUDE_HPP_ER_2009
-#define BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_INCLUDE_HPP_ER_2009
-
-#include <boost/statistics/detail/fusion/map/serialization/loader.hpp>
-#include <boost/statistics/detail/fusion/map/serialization/saver.hpp>
-
-#endif
\ No newline at end of file

Deleted: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/loader.hpp
==============================================================================
--- sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/loader.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
+++ (empty file)
@@ -1,51 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// detail::fusion::map::serialization::loader.hpp //
-// //
-//////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_LOADER_HPP_ER_2009
-#define BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_LOADER_HPP_ER_2009
-#include <boost/fusion/support/pair.hpp>
-#include <boost/fusion/include/pair.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/fusion/include/for_each.hpp>
-
-namespace boost{
-namespace statistics{
-namespace detail{
-namespace fusion{
-namespace map{
-
-// Implementation is suggested here
-// http://www.boost.org/doc/libs/1_40_0/libs/fusion/doc/html/fusion/quick_start.html
-// under AssociativeContainer
-template<typename Ia>
-struct loader
-{
-
- loader(Ia& ar):ar_(ar){}
- loader(const loader& that):ar_(that.ar_){}
-
- template <typename Pair>
- void operator()(Pair& data) const
- {
- (this->ar_ >> data.second);
- }
-
- private:
- Ia& ar_;
-};
-
-template <typename Stuff,typename Ia>
-void load(Stuff & stuff, Ia& ar)
-{
- typedef loader<Ia> loader_;
- boost::fusion::for_each(stuff, loader_(ar));
-}
-
-}// map
-}// fusion
-}// detail
-}// statistics
-}// boost
-
-#endif
\ No newline at end of file

Deleted: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/saver.hpp
==============================================================================
--- sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/map/serialization/saver.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
+++ (empty file)
@@ -1,52 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-// detail::fusion::map::serialization::saver.hpp //
-// //
-//////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_SAVER_HPP_ER_2009
-#define BOOST_STATISTICS_DETAIL_FUSION_MAP_SERIALIZATION_SAVER_HPP_ER_2009
-#include <boost/fusion/support/pair.hpp>
-#include <boost/fusion/include/pair.hpp>
-#include <boost/fusion/algorithm/iteration/for_each.hpp>
-#include <boost/fusion/include/for_each.hpp>
-
-namespace boost{
-namespace statistics{
-namespace detail{
-namespace fusion{
-namespace map{
-
-// Implementation is suggested here
-// http://www.boost.org/doc/libs/1_40_0/libs/fusion/doc/html/fusion/quick_start.html
-// under AssociativeContainer
-template<typename Oa>
-struct saver
-{
-
- saver(Oa& ar):ar_(ar){}
- saver(const saver& that):ar_(that.ar_){}
-
- template <typename Pair>
- void operator()(Pair const& data) const
- {
- this->ar_ << data.second;
- }
-
- private:
- Oa& ar_;
-};
-
-template <typename Stuff,typename Oa>
-void save(Stuff const& stuff,Oa& ar)
-{
- typedef saver<Oa> saver_;
- boost::fusion::for_each(stuff, saver_(ar));
-}
-
-
-}// map
-}// fusion
-}// detail
-}// statistics
-}// boost
-
-#endif
\ No newline at end of file

Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/include.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/include.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
@@ -0,0 +1,15 @@
+//////////////////////////////////////////////////////////////////////////////
+// detail::fusion::map::serialization::include.hpp //
+// //
+// (C) Copyright 2009 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_INCLUDE_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_INCLUDE_HPP_ER_2009
+
+#include <boost/statistics/detail/fusion/serialization/saver.hpp>
+#include <boost/statistics/detail/fusion/serialization/loader.hpp>
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/loader.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/loader.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
@@ -0,0 +1,81 @@
+//////////////////////////////////////////////////////////////////////////////
+// detail::fusion::map::serialization::loader.hpp //
+// //
+// (C) Copyright 2009 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_LOADER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_LOADER_HPP_ER_2009
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/tag_of.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace serialization{
+
+// Implementation follows from
+// http://www.boost.org/doc/libs/1_40_0/libs/fusion/doc/html/fusion/quick_start.html
+// under AssociativeContainer
+template<typename Ia>
+struct loader
+{
+
+ loader(Ia& ar):ar_(ar){}
+ loader(const loader& that):ar_(that.ar_){}
+
+ // TODO overload with any other non sequence fusion data structure
+
+ template <typename F,typename S>
+ void operator()(boost::fusion::pair<F,S> & data) const
+ {
+ (*this)(data.second);
+ }
+
+ template <typename S>
+ typename boost::enable_if<
+ boost::fusion::traits::is_sequence<S>,
+ void
+ >::type
+ operator()(S& seq) const
+ {
+ boost::fusion::for_each(seq,(*this));
+ }
+
+ template <typename T>
+ typename boost::enable_if<
+ boost::is_same<
+ typename boost::fusion::detail::tag_of<T>::type,
+ boost::fusion::non_fusion_tag
+ >,
+ void
+ >::type
+ operator()(T& serializable_item) const
+ {
+ // TODO test serialazable concept
+
+ (this->ar_ >> serializable_item);
+ }
+
+ private:
+ Ia& ar_;
+};
+
+template<typename Ia>
+loader<Ia> make_loader(Ia& ar){ return loader<Ia>(ar); }
+
+}// serialization
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
\ No newline at end of file

Added: sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/saver.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/detail/fusion/boost/statistics/detail/fusion/serialization/saver.hpp 2009-11-12 21:57:33 EST (Thu, 12 Nov 2009)
@@ -0,0 +1,87 @@
+//////////////////////////////////////////////////////////////////////////////
+// detail::fusion::map::serialization::saver.hpp //
+// //
+// (C) Copyright 2009 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_SAVER_HPP_ER_2009
+#define BOOST_STATISTICS_DETAIL_FUSION_SERIALIZATION_SAVER_HPP_ER_2009
+#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/include/pair.hpp>
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/tag_of.hpp>
+
+namespace boost{
+namespace statistics{
+namespace detail{
+namespace fusion{
+namespace serialization{
+
+// Implementation follows from
+// http://www.boost.org/doc/libs/1_40_0/libs/fusion/doc/html/fusion/quick_start.html
+// under AssociativeContainer
+template<typename Oa>
+struct saver
+{
+
+ saver(Oa& ar):ar_(ar){}
+ saver(const saver& that):ar_(that.ar_){}
+
+ // TODO overload with any other non sequence fusion data structure
+
+ template <typename F,typename S>
+ void operator()(const boost::fusion::pair<F,S>& data)const
+ {
+ (*this)(data.second);
+ }
+
+ template <typename S>
+ typename boost::enable_if<
+ boost::fusion::traits::is_sequence<S>,
+ void
+ >::type
+ operator()(const S& seq)const
+ {
+ boost::fusion::for_each(seq,(*this));
+ }
+
+ template <typename T>
+ typename boost::enable_if<
+ boost::is_same<
+ typename boost::fusion::detail::tag_of<T>::type,
+ boost::fusion::non_fusion_tag
+ >,
+ void
+ >::type
+ operator()(const T& serializable_item)const
+ {
+ // TODO test serialazable concept
+
+ this->ar_ << serializable_item;
+ }
+
+ private:
+ mutable Oa& ar_;
+};
+
+template<typename Oa>
+saver<Oa>
+make_saver(Oa& ar){ return saver<Oa>(ar); }
+
+}// serialization
+}// fusion
+}// detail
+}// statistics
+}// boost
+
+#endif
+
+
+
+
+


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