<commit_before>/// @file
/// @author uentity
/// @date 12.01.2016
/// @brief 
/// @copyright
/// This Source Code Form is subject to the terms of the Mozilla Public License,
/// v. 2.0. If a copy of the MPL was not distributed with this file,
/// You can obtain one at https://mozilla.org/MPL/2.0/

#include <bs/compat/serialize.h>
#include <bs/compat/array_serialize.h>
#ifdef BSPY_EXPORTING
#include <bs/python/nparray_serialize.h>
#endif

#include <boost/serialization/export.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
// instantiate code for text archives for compatibility reason
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>

#define BS_ARRAY_EXPORT(T, cont_traits) \
BLUE_SKY_TYPE_SERIALIZE_IMPL_EXT(blue_sky::bs_array, 2, (T, blue_sky::cont_traits))

using namespace blue_sky;
namespace boser = boost::serialization;

/*-----------------------------------------------------------------
 * serialize bs_array
 *----------------------------------------------------------------*/
BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(save, bs_array, 2, (class, template< class > class))
	typedef typename type::const_iterator citerator;
	// save array size
	const ulong sz = t.size();
	ar << sz;
	// save data
	for(citerator pd = t.begin(), end = t.end(); pd != end; ++pd)
		ar << *pd;
BLUE_SKY_CLASS_SRZ_FCN_END

BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(load, bs_array, 2, (class, template< class > class))
	typedef typename type::iterator iterator;
	// restore size
	ulong sz;
	ar >> sz;
	t.resize(sz);
	// restore data
	for(iterator pd = t.begin(), end = t.end(); pd != end; ++pd)
		ar >> *pd;
BLUE_SKY_CLASS_SRZ_FCN_END

BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(serialize, blue_sky::bs_array, 2, (class, template< class > class))
	// invoke serialization of base class first
	typedef typename type::base_t base_t;
	ar & boser::base_object< base_t, type >(t);

	// split
	boser::split_free(ar, t, version);
BLUE_SKY_CLASS_SRZ_FCN_END<commit_msg>array: remove ambuguity in serialization code<commit_after>/// @file
/// @author uentity
/// @date 12.01.2016
/// @brief 
/// @copyright
/// This Source Code Form is subject to the terms of the Mozilla Public License,
/// v. 2.0. If a copy of the MPL was not distributed with this file,
/// You can obtain one at https://mozilla.org/MPL/2.0/

#include <bs/compat/serialize.h>
#include <bs/compat/array_serialize.h>
#ifdef BSPY_EXPORTING
#include <bs/python/nparray_serialize.h>
#endif

#include <boost/serialization/export.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/export.hpp>
#include <boost/serialization/string.hpp>
// instantiate code for text archives for compatibility reason
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>

#define BS_ARRAY_EXPORT(T, cont_traits) \
BLUE_SKY_TYPE_SERIALIZE_IMPL_EXT(blue_sky::bs_array, 2, (T, blue_sky::cont_traits))

using namespace blue_sky;
namespace boser = boost::serialization;

/*-----------------------------------------------------------------
 * serialize bs_array
 *----------------------------------------------------------------*/
BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(save, bs_array, 2, (class, template< class > class))
	//typedef typename type::const_iterator citerator;
	// save array size
	const ulong sz = t.size();
	ar << sz;
	// save data
	//for(citerator pd = t.begin(), end = t.end(); pd != end; ++pd)
	for(const auto& v : t)
		ar << v;
BLUE_SKY_CLASS_SRZ_FCN_END

BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(load, bs_array, 2, (class, template< class > class))
	//typedef typename type::iterator iterator;
	// restore size
	ulong sz;
	ar >> sz;
	t.resize(sz);
	// restore data
	//for(iterator pd = t.begin(), end = t.end(); pd != end; ++pd)
	for(auto& v : t)
		ar >> v;
BLUE_SKY_CLASS_SRZ_FCN_END

BLUE_SKY_CLASS_SRZ_FCN_BEGIN_EXT(serialize, blue_sky::bs_array, 2, (class, template< class > class))
	// invoke serialization of base class first
	typedef typename type::base_t base_t;
	ar & boser::base_object< base_t, type >(t);

	// split
	boser::split_free(ar, t, version);
BLUE_SKY_CLASS_SRZ_FCN_END
{'fraction_non_alphanumeric': 0.18950646861523718, 'fraction_numerical': 0.007666506947771922, 'mean_word_length': 3.436769394261424, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4115086', 'n_tokens_mistral': 1509, 'n_tokens_neox': 1430, 'n_words': 365}