* Returns the number of elements in the result buffers from a read query. * This is a map from the attribute name to a pair of values. * * The first is number of elements (offsets) for var size attributes, and the * second is number of elements in the data buffer. For fixed sized attributes * (and coordinates), the first is always 0. * * For variable sized attributes: the firs
| 394 | * @endcode |
| 395 | */ |
| 396 | std::unordered_map<std::string, std::pair<uint64_t, uint64_t>> |
| 397 | result_buffer_elements() const { |
| 398 | std::unordered_map<std::string, std::pair<uint64_t, uint64_t>> elements; |
| 399 | if (buff_sizes_.empty()) |
| 400 | return std::unordered_map< |
| 401 | std::string, |
| 402 | std::pair<uint64_t, uint64_t>>(); // Query hasn't been submitted |
| 403 | for (const auto& b_it : buff_sizes_) { |
| 404 | auto attr_name = b_it.first; |
| 405 | auto size_tuple = b_it.second; |
| 406 | auto element_size = element_sizes_.find(attr_name)->second; |
| 407 | elements[attr_name] = field_var_sized(attr_name) ? |
| 408 | std::pair<uint64_t, uint64_t>( |
| 409 | std::get<0>(size_tuple) / sizeof(uint64_t), |
| 410 | std::get<1>(size_tuple) / element_size) : |
| 411 | std::pair<uint64_t, uint64_t>( |
| 412 | 0, std::get<1>(size_tuple) / element_size); |
| 413 | } |
| 414 | return elements; |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * Returns the number of elements in the result buffers from a read query. |