diff --git a/include/dense_partitioned_phf.hpp b/include/dense_partitioned_phf.hpp index d07fd41..62662af 100644 --- a/include/dense_partitioned_phf.hpp +++ b/include/dense_partitioned_phf.hpp @@ -7,6 +7,8 @@ namespace pthash { template struct dense_partitioned_phf { + static_assert(std::is_base_of::value, + "Needs a dense encoder for dense partitioned PTHash. Select another encoder."); typedef Encoder encoder_type; static constexpr bool needsFreeArray = NeedsFreeArray; @@ -14,6 +16,8 @@ struct dense_partitioned_phf { build_timings build_in_internal_memory(Iterator keys, const uint64_t num_keys, build_configuration const& config) { assert(Search == config.search); + assert(config.dense_partitioning == true); + assert(config.avg_partition_size < 10000); // Unlike partitioned, must use small partitions internal_memory_builder_partitioned_phf builder; auto timings = builder.build_from_keys(keys, num_keys, config); timings.encoding_microseconds = build(builder, config); @@ -132,4 +136,7 @@ struct dense_partitioned_phf { ef_sequence m_free_slots; }; +template +using phobic = dense_partitioned_phf, + dense_interleaved, false, pthash_search_type::add_displacement>; } // namespace pthash \ No newline at end of file diff --git a/include/encoders/dense_encoders.hpp b/include/encoders/dense_encoders.hpp index 8825e84..a4f1723 100644 --- a/include/encoders/dense_encoders.hpp +++ b/include/encoders/dense_encoders.hpp @@ -49,8 +49,11 @@ struct diff { Encoder m_encoder; }; +struct dense_encoder { +}; + template -struct dense_mono { +struct dense_mono : dense_encoder { template void encode(Iterator begin, // const uint64_t num_partitions, // @@ -89,7 +92,7 @@ struct dense_mono { }; template -struct dense_interleaved { +struct dense_interleaved : dense_encoder { template void encode(Iterator begin, // const uint64_t num_partitions, // @@ -151,7 +154,7 @@ struct dense_interleaved { }; template -struct dense_dual { +struct dense_dual : dense_encoder { template void encode(Iterator begin, // const uint64_t num_partitions, // diff --git a/include/partitioned_phf.hpp b/include/partitioned_phf.hpp index 92049ab..978d15d 100644 --- a/include/partitioned_phf.hpp +++ b/include/partitioned_phf.hpp @@ -10,6 +10,8 @@ namespace pthash { template struct partitioned_phf { + static_assert(!std::is_base_of::value, + "Dense encoders are only for dense PTHash. Select another encoder."); private: struct partition { template diff --git a/include/single_phf.hpp b/include/single_phf.hpp index d7b1f49..7fe62c5 100644 --- a/include/single_phf.hpp +++ b/include/single_phf.hpp @@ -9,6 +9,8 @@ namespace pthash { template struct single_phf { + static_assert(!std::is_base_of::value, + "Dense encoders are only for dense PTHash. Select another encoder."); typedef Encoder encoder_type; static constexpr bool minimal = Minimal;