You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2020/04/29 17:18:15 UTC
[incubator-datasketches-cpp] branch sampling_vector_bytes created
(now 099a433)
This is an automated email from the ASF dual-hosted git repository.
jmalkin pushed a change to branch sampling_vector_bytes
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git.
at 099a433 add vector_bytes to sampling, remove useless const
This branch includes the following new commits:
new 099a433 add vector_bytes to sampling, remove useless const
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org
[incubator-datasketches-cpp] 01/01: add vector_bytes to sampling,
remove useless const
Posted by jm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jmalkin pushed a commit to branch sampling_vector_bytes
in repository https://gitbox.apache.org/repos/asf/incubator-datasketches-cpp.git
commit 099a433c989983a5e13875b8bdb0cbdbf7fa5270
Author: Jon Malkin <jm...@users.noreply.github.com>
AuthorDate: Wed Apr 29 10:17:04 2020 -0700
add vector_bytes to sampling, remove useless const
---
sampling/include/var_opt_sketch.hpp | 9 +++++++--
sampling/include/var_opt_sketch_impl.hpp | 2 +-
sampling/include/var_opt_union.hpp | 6 +++++-
3 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/sampling/include/var_opt_sketch.hpp b/sampling/include/var_opt_sketch.hpp
index c669792..5a5966a 100644
--- a/sampling/include/var_opt_sketch.hpp
+++ b/sampling/include/var_opt_sketch.hpp
@@ -28,6 +28,7 @@
namespace datasketches {
template<typename A> using AllocU8 = typename std::allocator_traits<A>::template rebind_alloc<uint8_t>;
+template<typename A> using vector_u8 = std::vector<uint8_t, AllocU8<A>>;
/**
* author Kevin Lang
@@ -84,7 +85,11 @@ class var_opt_sketch {
template<typename TT = T, typename std::enable_if<!std::is_arithmetic<TT>::value, int>::type = 0>
inline size_t get_serialized_size_bytes() const;
- std::vector<uint8_t, AllocU8<A>> serialize(unsigned header_size_bytes = 0) const;
+ // This is a convenience alias for users
+ // The type returned by the following serialize method
+ typedef vector_u8<A> vector_bytes;
+
+ vector_bytes serialize(unsigned header_size_bytes = 0) const;
void serialize(std::ostream& os) const;
std::ostream& to_stream(std::ostream& os) const;
@@ -232,7 +237,7 @@ private:
// to R region (can correct for numerical precision issues)
const_iterator(const var_opt_sketch<T,S,A>& sk, bool is_end, bool use_r_region, bool weight_corr);
- const bool get_mark() const;
+ bool get_mark() const;
const var_opt_sketch<T,S,A>* sk_;
double cum_r_weight_; // used for weight correction
diff --git a/sampling/include/var_opt_sketch_impl.hpp b/sampling/include/var_opt_sketch_impl.hpp
index a163f4f..d10371a 100644
--- a/sampling/include/var_opt_sketch_impl.hpp
+++ b/sampling/include/var_opt_sketch_impl.hpp
@@ -1491,7 +1491,7 @@ const std::pair<const T&, const double> var_opt_sketch<T, S, A>::const_iterator:
}
template<typename T, typename S, typename A>
-const bool var_opt_sketch<T, S, A>::const_iterator::get_mark() const {
+bool var_opt_sketch<T, S, A>::const_iterator::get_mark() const {
return sk_->marks_ == nullptr ? false : sk_->marks_[idx_];
}
diff --git a/sampling/include/var_opt_union.hpp b/sampling/include/var_opt_union.hpp
index ceabc20..9b036fd 100644
--- a/sampling/include/var_opt_union.hpp
+++ b/sampling/include/var_opt_union.hpp
@@ -65,7 +65,11 @@ public:
size_t get_serialized_size_bytes() const;
void serialize(std::ostream& os) const;
- std::vector<uint8_t, AllocU8<A>> serialize(unsigned header_size_bytes = 0) const;
+
+ // This is a convenience alias for users
+ // The type returned by the following serialize method
+ typedef vector_u8<A> vector_bytes;
+ vector_bytes serialize(unsigned header_size_bytes = 0) const;
std::ostream& to_stream(std::ostream& os) const;
std::string to_string() const;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org