<commit_before>/*
 * \copyright Copyright 2014 <NAME> All Rights Reserved.
 * \license @{
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @}
 */

#ifndef THUNDER_SERIALIZER_HPP
#define THUNDER_SERIALIZER_HPP

#include <fstream>
#include <sstream>

#include "thunder/serializer/binary_protocol.hpp"
#include "thunder/serializer/serializer.hpp"
#include "thunder/serializer/static.hpp"
#include "thunder/serializer/text_protocol.hpp"

namespace thunder {

template < typename P = serializer::TextProtocol< ::std::stringstream > >
using Serializer = serializer::Serializer< P >;

template < typename M = ::std::stringstream >
using BinarySerializer = Serializer< serializer::BinaryProtocol< M > >;
typedef BinarySerializer< ::std::stringstream > StringBinarySerializer;
typedef BinarySerializer< ::std::fstream > FileBinarySerializer;

template < typename M = ::std::stringstream >
using TextSerializer = Serializer< serializer::TextProtocol< M > >;
typedef TextSerializer< ::std::stringstream > StringTextSerializer;
typedef TextSerializer< ::std::fstream > FileTextSerializer;

}  // namespace thunder

#endif  // THUNDER_SERIALIZER_HPP<commit_msg>Added extern template specialization for serializer<commit_after>/*
 * \copyright Copyright 2014 <NAME> All Rights Reserved.
 * \license @{
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @}
 */

#ifndef THUNDER_SERIALIZER_HPP
#define THUNDER_SERIALIZER_HPP

#include <fstream>
#include <sstream>

#include "thunder/serializer/binary_protocol.hpp"
#include "thunder/serializer/serializer.hpp"
#include "thunder/serializer/static.hpp"
#include "thunder/serializer/text_protocol.hpp"

namespace thunder {

template < typename P = serializer::TextProtocol< ::std::stringstream > >
using Serializer = serializer::Serializer< P >;

template < typename M = ::std::stringstream >
using BinarySerializer = Serializer< serializer::BinaryProtocol< M > >;
typedef BinarySerializer< ::std::stringstream > StringBinarySerializer;
typedef BinarySerializer< ::std::fstream > FileBinarySerializer;

template < typename M = ::std::stringstream >
using TextSerializer = Serializer< serializer::TextProtocol< M > >;
typedef TextSerializer< ::std::stringstream > StringTextSerializer;
typedef TextSerializer< ::std::fstream > FileTextSerializer;

}  // namespace thunder

namespace thunder {
namespace serializer {

extern template class BinaryProtocol< ::std::stringstream >;
extern template class BinaryProtocol< ::std::fstream >;
extern template class TextProtocol< ::std::stringstream >;
extern template class TextProtocol< ::std::fstream >;

extern template class Serializer< BinaryProtocol< ::std::stringstream > >;
extern template class Serializer< BinaryProtocol< ::std::fstream > >;
extern template class Serializer< TextProtocol< ::std::stringstream > >;
extern template class Serializer< TextProtocol< ::std::fstream > >;

#define THUNDER_SERIALIZER_INSTANTIATE_STRINGSTREAM_CONSTRUCTOR(P)      \
  extern template Serializer< P >::Serializer();                        \
  extern template Serializer< P >::Serializer(::std::ios_base::openmode mode); \
  extern template Serializer< P >::Serializer(const ::std::string &str); \
  extern template Serializer< P >::Serializer(                          \
      const ::std::string &str, ::std::ios_base::openmode mode);

THUNDER_SERIALIZER_INSTANTIATE_STRINGSTREAM_CONSTRUCTOR(
    BinaryProtocol< ::std::stringstream >);
THUNDER_SERIALIZER_INSTANTIATE_STRINGSTREAM_CONSTRUCTOR(
    TextProtocol< ::std::stringstream >);

#undef THUNDER_SERIALIZER_INSTANTIATE_STRINGSTREAM_CONSTRUCTOR

#define THUNDER_SERIALIZER_INSTANTIATE_FSTREAM_CONSTRUCTOR(P)           \
  extern template Serializer< P >::Serializer();                        \
  extern template Serializer< P >::Serializer(const char * filename);   \
  extern template Serializer< P >::Serializer(                          \
      const char * filename, ::std::ios_base::openmode mode);           \
  extern template Serializer< P >::Serializer(const ::std::string &filename); \
  extern template Serializer< P >::Serializer(                          \
      const ::std::string &filename, ::std::ios_base::openmode mode);

THUNDER_SERIALIZER_INSTANTIATE_FSTREAM_CONSTRUCTOR(
    BinaryProtocol< ::std::fstream >);
THUNDER_SERIALIZER_INSTANTIATE_FSTREAM_CONSTRUCTOR(
    TextProtocol< ::std::fstream >);

#undef THUNDER_SERIALIZER_INSTANTIATE_FSTREAM_CONSTRUCTOR

}  // namespace serializer
}  // namespace thunder

#endif  // THUNDER_SERIALIZER_HPP
{'fraction_non_alphanumeric': 0.10503440782325245, 'fraction_numerical': 0.002897500905469033, 'mean_word_length': 4.932330827067669, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4549214', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1523, 'n_words': 447}