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