* Gets all attributes in the array. * * @return Map of attribute name to copy of Attribute instance. */
| 506 | * @return Map of attribute name to copy of Attribute instance. |
| 507 | */ |
| 508 | std::unordered_map<std::string, Attribute> attributes() const override { |
| 509 | auto& ctx = ctx_.get(); |
| 510 | tiledb_attribute_t* attrptr; |
| 511 | unsigned int nattr; |
| 512 | std::unordered_map<std::string, Attribute> attrs; |
| 513 | ctx.handle_error(tiledb_array_schema_get_attribute_num( |
| 514 | ctx.ptr().get(), schema_.get(), &nattr)); |
| 515 | for (unsigned int i = 0; i < nattr; ++i) { |
| 516 | ctx.handle_error(tiledb_array_schema_get_attribute_from_index( |
| 517 | ctx.ptr().get(), schema_.get(), i, &attrptr)); |
| 518 | auto attr = Attribute(ctx_, attrptr); |
| 519 | attrs.emplace( |
| 520 | std::pair<std::string, Attribute>(attr.name(), std::move(attr))); |
| 521 | } |
| 522 | return attrs; |
| 523 | } |
| 524 | |
| 525 | /** |
| 526 | * Get a copy of an Attribute in the schema by name. |
no test coverage detected