ROSE  0.9.10.91
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 <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 214 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 217 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 221 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 229 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 238 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 257 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 260 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 270 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 273 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 284 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 287 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 300 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 308 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 313 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 318 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 334 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 349 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 352 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 361 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 382 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 385 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 398 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 404 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 434 of file HashMap.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::Partitioner::findPlaceholder().

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 446 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 450 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 460 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 477 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 490 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 512 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 518 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 530 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 541 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 552 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 562 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 573 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 586 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 599 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 603 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 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> >>
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 621 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 626 of file HashMap.h.


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