ROSE  0.11.145.0
Classes | Public Types | Public Member Functions | List of all members
Sawyer::Container::HashMap< K, T, H, C, A > Class Template Reference

Description

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
class Sawyer::Container::HashMap< K, T, H, C, A >

Container associating values with keys.

This container is similar to TL's unordered_map in that it stores a value for each key using a hash-based mechanism, although it works for C++ versions before C++11. The naming scheme is similar to other Sawyer containers. If you're used to the STL, the main differences are described in the documentation for the Sawyer::Container name space.

See also, Map.

Definition at line 33 of file HashMap.h.

#include <util/Sawyer/HashMap.h>

Inheritance diagram for Sawyer::Container::HashMap< K, T, H, C, A >:
Inheritance graph
[legend]

Classes

class  ConstKeyIterator
 Forward iterator over keys. More...
 
class  ConstNodeIterator
 Forward iterator over key/value nodes. More...
 
class  ConstValueIterator
 Forward iterator over values. More...
 
class  Node
 Type for stored nodes. More...
 
class  NodeIterator
 Forward iterator over key/value nodes. More...
 
class  ValueIterator
 Forward iterator over values. More...
 

Public Types

typedef K Key
 Type of keys. More...
 
typedef T Value
 Type of values. More...
 
typedef H Hasher
 Functor for hashing keys. More...
 
typedef C Comparator
 Functor for comparing keys. More...
 
typedef A Allocator
 Functor for allocating node memory. More...
 

Public Member Functions

 HashMap ()
 Default constructor. More...
 
 HashMap (size_t n, const Hasher &hasher=Hasher(), const Comparator &cmp=Comparator(), const Allocator &alloc=Allocator())
 Constructs a hash map with at least n buckets. More...
 
 HashMap (const HashMap &other)
 Copy constructor. More...
 
template<class K2 , class T2 , class H2 , class C2 , class A2 >
 HashMap (const HashMap< K2, T2, H2, C2, A2 > &other)
 Copy constructor. More...
 
template<class K2 , class T2 , class H2 , class C2 , class A2 >
HashMapoperator= (const HashMap< K2, T2, H2, C2, A2 > &other)
 Assignment operator. More...
 
bool isEmpty () const
 Determine whether this container is empty. More...
 
size_t size () const
 Number of nodes, keys, or values in this container. More...
 
size_t nBuckets () const
 Number of buckets. More...
 
double loadFactor () const
 Average number of nodes per bucket. More...
 
void rehash (size_t nBuckets)
 Change number of buckets. More...
 
bool exists (const Key &key) const
 Determine if a key exists. More...
 
Optional< ValuegetOptional (const Key &key) const
 Lookup and return a value or nothing. More...
 
const ValuegetOrDefault (const Key &key) const
 Lookup and return a value or a default. More...
 
HashMapinsert (const Key &key, const Value &value)
 Insert or update a key/value pair. More...
 
HashMapinsertDefault (const Key &key)
 Insert or update a key with a default value. More...
 
ValueinsertMaybe (const Key &key, const Value &value)
 Conditionally insert a new key/value pair. More...
 
ValueinsertMaybeDefault (const Key &key)
 Conditionally insert a new key with default value. More...
 
template<class OtherNodeIterator >
HashMapinsertMaybeMultiple (const boost::iterator_range< OtherNodeIterator > &range)
 Conditionally insert multiple key/value pairs. More...
 
HashMapclear ()
 Remove all nodes. More...
 
HashMaperase (const Key &key)
 Remove a node with specified key. More...
 
template<class OtherKeyIterator >
HashMaperaseMultiple (const boost::iterator_range< OtherKeyIterator > &range)
 Remove keys stored in another HashMap. More...
 
boost::iterator_range< NodeIteratornodes ()
 Iterators for container nodes. More...
 
boost::iterator_range< ConstNodeIteratornodes () const
 Iterators for container nodes. More...
 
boost::iterator_range< ConstKeyIteratorkeys ()
 Iterators for container keys. More...
 
boost::iterator_range< ConstKeyIteratorkeys () const
 Iterators for container keys. More...
 
boost::iterator_range< ValueIteratorvalues ()
 Iterators for container values. More...
 
boost::iterator_range< ConstValueIteratorvalues () const
 Iterators for container values. More...
 
double maxLoadFactor () const
 Property: Maximum allowed load faster before automatic rehash.
 
void maxLoadFactor (double mlf)
 Property: Maximum allowed load faster before automatic rehash.
 
NodeIterator find (const Key &key)
 Find a node by key. More...
 
ConstNodeIterator find (const Key &key) const
 Find a node by key. More...
 
Valueoperator[] (const Key &key)
 Return a reference to an existing value. More...
 
const Valueoperator[] (const Key &key) const
 Return a reference to an existing value. More...
 
Valueget (const Key &key)
 Lookup and retun an existing value. More...
 
const Valueget (const Key &key) const
 Lookup and retun an existing value. More...
 
ValuegetOrElse (const Key &key, Value &dflt)
 Lookup and return a value or something else. More...
 
const ValuegetOrElse (const Key &key, const Value &dflt) const
 Lookup and return a value or something else. More...
 
template<class OtherNodeIterator >
HashMapinsertMultiple (const OtherNodeIterator &begin, const OtherNodeIterator &end)
 Insert multiple values. More...
 
template<class OtherNodeIterator >
HashMapinsertMultiple (const boost::iterator_range< OtherNodeIterator > &range)
 Insert multiple values. More...
 
HashMaperaseAt (const NodeIterator &iter)
 Remove a node by iterator. More...
 
HashMaperaseAt (const ConstKeyIterator &iter)
 Remove a node by iterator. More...
 
HashMaperaseAt (const ValueIterator &iter)
 Remove a node by iterator. More...
 
template<class Iter >
HashMaperaseAtMultiple (const Iter &begin, const Iter &end)
 Remove multiple nodes by iterator range. More...
 
template<class Iter >
HashMaperaseAtMultiple (const boost::iterator_range< Iter > &range)
 Remove multiple nodes by iterator range. More...
 

Member Typedef Documentation

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
typedef K Sawyer::Container::HashMap< K, T, H, C, A >::Key

Type of keys.

Definition at line 35 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
typedef T Sawyer::Container::HashMap< K, T, H, C, A >::Value

Type of values.

Definition at line 36 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
typedef H Sawyer::Container::HashMap< K, T, H, C, A >::Hasher

Functor for hashing keys.

Definition at line 37 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
typedef C Sawyer::Container::HashMap< K, T, H, C, A >::Comparator

Functor for comparing keys.

Definition at line 38 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
typedef A Sawyer::Container::HashMap< K, T, H, C, A >::Allocator

Functor for allocating node memory.

Definition at line 39 of file HashMap.h.

Constructor & Destructor Documentation

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Sawyer::Container::HashMap< K, T, H, C, A >::HashMap ( )
inline

Default constructor.

Creates an empty map.

Definition at line 222 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Sawyer::Container::HashMap< K, T, H, C, A >::HashMap ( size_t  n,
const Hasher hasher = Hasher(),
const Comparator cmp = Comparator(),
const Allocator alloc = Allocator() 
)
inline

Constructs a hash map with at least n buckets.

Definition at line 225 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Sawyer::Container::HashMap< K, T, H, C, A >::HashMap ( const HashMap< K, T, H, C, A > &  other)
inline

Copy constructor.

Definition at line 229 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class K2 , class T2 , class H2 , class C2 , class A2 >
Sawyer::Container::HashMap< K, T, H, C, A >::HashMap ( const HashMap< K2, T2, H2, C2, A2 > &  other)
inline

Copy constructor.

Initializes the new map with copies of the nodes of the other map. The keys and values must be convertible from the ohter map to this map.

Definition at line 237 of file HashMap.h.

Member Function Documentation

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class K2 , class T2 , class H2 , class C2 , class A2 >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::operator= ( const HashMap< K2, T2, H2, C2, A2 > &  other)
inline

Assignment operator.

Definition at line 246 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<NodeIterator> Sawyer::Container::HashMap< K, T, H, C, A >::nodes ( )
inline

Iterators for container nodes.

This returns a range of node-iterators that will traverse all nodes (key/value pairs) of this container.

Definition at line 265 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::HashMap(), and Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::operator=().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstNodeIterator> Sawyer::Container::HashMap< K, T, H, C, A >::nodes ( ) const
inline

Iterators for container nodes.

This returns a range of node-iterators that will traverse all nodes (key/value pairs) of this container.

Definition at line 268 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstKeyIterator> Sawyer::Container::HashMap< K, T, H, C, A >::keys ( )
inline

Iterators for container keys.

Returns a range of key-iterators that will traverse the keys of this container.

Definition at line 278 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstKeyIterator> Sawyer::Container::HashMap< K, T, H, C, A >::keys ( ) const
inline

Iterators for container keys.

Returns a range of key-iterators that will traverse the keys of this container.

Definition at line 281 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ValueIterator> Sawyer::Container::HashMap< K, T, H, C, A >::values ( )
inline

Iterators for container values.

Returns a range of iterators that will traverse the user-defined values of this container. The values are iterated in key order, although the keys are not directly available via these iterators.

Definition at line 292 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstValueIterator> Sawyer::Container::HashMap< K, T, H, C, A >::values ( ) const
inline

Iterators for container values.

Returns a range of iterators that will traverse the user-defined values of this container. The values are iterated in key order, although the keys are not directly available via these iterators.

Definition at line 295 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
bool Sawyer::Container::HashMap< K, T, H, C, A >::isEmpty ( ) const
inline

Determine whether this container is empty.

Returns true if the container is empty, and false if it has at least one node. This method executes in constant time.

Definition at line 308 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
size_t Sawyer::Container::HashMap< K, T, H, C, A >::size ( void  ) const
inline

Number of nodes, keys, or values in this container.

Returns the number of nodes currently stored in this container. A node is a key + value pair. This method executes in constant time.

Definition at line 316 of file HashMap.h.

Referenced by Rose::BinaryAnalysis::InstructionProvider::nCached().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
size_t Sawyer::Container::HashMap< K, T, H, C, A >::nBuckets ( ) const
inline

Number of buckets.

Definition at line 321 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
double Sawyer::Container::HashMap< K, T, H, C, A >::loadFactor ( ) const
inline

Average number of nodes per bucket.

Definition at line 326 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
void Sawyer::Container::HashMap< K, T, H, C, A >::rehash ( size_t  nBuckets)
inline

Change number of buckets.

Definition at line 342 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
NodeIterator Sawyer::Container::HashMap< K, T, H, C, A >::find ( const Key key)
inline

Find a node by key.

Looks for a node whose key is equal to the specified key and returns an iterator to that node, or the end iterator if no such node exists.

Definition at line 357 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
ConstNodeIterator Sawyer::Container::HashMap< K, T, H, C, A >::find ( const Key key) const
inline

Find a node by key.

Looks for a node whose key is equal to the specified key and returns an iterator to that node, or the end iterator if no such node exists.

Definition at line 360 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
bool Sawyer::Container::HashMap< K, T, H, C, A >::exists ( const Key key) const
inline

Determine if a key exists.

Looks for a node whose key is equal to the specified key and returns true if found, or false if no such node exists.

Definition at line 369 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::HashMap< K, T, H, C, A >::operator[] ( const Key key)
inline

Return a reference to an existing value.

Returns a reference to the value at the node with the specified key. Unlike std::map, this container does not instantiate a new key/value pair if the key is not in the map's domain. In other words, the array operator for this class is more like an array operator on arrays or vectors–such objects are not automatically extended if dereferenced with an operand that is outside the domain.

If the key is not part of this map's domain then an std::domain_error is thrown.

See also
insert insertDefault

Definition at line 390 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::HashMap< K, T, H, C, A >::operator[] ( const Key key) const
inline

Return a reference to an existing value.

Returns a reference to the value at the node with the specified key. Unlike std::map, this container does not instantiate a new key/value pair if the key is not in the map's domain. In other words, the array operator for this class is more like an array operator on arrays or vectors–such objects are not automatically extended if dereferenced with an operand that is outside the domain.

If the key is not part of this map's domain then an std::domain_error is thrown.

See also
insert insertDefault

Definition at line 393 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::HashMap< K, T, H, C, A >::get ( const Key key)
inline

Lookup and retun an existing value.

Returns a reference to the value at the node with the specified key, which must exist. If the key is not part of this map's domain, then an std::domain_error is thrown.

See also
insert insertDefault

Definition at line 406 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::HashMap< K, T, H, C, A >::get ( const Key key) const
inline

Lookup and retun an existing value.

Returns a reference to the value at the node with the specified key, which must exist. If the key is not part of this map's domain, then an std::domain_error is thrown.

See also
insert insertDefault

Definition at line 412 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Optional<Value> Sawyer::Container::HashMap< K, T, H, C, A >::getOptional ( const Key key) const
inline

Lookup and return a value or nothing.

Looks up the node with the specified key and returns either a copy of its value, or nothing.

Here's an example of one convenient way to use this:

HashMap<std::string, FileInfo> files;
...
if (Optional<FileInfo> fileInfo = files.getOptional(fileName))
std::cout <<"file info for \"" <<fileName <<"\" is " <<*fileInfo <<"\n";

The equivalent STL approach is:

std::map<std::string, FileInfo> files;
...
std::map<std::string, FileInfo>::const_iterator filesIter = files.find(fileName);
if (fileIter != files.end())
std::cout <<"file info for \"" <<fileName <<"\" is " <<filesIter->second <<"\n";

Definition at line 442 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::HashMap< K, T, H, C, A >::getOrElse ( const Key key,
Value dflt 
)
inline

Lookup and return a value or something else.

This is similar to the get method, except a default can be provided. If a node with the specified key is present in this container, then a reference to that node's value is returned, otherwise the (reference to) supplied default is returned.

Definition at line 454 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::HashMap< K, T, H, C, A >::getOrElse ( const Key key,
const Value dflt 
) const
inline

Lookup and return a value or something else.

This is similar to the get method, except a default can be provided. If a node with the specified key is present in this container, then a reference to that node's value is returned, otherwise the (reference to) supplied default is returned.

Definition at line 458 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::HashMap< K, T, H, C, A >::getOrDefault ( const Key key) const
inline

Lookup and return a value or a default.

This is similar to the getOrElse method except when the key is not present in the map, a reference to a const, default-constructed value is returned.

Definition at line 468 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::insert ( const Key key,
const Value value 
)
inline

Insert or update a key/value pair.

Inserts the key/value pair into the container. If a previous node already had the same key then it is replaced by the new node.

See also
insertDefault insertMaybe insertMaybeDefault insertMultiple insertMaybeMultiple

Definition at line 485 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insert(), Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insertDefault(), and Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insertMultiple().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::insertDefault ( const Key key)
inline

Insert or update a key with a default value.

The value associated with key in the map is replaced with a default-constructed value. If the key does not exist then it is inserted with a default value. This operation is similar to the array operator of std::map.

See also
insert insertMaybe insertMaybeDefault insertMultiple insertMaybeMultiple

Definition at line 498 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::insertMultiple ( const OtherNodeIterator &  begin,
const OtherNodeIterator &  end 
)
inline

Insert multiple values.

Inserts copies of the nodes in the specified node iterator range. The iterators must iterate over objects that have key and value methods that return keys and values that are convertible to the types used by this container.

The normal way to insert the contents of one map into another is:

HashMap<...> source = ...;
HashMap<...> destination = ...;
destination.insertMultiple(source.nodes());
See also
insert insertDefault insertMaybe insertMaybeDefault insertMaybeMultiple

Definition at line 520 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insertMultiple().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::insertMultiple ( const boost::iterator_range< OtherNodeIterator > &  range)
inline

Insert multiple values.

Inserts copies of the nodes in the specified node iterator range. The iterators must iterate over objects that have key and value methods that return keys and values that are convertible to the types used by this container.

The normal way to insert the contents of one map into another is:

HashMap<...> source = ...;
HashMap<...> destination = ...;
destination.insertMultiple(source.nodes());
See also
insert insertDefault insertMaybe insertMaybeDefault insertMaybeMultiple

Definition at line 526 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::HashMap< K, T, H, C, A >::insertMaybe ( const Key key,
const Value value 
)
inline

Conditionally insert a new key/value pair.

Inserts the key/value pair into the container if the container does not yet have a node with the same key. The return value is a reference to the value that is in the container, either the value that previously existed or a copy of the specified value.

See also
insert insertDefault insertMaybeDefault insertMultiple insertMaybeMultiple

Definition at line 538 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insertMaybeDefault(), and Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::insertMaybeMultiple().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::HashMap< K, T, H, C, A >::insertMaybeDefault ( const Key key)
inline

Conditionally insert a new key with default value.

Inserts a key/value pair into the container if the container does not yet have a node with the same key. The value is default-constructed. The return value is a reference to the value that is in the container, either the value that previously existed or the new default-constructed value.

See also
insert insertDefault insertMultiple insertMaybeMultiple

Definition at line 549 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::insertMaybeMultiple ( const boost::iterator_range< OtherNodeIterator > &  range)
inline

Conditionally insert multiple key/value pairs.

Inserts each of the specified key/value pairs into this container where this container does not already contain a value for the key. The return value is a reference to the container itself so that this method can be chained with others.

See also
insert insertDefault insertMaybe insertMaybeDefault insertMultiple

Definition at line 560 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::clear ( )
inline

Remove all nodes.

All nodes are removed from this container. This method executes in linear time in the number of nodes in this container.

Definition at line 570 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::clear(), and Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::operator=().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::erase ( const Key key)
inline

Remove a node with specified key.

Removes the node whose key is equal to the specified key, or does nothing if no such node exists. Two keys are considered equal if this container's Comparator object returns false reflexively.

See also
eraseMultiple eraseAt eraseAtMultiple

Definition at line 581 of file HashMap.h.

Referenced by Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::erase(), Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::eraseAt(), Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::eraseAtMultiple(), and Sawyer::Container::HashMap< rose_addr_t, SgAsmInstruction * >::eraseMultiple().

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class OtherKeyIterator >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseMultiple ( const boost::iterator_range< OtherKeyIterator > &  range)
inline

Remove keys stored in another HashMap.

All nodes of this container whose keys are equal to any key in the other container are removed from this container. The keys of the other container must be convertible to the types used by this container, and two keys are considered equal if this container's Comparator object returns false reflexively.

See also
erase eraseAt eraseAtMultiple

Definition at line 594 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseAt ( const NodeIterator iter)
inline

Remove a node by iterator.

Removes the node referenced by iter. The iterator must reference a valid node in this container.

See also
erase eraseMultiple eraseAtMultiple

Definition at line 607 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseAt ( const ConstKeyIterator iter)
inline

Remove a node by iterator.

Removes the node referenced by iter. The iterator must reference a valid node in this container.

See also
erase eraseMultiple eraseAtMultiple

Definition at line 611 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseAt ( const ValueIterator iter)
inline

Remove a node by iterator.

Removes the node referenced by iter. The iterator must reference a valid node in this container.

See also
erase eraseMultiple eraseAtMultiple

Definition at line 615 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class Iter >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseAtMultiple ( const Iter &  begin,
const Iter &  end 
)
inline

Remove multiple nodes by iterator range.

The iterator range must contain iterators that point into this container.

See also
erase eraseAt eraseMultiple

Definition at line 629 of file HashMap.h.

template<class K, class T, class H = boost::hash<K>, class C = std::equal_to<K>, class A = std::allocator<std::pair<const K, T> >>
template<class Iter >
HashMap& Sawyer::Container::HashMap< K, T, H, C, A >::eraseAtMultiple ( const boost::iterator_range< Iter > &  range)
inline

Remove multiple nodes by iterator range.

The iterator range must contain iterators that point into this container.

See also
erase eraseAt eraseMultiple

Definition at line 634 of file HashMap.h.


The documentation for this class was generated from the following file: