34 tmp_size = buffer_size;
37 int pack_count =
packInternal(pos, len, nbuf, tmp_buf, tmp_size);
39 if ((nbuf - pack_count > 0) &&
64 int iopb_offset =
m_iov.size();
67 assert(static_cast<IOSize>(len[0]) <= buffer_size);
72 IOSize buffer_used = len[0];
74 for (idx = 1; idx < nbuf; idx++) {
75 if (buffer_used + len[idx] > buffer_size) {
81 assert(extra_bytes_signed >= 0);
82 IOSize extra_bytes =
static_cast<IOSize>(extra_bytes_signed);
85 (extra_bytes <
READ_COALESCE_SIZE) && (buffer_used + len[idx] + extra_bytes <= buffer_size)) {
94 buffer_used += (len[idx] + extra_bytes);
100 m_iov.push_back(iopb);
113 buffer_used += len[idx];
115 m_iov.push_back(iopb);
126 char *root_result_ptr =
buf;
128 for (
int idx = 0; idx < nbuf; idx++) {
132 char *io_result_ptr =
static_cast<char *
>(iopb.
data()) + iopb_offset;
135 memmove(root_result_ptr, io_result_ptr,
m_len[idx]);
137 root_result_ptr +=
m_len[idx];
147 m_iov.reserve(nbuf / 2);
std::vector< IOPosBuffer > m_iov
static constexpr IOSize TEMPORARY_BUFFER_SIZE
static constexpr IOSize READ_COALESCE_SIZE
void set_size(IOSize new_size)
void set_offset(IOOffset new_offset)
static constexpr IOSize BIG_READ_SIZE
void reset(unsigned int nbuf)
std::vector< char > m_spare_buffer
int pack(long long int *pos, int *len, int nbuf, char *buf, IOSize buffer_size)
edm::storage::IOSize IOSize
std::vector< int > m_idx_to_iopb_offset
void set_data(void *new_buffer)
int packInternal(long long int *pos, int *len, int nbuf, char *buf, IOSize buffer_size)
edm::propagate_const< int * > m_len
std::vector< int > m_idx_to_iopb