| 56 | |
| 57 | namespace tiledb { |
| 58 | class CurrentDomain { |
| 59 | public: |
| 60 | /* ********************************* */ |
| 61 | /* CONSTRUCTORS & DESTRUCTORS */ |
| 62 | /* ********************************* */ |
| 63 | |
| 64 | /** |
| 65 | * Creates a TileDB current_domain object. |
| 66 | * |
| 67 | * @param ctx TileDB context |
| 68 | * @param type The TileDB currentDomain type |
| 69 | */ |
| 70 | explicit CurrentDomain(const Context& ctx) |
| 71 | : ctx_(ctx) { |
| 72 | tiledb_current_domain_t* cd; |
| 73 | ctx.handle_error(tiledb_current_domain_create(ctx.ptr().get(), &cd)); |
| 74 | current_domain_ = std::shared_ptr<tiledb_current_domain_t>(cd, deleter_); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Creates a TileDB current_domain object. |
| 79 | * |
| 80 | * @param ctx TileDB context |
| 81 | * @param cd The TileDB currentDomain C api pointer |
| 82 | */ |
| 83 | CurrentDomain(const tiledb::Context& ctx, tiledb_current_domain_t* cd) |
| 84 | : ctx_(ctx) { |
| 85 | current_domain_ = std::shared_ptr<tiledb_current_domain_t>(cd, deleter_); |
| 86 | } |
| 87 | |
| 88 | CurrentDomain(const CurrentDomain&) = default; |
| 89 | CurrentDomain(CurrentDomain&&) = default; |
| 90 | CurrentDomain& operator=(const CurrentDomain&) = default; |
| 91 | CurrentDomain& operator=(CurrentDomain&&) = default; |
| 92 | |
| 93 | /* ********************************* */ |
| 94 | /* API */ |
| 95 | /* ********************************* */ |
| 96 | |
| 97 | /** |
| 98 | * Returns a shared pointer to the C TileDB currentDomain object. |
| 99 | * |
| 100 | * @return The C API pointer |
| 101 | */ |
| 102 | std::shared_ptr<tiledb_current_domain_t> ptr() const { |
| 103 | return current_domain_; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Returns the currentDomain type. |
| 108 | * |
| 109 | * @return The currentDomain type. |
| 110 | */ |
| 111 | tiledb_current_domain_type_t type() const { |
| 112 | tiledb_current_domain_type_t type; |
| 113 | auto& ctx = ctx_.get(); |
| 114 | ctx.handle_error(tiledb_current_domain_get_type( |
| 115 | ctx.ptr().get(), current_domain_.get(), &type)); |
no test coverage detected