MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / create_array

Function create_array

examples/cpp_api/array_metadata.cc:41–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39std::string array_name("array_metadata_array");
40
41void create_array() {
42 // Create a TileDB context.
43 Context ctx;
44
45 // Create some array (it can be dense or sparse, with
46 // any number of dimensions and attributes).
47 Domain domain(ctx);
48 domain.add_dimension(Dimension::create<int>(ctx, "rows", {{1, 4}}, 4))
49 .add_dimension(Dimension::create<int>(ctx, "cols", {{1, 4}}, 4));
50
51 // The array will be sparse.
52 ArraySchema schema(ctx, TILEDB_SPARSE);
53 schema.set_domain(domain).set_order({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}});
54
55 // Add a single attribute "a" so each (i,j) cell can store an integer.
56 schema.add_attribute(Attribute::create<int>(ctx, "a"));
57
58 // Create the (empty) array on disk.
59 Array::create(ctx, array_name, schema);
60}
61
62void write_array_metadata() {
63 // Create TileDB context

Callers 1

mainFunction · 0.70

Calls 3

add_dimensionMethod · 0.45
set_domainMethod · 0.45
add_attributeMethod · 0.45

Tested by

no test coverage detected