C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/util/HashSet.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_HASH_SET_HPP
00008 #define COH_HASH_SET_HPP
00009 
00010 #include "coherence/lang.ns"
00011 
00012 #include "coherence/util/MappedSet.hpp"
00013 
00014 COH_OPEN_NAMESPACE2(coherence,util)
00015 
00016 
00017 /**
00018 * Set implementation which is backed by a HashMap.
00019 *
00020 * @author mf  2008.02.25
00021 */
00022 class COH_EXPORT HashSet
00023     : public cloneable_spec<HashSet,
00024         extends<MappedSet> >
00025     {
00026     friend class factory<HashSet>;
00027 
00028     // ----- constructors ---------------------------------------------------
00029 
00030     protected:
00031         /**
00032         * Construct a hash set using the specified settings.
00033         *
00034         * @param cInitialBuckets  the initial number of hash buckets,
00035         *                         0 &lt; n
00036         * @param flLoadFactor     the acceptable load factor before resizing
00037         *                         occurs, 0 &lt; n, such that a load factor
00038         *                         of 1.0 causes resizing when the number of
00039         *                         entries exceeds the number of buckets
00040         * @param flGrowthRate     the rate of bucket growth when a resize
00041         *                         occurs, 0 &lt; n, such that a growth rate
00042         *                         of 1.0 will double the number of buckets:
00043         *                         bucketcount = bucketcount * (1 + growthrate)
00044         */
00045         HashSet(size32_t  cInitialBuckets = default_initial_buckets,
00046                 float32_t flLoadFactor    = getDefaultLoadFactor(),
00047                 float32_t flGrowthRate    = getDefaultGrowthRate());
00048 
00049         /**
00050         * Constructs a new set containing the elements in the specified
00051         * Collection. The HashSet is created with default load factor (1.0)
00052         * and an initial capacity sufficient to contain the elements in the
00053         * specified collection.
00054         *
00055         * @param vCol  the collection whose elements are to be placed into this set
00056         *
00057         * @since Coherence 12.1.2
00058         */
00059         HashSet(Collection::View vCol);
00060 
00061         /**
00062         * Copy constructor.
00063         */
00064         HashSet(const HashSet& that);
00065 
00066 
00067     // ----- constants ---------------------------------------------------
00068 
00069     public:
00070         /**
00071         * The default value for initial number of hash buckets.
00072         */
00073         static const size32_t default_initial_buckets = 17;
00074 
00075         /**
00076         * The default acceptable load factor before resizing occurs (1.0F).
00077         */
00078         static float32_t getDefaultLoadFactor();
00079 
00080         /**
00081         * The default rate of bucket growth when a resize occurs (3.0F).
00082         */
00083         static float32_t getDefaultGrowthRate();
00084     };
00085 
00086 COH_CLOSE_NAMESPACE2
00087 
00088 #endif // COH_HASH_SET
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.