diff --git a/src/eckit/container/DenseSet.h b/src/eckit/container/DenseSet.h index 8fa429f9b..ee570c408 100644 --- a/src/eckit/container/DenseSet.h +++ b/src/eckit/container/DenseSet.h @@ -18,6 +18,7 @@ #include #include +#include "eckit/log/JSON.h" #include "eckit/exception/Exceptions.h" @@ -130,6 +131,15 @@ class DenseSet { } } + void json(JSON& s) const { + s.startList(); + const_iterator it = cbegin(); + for (; it != cend(); ++it) { + s << *it; + } + s.endList(); + } + bool operator==(const DenseSet& rhs) const { return !operator!=(rhs); } bool operator!=(const DenseSet& rhs) const { return values_ != rhs.values_; } @@ -139,6 +149,11 @@ class DenseSet { return s; } + friend JSON& operator<<(JSON& s, const DenseSet& m) { + m.json(s); + return s; + } + void merge(const DenseSet& other) { if (other.empty()) return;