Update of /cvsroot/boost/boost/boost/archive
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3001

Modified Files:
        basic_binary_iarchive.hpp basic_binary_iprimitive.hpp 
        basic_binary_oarchive.hpp basic_binary_oprimitive.hpp 
Log Message:
  


Index: basic_binary_iarchive.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/archive/basic_binary_iarchive.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- basic_binary_iarchive.hpp   1 May 2006 00:04:28 -0000       1.9
+++ basic_binary_iarchive.hpp   22 Jun 2006 07:20:23 -0000      1.10
@@ -28,10 +28,9 @@
 #include <boost/detail/workaround.hpp>
 #include <boost/pfto.hpp>
 
-#include <boost/archive/detail/common_iarchive.hpp>
 #include <boost/serialization/string.hpp>
 #include <boost/serialization/collection_size_type.hpp>
-
+#include <boost/archive/array/iarchive.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 namespace boost { 
@@ -41,7 +40,7 @@
 // class basic_binary_iarchive - read serialized objects from a input binary 
stream
 template<class Archive>
 class basic_binary_iarchive : 
-    public detail::common_iarchive<Archive>
+    public array::iarchive<Archive>
 {
 protected:
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@@ -57,11 +56,11 @@
     // fot templates in the absence of partial function 
     // template ordering. If we get here pass to base class
     // note extra nonsense to sneak it pass the borland compiers
-    typedef detail::common_iarchive<Archive> detail_common_iarchive;
+    typedef array::iarchive<Archive> array_iarchive;
     template<class T>
     void load_override(T & t, BOOST_PFTO int)
     {
-        this->detail_common_iarchive::load_override(t, 0);
+        this->array_iarchive::load_override(t, 0);
     }
     // binary files don't include the optional information 
     void load_override(class_id_optional_type & /* t */, int){}
@@ -70,41 +69,41 @@
     // for these pseudo prmitive types.
     void load_override(version_type & t, int){ 
         // upto 255 versions
-        unsigned char x;
+        unsigned char x=0;
         * this->This() >> x;
         t = version_type(x);
     }
     void load_override(class_id_type & t, int){
         // upto 32K classes
-        int_least16_t x;
+        int_least16_t x=0;
         * this->This() >> x;
         t = class_id_type(x);
     }
     void load_override(class_id_reference_type & t, int){
         // upto 32K classes
-        int_least16_t x;
+        int_least16_t x=0;
         * this->This() >> x;
         t = class_id_reference_type(x);
     }
     void load_override(object_id_type & t, int){
         // upto 2G objects
-        uint_least32_t x;
+        uint_least32_t x=0;
         * this->This() >> x;
         t = object_id_type(x);
     }
     void load_override(object_reference_type & t, int){
         // upto 2G objects
-        uint_least32_t x;
+        uint_least32_t x=0;
         * this->This() >> x;
         t = object_reference_type(x);
     }
     void load_override(tracking_type & t, int){
-        char x;
+        char x=0;
         * this->This() >> x;
         t = (0 != x);
     }
   void load_override(serialization::collection_size_type & t, int){
-       unsigned int x;
+       unsigned int x=0;
        * this->This() >> x;
        t = serialization::collection_size_type(x);
    }
@@ -115,7 +114,7 @@
     init();
    
     basic_binary_iarchive(unsigned int flags) :
-        detail::common_iarchive<Archive>(flags)
+        array_iarchive(flags)
     {}
 };
 

Index: basic_binary_iprimitive.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/archive/basic_binary_iprimitive.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- basic_binary_iprimitive.hpp 26 May 2006 21:38:16 -0000      1.10
+++ basic_binary_iprimitive.hpp 22 Jun 2006 07:20:23 -0000      1.11
@@ -48,6 +48,9 @@
 #include <boost/archive/basic_streambuf_locale_saver.hpp>
 #include <boost/archive/archive_exception.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/type_traits/is_fundamental.hpp>
+#include <boost/serialization/array.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 namespace boost { 
@@ -109,6 +112,16 @@
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
     ~basic_binary_iprimitive();
 public:
+    // we provide an optimized load for all fundamental types
+    typedef is_fundamental<mpl::_1> use_array_optimization;
+
+    // the optimized load_array dispatches to load_binary 
+    template <class ValueType>
+    void load_array(serialization::array<ValueType>& a, unsigned int)
+    {
+      load_binary(a.address(),a.count()*sizeof(ValueType));
+    }
+
     void
     load_binary(void *address, std::size_t count);
 };

Index: basic_binary_oarchive.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/archive/basic_binary_oarchive.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- basic_binary_oarchive.hpp   1 May 2006 00:04:28 -0000       1.10
+++ basic_binary_oarchive.hpp   22 Jun 2006 07:20:23 -0000      1.11
@@ -27,9 +27,10 @@
 #include <boost/pfto.hpp>
 
 #include <boost/detail/workaround.hpp>
-#include <boost/archive/detail/common_oarchive.hpp>
+#include <boost/archive/array/oarchive.hpp>
 #include <boost/serialization/string.hpp>
 #include <boost/serialization/collection_size_type.hpp>
+#include <boost/archive/array/oarchive.hpp>
 
 namespace boost {
 namespace archive {
@@ -47,7 +48,7 @@
 // class basic_text_iarchive - read serialized objects from a input text stream
 template<class Archive>
 class basic_binary_oarchive : 
-    public detail::common_oarchive<Archive>
+    public array::oarchive<Archive>
 {
 protected:
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@@ -60,10 +61,10 @@
     friend class detail::interface_oarchive<Archive>;
 #endif
     // any datatype not specifed below will be handled by base class
-    typedef detail::common_oarchive<Archive> detail_common_oarchive;
+    typedef array::oarchive<Archive> array_oarchive;
     template<class T>
     void save_override(T & t, BOOST_PFTO int){
-        this->detail_common_oarchive::save_override(t, 0);
+        this->array_oarchive::save_override(t, 0);
     }
     // binary files don't include the optional information 
     void save_override(const class_id_optional_type & /* t */, int){}
@@ -115,7 +116,7 @@
     init();
 
     basic_binary_oarchive(unsigned int flags) :
-        detail::common_oarchive<Archive>(flags)
+        array_oarchive(flags)
     {}
 };
 

Index: basic_binary_oprimitive.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/archive/basic_binary_oprimitive.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- basic_binary_oprimitive.hpp 8 Feb 2006 13:43:39 -0000       1.10
+++ basic_binary_oprimitive.hpp 22 Jun 2006 07:20:23 -0000      1.11
@@ -46,6 +46,9 @@
 #include <boost/archive/basic_streambuf_locale_saver.hpp>
 #include <boost/archive/archive_exception.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/type_traits/is_fundamental.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/serialization/array.hpp>
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 namespace boost {
@@ -101,6 +104,7 @@
 
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
     init();
+    
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
     basic_binary_oprimitive(
         std::basic_streambuf<Elem, Tr> & sb, 
@@ -109,6 +113,16 @@
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) 
     ~basic_binary_oprimitive();
 public:
+    // we provide an optimized save for all fundamental types
+    typedef is_fundamental<mpl::_1> use_array_optimization;
+
+    // the optimized save_array dispatches to save_binary 
+    template <class ValueType>
+    void save_array(serialization::array<ValueType> const& a, unsigned int)
+    {
+      save_binary(a.address(),a.count()*sizeof(ValueType));
+    }
+
     void save_binary(const void *address, std::size_t count);
 };
 


All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to