Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

reg_list_specializations.hpp

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////
00002 // A supermacro to generate some partial template specializations for
00003 // s11n-proxying list-type classes.  See the various proxy files, like
00004 // std/list.hpp, for how to use it.
00005 ////////////////////////////////////////////////////////////////////////
00006 #ifndef S11N_LIST_TYPE
00007 #error "You must define S11N_LIST_TYPE before including this file. e.g., to std::list or std::vector."
00008 #endif
00009 
00010 #ifndef S11N_LIST_TYPE_NAME
00011 #error "You must define S11N_LIST_TYPE_NAME before including this file. e.g., to \"list\" or \"vector\"."
00012 #endif
00013 
00014 #ifndef S11N_LIST_TYPE_PROXY
00015 #define S11N_LIST_TYPE_PROXY ::s11n::list::serialize_list_f
00016 #endif
00017 
00018 #ifndef S11N_LIST_TYPE_DESER_PROXY
00019 #  define S11N_LIST_TYPE_DESER_PROXY ::s11n::list::deserialize_list_f
00020 #endif
00021 
00022 
00023 #include <algorithm> // for_each()
00024 namespace s11n {
00025 
00026     /**
00027        Specialization for list-compliant types.
00028     */
00029     template < typename T1 >
00030     struct S11N_EXPORT_API default_cleanup_functor< S11N_LIST_TYPE< T1 > >
00031     {
00032         typedef T1 value_type;
00033         typedef S11N_LIST_TYPE< T1 > serializable_type;
00034 
00035         /**
00036            Calls s11n::cleanup_serializable() for each
00037            item in [p.begin(),p.end()).
00038         */
00039         void operator()( serializable_type & p ) const throw()
00040         {
00041             std::for_each( p.begin(), p.end(), ::s11n::cleaner_upper() );
00042             p.clear();
00043             // well, that was easy.
00044         }
00045     };
00046 
00047 } // namespace
00048 
00049 
00050 #define S11N_TEMPLATE_TYPE S11N_LIST_TYPE
00051 #define S11N_TEMPLATE_TYPE_NAME S11N_LIST_TYPE_NAME
00052 #define S11N_TEMPLATE_TYPE_PROXY S11N_LIST_TYPE_PROXY
00053 #define S11N_TEMPLATE_TYPE_DESER_PROXY S11N_LIST_TYPE_DESER_PROXY
00054 #include <s11n.net/s11n/proxy/reg_s11n_traits_template1.hpp>
00055 #undef S11N_LIST_TYPE_DESER_PROXY
00056 #undef S11N_LIST_TYPE_PROXY
00057 #undef S11N_LIST_TYPE_NAME
00058 #undef S11N_LIST_TYPE

Generated on Mon Dec 26 15:53:17 2005 for libs11n-1.2.3 by  doxygen 1.4.4