18 if( ranged_iter == range_end )
return false;
20 assert( file_id <= *ranged_iter );
21 if( *ranged_iter != file_id )
return false;
31 const Range& file_ids,
32 const std::vector< unsigned >& vals_per_ent,
33 const Range& ranged_file_ids )
36 const size_t value_size = H5Tget_size( data_type );
37 const size_t buffer_size =
bufferSize / value_size;
38 unsigned char*
const data_buffer =
reinterpret_cast< unsigned char*
>(
dataBuffer );
39 std::vector< unsigned char > partial;
42 std::vector< unsigned >::const_iterator count_iter = vals_per_ent.begin();
47 assert( file_ids.
size() == vals_per_ent.size() );
51 data_set.
set_file_ids( offsets, start_offset, buffer_size, data_type );
60 while( !data_set.
done() )
65 data_set.
read( data_buffer, count );
72 assert( 0 == count || fileid_iter != file_ids.
end() );
77 if( !partial.empty() )
79 assert( fileid_iter != file_ids.
end() );
80 assert( 0 == ( partial.size() % value_size ) );
81 size_t num_prev = partial.size() / value_size;
82 offset = *count_iter - num_prev;
85 partial.insert( partial.end(), data_buffer, data_buffer + count * value_size );
89 partial.insert( partial.end(), data_buffer, data_buffer + offset * value_size );
91 ranged =
is_ranged( *fileid_iter, ranged_iter, ranged_file_ids.
end() );
92 assert( partial.size() == *count_iter * value_size );
93 rval =
store_data( *fileid_iter, &partial[0], *count_iter, ranged );
103 while( count_iter != vals_per_ent.end() && offset + *count_iter <= count )
105 assert( fileid_iter != file_ids.
end() );
106 ranged =
is_ranged( *fileid_iter, ranged_iter, ranged_file_ids.
end() );
107 rval =
store_data( *fileid_iter, data_buffer + offset * value_size, *count_iter, ranged );
110 offset += *count_iter;
120 assert( partial.empty() );
121 partial.insert( partial.end(), data_buffer + offset * value_size, data_buffer + count * value_size );
127 for( ; fileid_iter != file_ids.
end(); ++fileid_iter )
129 assert( 0 == *count_iter );
292 const Range& file_ids,
296 std::vector< unsigned >& counts_out )
302 counts_out.reserve( file_ids.
size() );
311 if( pair != file_ids.
const_pair_end() && pair->first == start_file_id )
313 hint = rows.
insert( nudge, pair->second - start_file_id + nudge );
318 hint = rows.
insert( hint, pair->first - start_file_id + nudge - 1, pair->second - start_file_id + nudge );
323 hsize_t buffer_size =
bufferSize /
sizeof( hssize_t );
325 data_set.
set_file_ids( rows, nudge, buffer_size, H5T_NATIVE_HSSIZE );
327 bool have_prev_end =
false;
330 if( !file_ids.
empty() && file_ids.
front() == start_file_id )
333 have_prev_end =
true;
339 size_t count, offset;
341 hint = offsets_out.
begin();
343 while( !data_set.
done() )
362 counts_out.push_back(
buffer[0] - prev_end );
363 hint = offsets_out.
insert( hint, prev_end + 1 + nudge,
buffer[0] + nudge );
366 have_prev_end =
false;
369 while( offset < count )
371 assert( fiter != file_ids.
end() );
377 if( offset == count - 1 )
break;
381 size_t s =
buffer[offset - 1] + 1;
382 size_t e =
buffer[offset];
383 counts_out.push_back( e - s + 1 );
384 hint = offsets_out.
insert( hint, s + nudge, e + nudge );
399 assert( !have_prev_end );
400 if( offset == count )
407 assert( offset + 1 == count );
410 have_prev_end =
true;
411 prev_end =
buffer[offset];
414 assert( !have_prev_end );
415 assert( fiter == file_ids.
end() );