Defines
clean_serializator.hpp File Reference
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/iserializer.hpp>
#include <boost/serialization/array.hpp>
Include dependency graph for clean_serializator.hpp:

Go to the source code of this file.

Defines

#define PP_LABUST_CLEAN_ARRAY_ISERIALIZATOR_IMPL(CLASS_NAME)
#define PP_LABUST_CLEAN_ARRAY_OSERIALIZATOR_IMPL(CLASS_NAME)

Define Documentation

#define PP_LABUST_CLEAN_ARRAY_ISERIALIZATOR_IMPL (   CLASS_NAME)
Value:
namespace boost{namespace archive{namespace detail{ \
                        template<> \
struct load_array_type<CLASS_NAME> { \
        template<class T> \
        static void invoke(CLASS_NAME &ar, T &t){ \
                typedef BOOST_DEDUCED_TYPENAME remove_extent< T >::type value_type; \
                std::size_t current_count = sizeof(t) / ( \
                                static_cast<char *>(static_cast<void *>(&t[1])) \
                                - static_cast<char *>(static_cast<void *>(&t[0])) \
                ); \
                boost::serialization::collection_size_type count(current_count); \
                ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count); \
        } \
};\
}}};\

This is a specialization of the array loader to prevent writing the array length by default. It takes the generic save_array_type from the boost archive classes and comments the NVP notation.

Definition at line 74 of file clean_serializator.hpp.

#define PP_LABUST_CLEAN_ARRAY_OSERIALIZATOR_IMPL (   CLASS_NAME)
Value:
namespace boost{namespace archive{namespace detail{ \
                        template<> \
                        struct save_array_type<CLASS_NAME> \
                        { \
                        template<class T> \
                        static void invoke(CLASS_NAME &ar, const T &t){ \
                                typedef BOOST_DEDUCED_TYPENAME boost::remove_extent< T >::type value_type; \
                                boost::archive::save_access::end_preamble(ar); \
                                std::size_t c = sizeof(t) / ( \
                                                static_cast<const char *>(static_cast<const void *>(&t[1])) \
                                                - static_cast<const char *>(static_cast<const void *>(&t[0])) \
                                ); \
                                boost::serialization::collection_size_type count(c); \
                                ar << boost::serialization::make_array(static_cast<value_type const*>(&t[0]),count); \
                        } \
                        };}}};

This is a specialization of the array saver to prevent writing the array length by default. It takes the generic save_array_type from the boost archive classes and comments the NVP notation.

Definition at line 50 of file clean_serializator.hpp.



snippets
Author(s): Gyula Nagy
autogenerated on Mon Oct 6 2014 01:39:41