* Schema describing an array. * * @details * The schema is an independent description of an array. A schema can be * used to create multiple array's, and stores information about its * domain, cell types, and compression details. An array schema is composed of: * * - A Domain * - A set of Attributes * - Memory layout definitions: tile and cell * - Compression details for Array level fact
| 90 | * @endcode |
| 91 | */ |
| 92 | class ArraySchema : public Schema { |
| 93 | public: |
| 94 | /* ********************************* */ |
| 95 | /* CONSTRUCTORS & DESTRUCTORS */ |
| 96 | /* ********************************* */ |
| 97 | |
| 98 | /** |
| 99 | * Creates a new array schema. |
| 100 | * |
| 101 | * **Example:** |
| 102 | * @code{.cpp} |
| 103 | * tiledb::Context ctx; |
| 104 | * tiledb::ArraySchema schema(ctx.ptr().get(), TILEDB_SPARSE); |
| 105 | * @endcode |
| 106 | * |
| 107 | * @param ctx TileDB context |
| 108 | * @param type Array type, sparse or dense. |
| 109 | */ |
| 110 | explicit ArraySchema(const Context& ctx, tiledb_array_type_t type) |
| 111 | : Schema(ctx) { |
| 112 | tiledb_array_schema_t* schema; |
| 113 | ctx.handle_error(tiledb_array_schema_alloc(ctx.ptr().get(), type, &schema)); |
| 114 | schema_ = std::shared_ptr<tiledb_array_schema_t>(schema, deleter_); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Loads the schema of an existing array. |
| 119 | * |
| 120 | * **Example:** |
| 121 | * @code{.cpp} |
| 122 | * tiledb::Context ctx; |
| 123 | * tiledb::ArraySchema schema(ctx, "s3://bucket-name/array-name"); |
| 124 | * @endcode |
| 125 | * |
| 126 | * @param ctx TileDB context |
| 127 | * @param uri URI of array |
| 128 | */ |
| 129 | ArraySchema(const Context& ctx, const std::string& uri) |
| 130 | : Schema(ctx) { |
| 131 | tiledb_ctx_t* c_ctx = ctx.ptr().get(); |
| 132 | tiledb_array_schema_t* schema; |
| 133 | ctx.handle_error(tiledb_array_schema_load(c_ctx, uri.c_str(), &schema)); |
| 134 | schema_ = std::shared_ptr<tiledb_array_schema_t>(schema, deleter_); |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Loads the schema of an existing array with the input C array |
| 139 | * schema object. |
| 140 | * |
| 141 | * @param ctx TileDB context |
| 142 | * @param schema C API array schema object |
| 143 | */ |
| 144 | ArraySchema(const Context& ctx, tiledb_array_schema_t* schema) |
| 145 | : Schema(ctx) { |
| 146 | schema_ = std::shared_ptr<tiledb_array_schema_t>(schema, deleter_); |
| 147 | } |
| 148 | |
| 149 | ArraySchema() = delete; |
no test coverage detected