oss_src/sframe/sarray_v2_type_encoding.cpp
static void encode_vector(block_info& info, 
                          oarchive& oarc, 
                          const std::vector<flexible_type>& data) {
  char reserved = VECTOR_RESERVED_FLAGS::NEW_ENCODING;
  oarc.write(&(reserved), sizeof(reserved));
  // length of each vector
  std::vector<flexible_type> lengths;
  // values of all the vectors concatted together
  std::vector<flexible_type> values;

  for (size_t i = 0;i < data.size(); ++i) {
    if (data[i].get_type() != flex_type_enum::UNDEFINED) {
      const flex_vec& vals = data[i].get<flex_vec>();
      lengths.push_back(vals.size());
      for (const double d: vals) {
        values.push_back(d);
      }
    }
  }
  encode_number(info, oarc, lengths);
  encode_double(info, oarc, values);
}
/**
 * Encodes a collection of vectors in data, skipping all UNDEFINED values.
 *
 *  - encode a list of integers with all the vector lengths
 *  - encode a list of all the doubles
 *
 * \note The coding does not store the number of values stored. The decoder
 * \ref decode_vector() requires the number of values to decode correctly.
 */
Encodes a collection of vectors in data, skipping all UNDEFINED values.
- encode a list of integers with all the vector lengths
- encode a list of all the doubles

\note The coding does not store the number of values stored. The decoder
\ref decode_vector() requires the number of values to decode correctly.
Encodes a collection of vectors in data skipping all UNDEFINED values . - encode a list of integers with all the vector lengths - encode a list of all the doubles \ note The coding does not store the number of values stored . The decoder \ ref decode_vector () requires the number of values to decode correctly .
static void encode_vector(block_info& info, 
                          oarchive& oarc, 
                          const std::vector<flexible_type>& data) {
  char reserved = VECTOR_RESERVED_FLAGS::NEW_ENCODING;
  oarc.write(&(reserved), sizeof(reserved));
  std::vector<flexible_type> lengths;
  std::vector<flexible_type> values;
  for (size_t i = 0;i < data.size(); ++i) {
    if (data[i].get_type() != flex_type_enum::UNDEFINED) {
      const flex_vec& vals = data[i].get<flex_vec>();
      lengths.push_back(vals.size());
      for (const double d: vals) {
        values.push_back(d);
      }
    }
  }
  encode_number(info, oarc, lengths);
  encode_double(info, oarc, values);
}
static void encode_vector ( block_info & info , oarchive & oarc , const std :: vector < flexible_type > & data ) { char reserved = VECTOR_RESERVED_FLAGS :: NEW_ENCODING ; oarc . write ( & ( reserved ) , sizeof ( reserved ) ) ; std :: vector < flexible_type > lengths ; std :: vector < flexible_type > values ; for ( size_t i = 0 ; i < data . size ( ) ; ++ i ) { if ( data [ i ] . get_type ( ) != flex_type_enum :: UNDEFINED ) { const flex_vec & vals = data [ i ] . get < flex_vec > ( ) ; lengths . push_back ( vals . size ( ) ) ; for ( const double d : vals ) { values . push_back ( d ) ; } } } encode_number ( info , oarc , lengths ) ; encode_double ( info , oarc , values ) ; }
Encodes a collection of vectors in data, skipping all UNDEFINED values.
Encodes a collection of vectors in data skipping all UNDEFINED values .
// length of each vector // values of all the vectors concatted together