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

Function print_current_domain

examples/cpp_api/current_domain.cc:82–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void print_current_domain(Context& ctx) {
83 // Get array schema
84 ArraySchema schema(ctx, array_name);
85
86 // Get current domain
87 CurrentDomain current_domain =
88 ArraySchemaExperimental::current_domain(ctx, schema);
89
90 // Check if the current domain is empty
91 if (current_domain.is_empty()) {
92 std::cout << "Current domain: empty" << std::endl;
93 return;
94 }
95
96 // Get the current domain type
97 tiledb_current_domain_type_t current_domain_type = current_domain.type();
98
99 // Check the current domain type
100 if (current_domain_type != TILEDB_NDRECTANGLE) {
101 std::cout << "Current domain type: unknown" << std::endl;
102 return;
103 }
104
105 std::cout << "Current domain type: NDRECTANGLE" << std::endl;
106
107 // Get the current domain's NDRectangle
108 NDRectangle ndrect = current_domain.ndrectangle();
109
110 // Get the range of the rectangle's first dimension
111 std::array<int32_t, 2> range = ndrect.range<int32_t>("d1");
112
113 // Print the range
114 std::cout << "Current domain range: [" << range[0] << ", " << range[1] << "]"
115 << std::endl;
116
117 // Print datatype of range 0
118 std::cout << "Current domain range 0 datatype: "
119 << tiledb::impl::type_to_str(ndrect.range_dtype(0)) << std::endl;
120
121 // Print datatype of range d1
122 std::cout << "Current domain range 0 datatype: "
123 << tiledb::impl::type_to_str(ndrect.range_dtype("d1")) << std::endl;
124
125 // Print dim num
126 std::cout << "Current domain dim num: " << ndrect.dim_num() << std::endl;
127}
128
129void expand_current_domain(Context& ctx) {
130 // Get the array schema

Callers 1

mainFunction · 0.70

Calls 6

type_to_strFunction · 0.85
is_emptyMethod · 0.45
typeMethod · 0.45
ndrectangleMethod · 0.45
range_dtypeMethod · 0.45
dim_numMethod · 0.45

Tested by

no test coverage detected