Skip to content

Commit

Permalink
Fix domain
Browse files Browse the repository at this point in the history
  • Loading branch information
kounelisagis committed Jul 11, 2024
1 parent 54bce5d commit 9bb1de7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 0 additions & 2 deletions tiledb/sm/array_schema/domain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,6 @@ template uint64_t Domain::stride<double>(Layout subarray_layout) const;
} // namespace tiledb::sm

std::ostream& operator<<(std::ostream& os, const tiledb::sm::Domain& domain) {
std::string tmp;

for (unsigned i = 0; i < domain.dim_num(); i++) {
os << std::endl;
os << *domain.dimension_ptr(i);
Expand Down
20 changes: 14 additions & 6 deletions tiledb/sm/cpp_api/domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#ifndef TILEDB_CPP_API_DOMAIN_H
#define TILEDB_CPP_API_DOMAIN_H

#include "capi_string.h"
#include "context.h"
#include "deleter.h"
#include "dimension.h"
Expand Down Expand Up @@ -111,6 +112,11 @@ class Domain {
/* API */
/* ********************************* */

/** Returns the context that the attribute belongs to. */
const Context& context() const {
return ctx_;
}

/**
* Returns the total number of cells in the domain. Throws an exception
* if the domain type is `float32` or `float64`.
Expand Down Expand Up @@ -316,12 +322,14 @@ class Domain {
/* ********************************* */

/** Get a string representation of the domain for an output stream. */
inline std::ostream& operator<<(std::ostream& os, const Domain& d) {
os << "Domain<";
for (const auto& dimension : d.dimensions()) {
os << " " << dimension;
}
os << '>';
inline std::ostream& operator<<(std::ostream& os, const Domain& dom) {
auto& ctx = dom.context();
tiledb_string_t* tdb_string;
ctx.handle_error(
tiledb_domain_dump_str(ctx.ptr().get(), dom.ptr().get(), &tdb_string));

os << impl::convert_to_string(&tdb_string).value();

return os;
}

Expand Down

0 comments on commit 9bb1de7

Please sign in to comment.