<commit_before>/// @file detail/pack_vector.h
/// 
/// The implementation to pack dynamically sized field in a message buffer.
/// 
/// The MIT License(MIT)
/// @copyright 2014 <NAME>
//  ****************************************************************************
#ifndef PACK_VECTOR_H_INCLUDED
#define PACK_VECTOR_H_INCLUDED
//  Private Usage Include Guard ************************************************
//  Only allow this header file to be included through pack_message.h
#ifndef PACK_MESSAGE_H_INCLUDED
# error Do not include this file directly. Use <detail/pack_message.h> instead
#endif

namespace Hg
{

namespace detail
{

//  Forward Declarations *******************************************************
template< typename ValueT,
          typename BufferT
        >
size_t SerializeInBulk( ValueT&, size_t, BufferT&, size_t);

template< typename ValueT,
          typename BufferT
        >
size_t SerializeByItem( ValueT&, size_t, BufferT&, size_t);



//  ****************************************************************************
//  Exports data from the vector for fixed-size POD types.
//
template< typename ValueT,
          typename AllocatorT,
          typename BufferT,
          typename TraitT
        >
struct Serializer
{
  typedef typename
    std::vector<ValueT, 
                AllocatorT>             vector_type;
  typedef typename
    vector_type::value_type             value_type;

  typedef BufferT                       buffer_type;

  typedef TraitT                        data_type_trait;

  //  **************************************************************************
  template <typename TraitT>
  size_t Write( vector_type  &value, 
                size_t        count, 
                buffer_type  &buffer,
                size_t        offset)
  {
    value_type *pFirst = &value[0];
    value_type *pLast  = pFirst;
    std::advance(pLast, count);
    buffer.set_range( pFirst, 
                      pLast, 
                      offset);

    return count * sizeof(value_type);
  }

<commit_msg>Corrected original dynamic tests<commit_after>/// @file detail/pack_vector.h
/// 
/// The implementation to pack dynamically sized field in a message buffer.
/// 
/// The MIT License(MIT)
/// @copyright 2014 <NAME>
//  ****************************************************************************
#ifndef PACK_VECTOR_H_INCLUDED
#define PACK_VECTOR_H_INCLUDED
//  Private Usage Include Guard ************************************************
//  Only allow this header file to be included through pack_message.h
#ifndef PACK_MESSAGE_H_INCLUDED
# error Do not include this file directly. Use <detail/pack_message.h> instead
#endif

namespace Hg
{

namespace detail
{

//  Forward Declarations *******************************************************
template< typename ValueT,
          typename BufferT
        >
size_t SerializeInBulk( ValueT&, size_t, BufferT&, size_t);

template< typename ValueT,
          typename BufferT
        >
size_t SerializeByItem( ValueT&, size_t, BufferT&, size_t);



//  ****************************************************************************
//  Exports data from the vector for fixed-size POD types.
//
template< typename ValueT,
          typename AllocatorT,
          typename BufferT,
          typename TraitT
        >
struct Serializer
{
  typedef typename
    std::vector<ValueT, 
                AllocatorT>             vector_type;
  typedef typename
    vector_type::value_type             value_type;

  typedef BufferT                       buffer_type;

  typedef TraitT                        data_type_trait;

  //  **************************************************************************
  template <typename TraitT>
  size_t Write( vector_type  &value, 
                size_t        count, 
                buffer_type  &buffer,
                size_t        offset)
  {
    // TODO: Currently it appears that the full-length in bytes is required 
    //       rather than the count, like an iterator would require.
    //       Revisit and verify this is correct.
    size_t size = count * sizeof(value_type);


    value_type *pFirst = &value[0];
    value_type *pLast  = pFirst;
    std::advance(pLast, size);
    buffer.set_range( pFirst, 
                      pLast, 
                      offset);

    return size;
  }


{'fraction_non_alphanumeric': 0.2175819104753115, 'fraction_numerical': 0.0023073373327180432, 'mean_word_length': 2.6459209419680403, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, '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': '5283935', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1091, 'n_words': 316}