28 #ifndef CASA_HASHMAP_H
29 #define CASA_HASHMAP_H
31 #ifndef AIPS_USE_DEPRECATED
32 #error "HashMap.h is deprecated; use -DBUILD_DEPRECATED=ON to use it"
45 template<
class key,
class val>
class ConstHashMapIter;
84 const Int &defaultHashValue(
const Int *);
85 const uInt &defaultHashValue(
const uInt *);
86 const Long &defaultHashValue(
const Long *);
301 template<
class key,
class val>
class HashMap {
330 HashMap(
const val &dflt = defaultHashValue((
const val*)(0)),
412 val &
define(
const key &k,
const val &v);
418 void remove(
const key &k);
528 #ifndef CASACORE_NO_AUTO_TEMPLATES
529 #include <casacore/casa/Containers/HashMap.tcc>
530 #endif //# CASACORE_NO_AUTO_TEMPLATES
val & define(const key &k, const val &v)
Define a complete mapping.
HashMap(const val &dflt, uInt size, const HashClass< key > &newfunc, float maxlf=float(defaultMaxLoad_))
float loading() const
Current hash table loading factor.
HashMap< key, val > & operator=(const HashMap< key, val > &)
This copies the right hand side of the assignment.
uInt totalBuckets() const
Total number of buckets, i.e.
PtrBlock< List< OrderedPair< key, val > > * > blk
void throw_hashmapiter_init_error()
uInt allocBuckets() const
Number of buckets which have been allocated, i.e.
uInt enlarge()
enlarge the hash table.
float maxLoad_
Maximum load.
static uInt defaultSize()
Hash function with state.
virtual HashClass< key > * clone() const =0
This function is used to make a deep copy.
static float defaultMaxLoad()
HashMap(const val &dflt, const HashClass< key > &newfunc, float maxlf=float(defaultMaxLoad_))
uInt used_
Slots Being Used.
HashMap(const HashMap &)
Copy constructor with copy semantics.
uInt filled_
Slots with At Least One Value in the Bucket.
uInt populate(uInt to)
populate bucket "to".
bool Bool
Define the standard types used by Casacore.
uInt hashFunc(const ObjectID &)
HashMap(const val &dflt=defaultHashValue((const val *)(0)), uInt size=uInt(defaultSize_), Func newfunc=hashFunc, float maxlf=float(defaultMaxLoad_))
Default constructor (and variation) which allows for specifying:
casacore::Bool clone(const casacore::String &imageName, const casacore::String &newImageName)
uInt defs_
Number of Defined Mappings.
A drop-in replacement for Block<T*>.
const val & operator()(const key &ky) const
Retrieve values from the map, possibly for later assignment.
uInt ndefined() const
Number of mappings which have been defined by the user.
Block< uInt > distribution() const
This returns a Block which has the number of elements in each bucket of the table.
void setMaxLoad(float new_max)
const val & defaultVal() const
Retrieve the default value.
uInt(* Func)(const key &)
Signature of the hash functions.
void throw_invalid_hashmapiter_error()
virtual uInt hash(const key &)=0
This function maps elements of key type to any integer.
HashClass< key > * hashClass
Bool isDefined(const key &k) const
Check to see if a user defined mapping exists for k.
Bool empty() const
Have any mappings been defined by the user.
String: the storage and methods of handling collections of characters.
void freeTable()
delete the contents of the hash table
uInt usedBuckets() const
Number of buckets currently populated by a bucket list.
float maxLoad() const
Get or set the maximum load factor.
void clear()
Remove all user defined mapping.
uInt totalSize() const
Total size of this HashMap minus dynamically allocated memory for key or val.
uInt hash(const key &k) const
Call the hash function.
uInt availableBuckets() const
Number of buckets available, i.e.
Associative Array with a hash table implementation.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.