/// Cuts a bit sequence from fixed-size bit-string
/**
- The splitter can be used as iterator over bit-string.
+ The splitter can be used as an iterator over bit-string.
Each call of \p cut() or \p safe_cut() cuts the bit count specified
and keeps the position inside bit-string for the next call.
- \p BitString - a fixed-sized type that interprets as bit string
- \p BitStringSize - the size of \p BitString in bytes, default is <tt>sizeof( BitString )</tt>.
You can specify 0 for default.
- - \p UInt - an unsigned integer, return type of \p cut()
+ - \p UInt - an unsigned integer, return type for \p cut()
*/
template <typename BitString, size_t BitStringSize = sizeof( BitString ), typename UInt = typename std::conditional< BitStringSize % sizeof(size_t) == 0, size_t, unsigned >::type >
class split_bitstring
typedef UInt uint_type; ///< Bit-string portion type
static CDS_CONSTEXPR size_t const c_bitstring_size = BitStringSize ? BitStringSize : sizeof( BitString ); ///< size of \p BitString in bytes
+ /// Minimum count of bits to be cut
+ static CDS_CONSTEXPR size_t const c_nMinBitCut = 1;
+
//@cond
static CDS_CONSTEXPR size_t const c_nHashSize = (c_bitstring_size + sizeof(uint_type) - 1) / sizeof(uint_type);
static CDS_CONSTEXPR size_t const c_nBitPerByte = 8;
template <size_t Size>
using hash_size = cds::intrusive::feldman_hashset::hash_size< Size >;
+ /// Hash splitter
+ /**
+ @copydetails cds::intrusive::feldman_hashset::traits::hash_splitter
+ */
+ template <typename Splitter>
+ using hash_splitter = cds::intrusive::feldman_hashset::hash_splitter< Splitter >;
+
/// \p FeldmanHashSet internal statistics, see cds::intrusive::feldman_hashset::stat
template <typename EventCounter = cds::atomicity::event_counter>
using stat = cds::intrusive::feldman_hashset::stat< EventCounter >;
*/
static CDS_CONSTEXPR size_t const hash_size = 0;
+ /// Hash splitter
+ /**
+ @copydetails cds::intrusive::feldman_hashset::traits::hash_splitter
+ */
+ typedef cds::opt::none hash_splitter;
+
/// Hash comparing functor
/**
@copydetails cds::intrusive::feldman_hashset::traits::compare
@copydetails traits::hash_accessor
- \p feldman_hashset::hash_size - the size of hash value in bytes.
@copydetails traits::hash_size
+ - \p feldman_hashset::hash_splitter - a hash splitter algorithm
+ @copydetails traits::hash_splitter
- \p opt::allocator - item allocator
@copydetails traits::allocator
- \p opt::node_allocator - array node allocator.
//@endcond
};
+ /// Hash splitter option
+ /**
+ @copydetails traits::hash_splitter
+ */
+ template <typename Splitter>
+ struct hash_splitter {
+ //@cond
+ template <typename Base> struct pack: public Base
+ {
+ typedef Splitter hash_splitter;
+ };
+ //@endcond
+ };
+
+
/// \p FeldmanHashSet internal statistics
template <typename EventCounter = cds::atomicity::event_counter>
struct stat {
*/
static CDS_CONSTEXPR size_t const hash_size = 0;
+ /// Hash splitter
+ /**
+ This trait specifies hash bit-string splitter algorithm.
+ By default, \p cds::algo::split_bitstring< HashType, HashSize > is used
+ */
+ typedef cds::opt::none hash_splitter;
+
/// Disposer for removing data nodes
typedef cds::intrusive::opt::v::empty_disposer disposer;
@copydetails traits::hash_accessor
- \p feldman_hashset::hash_size - the size of hash value in bytes.
@copydetails traits::hash_size
+ - \p feldman_hashset::hash_splitter - a hash splitter algorithm
+ @copydetails traits::hash_splitter
- \p opt::node_allocator - array node allocator.
@copydetails traits::node_allocator
- \p opt::compare - hash comparison functor. No default functor is provided.
/// The size of hash_type in bytes, see \p traits::hash_size for explanation
static CDS_CONSTEXPR size_t const c_hash_size = traits::hash_size == 0 ? sizeof( hash_type ) : static_cast<size_t>( traits::hash_size );
- typedef feldman_hashset::details::hash_splitter< hash_type, c_hash_size > hash_splitter;
+ typedef typename std::conditional<
+ std::is_same< typename traits::hash_splitter, cds::opt::none >::value,
+ feldman_hashset::details::hash_splitter< hash_type, c_hash_size >,
+ typename traits::hash_splitter
+ >::type hash_splitter;
enum node_flags {
flag_array_converting = 1, ///< the cell is converting from data node to an array node