ROSE  0.9.9.109
Classes | Public Types | Public Member Functions | List of all members
Sawyer::Container::Map< K, T, Cmp, Alloc > Class Template Reference

Description

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
class Sawyer::Container::Map< K, T, Cmp, Alloc >

Container associating values with keys.

This container is similar to the std::map container in the standard template library, but with these differences in addition to those described in the documentation for the Sawyer::Container name space:

Definition at line 64 of file Sawyer/Map.h.

#include <Map.h>

Inheritance diagram for Sawyer::Container::Map< K, T, Cmp, Alloc >:
Inheritance graph
[legend]

Classes

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

Public Types

typedef K Key
 Type for keys. More...
 
typedef T Value
 Type for values associated with each key. More...
 
typedef Cmp Comparator
 Type of comparator, third template argument. More...
 
typedef Alloc Allocator
 Type of allocator, fourth template argument. More...
 

Public Member Functions

 Map ()
 Default constructor. More...
 
 Map (const Comparator &comparator, const Allocator &allocator=Allocator())
 Constructs an empty map. More...
 
 Map (const Map &other)
 Copy constructor. More...
 
template<class Key2 , class T2 , class Cmp2 , class Alloc2 >
 Map (const Map< Key2, T2, Cmp2, Alloc2 > &other)
 Copy constructor. More...
 
template<class Key2 , class T2 , class Cmp2 , class Alloc2 >
Mapoperator= (const Map< Key2, T2, Cmp2, Alloc2 > &other)
 Make this map be a copy of another map. More...
 
bool isEmpty () const
 Determines whether this container is empty. More...
 
size_t size () const
 Number of nodes, keys, or values in this container. More...
 
Key least () const
 Returns the minimum key. More...
 
Key greatest () const
 Returns the maximum key. More...
 
Interval< Keyhull () const
 Returns the range of keys in this map. 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...
 
Mapinsert (const Key &key, const Value &value)
 Insert or update a key/value pair. More...
 
MapinsertDefault (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 >
MapinsertMaybeMultiple (const boost::iterator_range< OtherNodeIterator > &range)
 Conditionally insert multiple key/value pairs. More...
 
Mapclear ()
 Remove all nodes. More...
 
Maperase (const Key &key)
 Remove a node with specified key. More...
 
template<class OtherKeyIterator >
MaperaseMultiple (const boost::iterator_range< OtherKeyIterator > &range)
 Remove keys stored in another Map. 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...
 
NodeIterator find (const Key &key)
 Find a node by key. More...
 
ConstNodeIterator find (const Key &key) const
 Find a node by key. More...
 
NodeIterator lowerBound (const Key &key)
 Find a node close to a key. More...
 
ConstNodeIterator lowerBound (const Key &key) const
 Find a node close to a key. More...
 
NodeIterator upperBound (const Key &key)
 Find a node close to a key. More...
 
ConstNodeIterator upperBound (const Key &key) const
 Find a node close to a 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 return an existing value. More...
 
const Valueget (const Key &key) const
 Lookup and return 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 >
MapinsertMultiple (const OtherNodeIterator &begin, const OtherNodeIterator &end)
 Insert multiple values. More...
 
template<class OtherNodeIterator >
MapinsertMultiple (const boost::iterator_range< OtherNodeIterator > &range)
 Insert multiple values. More...
 
MaperaseAt (const NodeIterator &iter)
 Remove a node by iterator. More...
 
MaperaseAt (const ConstKeyIterator &iter)
 Remove a node by iterator. More...
 
MaperaseAt (const ValueIterator &iter)
 Remove a node by iterator. More...
 
template<class Iter >
MaperaseAtMultiple (const Iter &begin, const Iter &end)
 Remove multiple nodes by iterator range. More...
 
template<class Iter >
MaperaseAtMultiple (const boost::iterator_range< Iter > &range)
 Remove multiple nodes by iterator range. More...
 

Member Typedef Documentation

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
typedef K Sawyer::Container::Map< K, T, Cmp, Alloc >::Key

Type for keys.

Definition at line 66 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
typedef T Sawyer::Container::Map< K, T, Cmp, Alloc >::Value

Type for values associated with each key.

Definition at line 67 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
typedef Cmp Sawyer::Container::Map< K, T, Cmp, Alloc >::Comparator

Type of comparator, third template argument.

Definition at line 68 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
typedef Alloc Sawyer::Container::Map< K, T, Cmp, Alloc >::Allocator

Type of allocator, fourth template argument.

Definition at line 69 of file Sawyer/Map.h.

Constructor & Destructor Documentation

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Sawyer::Container::Map< K, T, Cmp, Alloc >::Map ( )
inline

Default constructor.

Creates an empty map.

Definition at line 223 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Sawyer::Container::Map< K, T, Cmp, Alloc >::Map ( const Comparator comparator,
const Allocator allocator = Allocator() 
)
inlineexplicit

Constructs an empty map.

This is like the default constructor, but a comparer and allocator can be specified.

Definition at line 228 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Sawyer::Container::Map< K, T, Cmp, Alloc >::Map ( const Map< K, T, Cmp, Alloc > &  other)
inline

Copy constructor.

Definition at line 232 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class Key2 , class T2 , class Cmp2 , class Alloc2 >
Sawyer::Container::Map< K, T, Cmp, Alloc >::Map ( const Map< Key2, T2, Cmp2, Alloc2 > &  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 other map to this map.

Definition at line 241 of file Sawyer/Map.h.

Member Function Documentation

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class Key2 , class T2 , class Cmp2 , class Alloc2 >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::operator= ( const Map< Key2, T2, Cmp2, Alloc2 > &  other)
inline

Make this map be a copy of another map.

The keys and values of the other map must be convertible to the types used for this map.

Definition at line 252 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<NodeIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::nodes ( )
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstNodeIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::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 274 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstKeyIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::keys ( )
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstKeyIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::keys ( ) const
inline

Iterators for container keys.

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

Definition at line 287 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ValueIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::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 298 of file Sawyer/Map.h.

Referenced by Sawyer::Container::IntervalMap< Interval, int >::values().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
boost::iterator_range<ConstValueIterator> Sawyer::Container::Map< K, T, Cmp, Alloc >::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 301 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
bool Sawyer::Container::Map< K, T, Cmp, Alloc >::isEmpty ( ) const
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
size_t Sawyer::Container::Map< K, T, Cmp, Alloc >::size ( void  ) const
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Key Sawyer::Container::Map< K, T, Cmp, Alloc >::least ( ) const
inline

Returns the minimum key.

The map must not be empty.

Definition at line 327 of file Sawyer/Map.h.

Referenced by Sawyer::Container::Map< rose_addr_t, BasicBlockConfig >::hull().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Key Sawyer::Container::Map< K, T, Cmp, Alloc >::greatest ( ) const
inline

Returns the maximum key.

The map must not be empty.

Definition at line 333 of file Sawyer/Map.h.

Referenced by Sawyer::Container::Map< rose_addr_t, BasicBlockConfig >::hull().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Interval<Key> Sawyer::Container::Map< K, T, Cmp, Alloc >::hull ( ) const
inline

Returns the range of keys in this map.

The return value is an interval containing the least and greatest keys, inclusive. If the map is empty then an empty interval is returned.

This method is only defined when the map key type is appropriate for the Interval class template (such as when the keys are an integer type).

Definition at line 347 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
NodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::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. Two keys are considered equal if this container's Comparator object returns false reflexively. The method executes logorithmic time based on the number of nodes in the container.

Definition at line 364 of file Sawyer/Map.h.

Referenced by Sawyer::Attribute::Storage<>::attributeOrDefault(), Sawyer::Container::DistinctList< size_t >::erase(), Sawyer::Attribute::Storage<>::getAttribute(), Sawyer::Attribute::Storage<>::optionalAttribute(), Sawyer::Container::DistinctList< size_t >::pushBack(), and Sawyer::Container::DistinctList< size_t >::pushFront().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
ConstNodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::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. Two keys are considered equal if this container's Comparator object returns false reflexively. The method executes logorithmic time based on the number of nodes in the container.

Definition at line 367 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
bool Sawyer::Container::Map< K, T, Cmp, Alloc >::exists ( const Key key) const
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
NodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::lowerBound ( const Key key)
inline

Find a node close to a key.

Finds the first node whose key is equal to or larger than the specified key and returns an iterator to that node. If no such node exists, then the end iterator is returned. The internal Comparator object is used to make the comparison. This method executes in logorithmic time based on the number of nodes in the container.

See also
upperBound

Definition at line 390 of file Sawyer/Map.h.

Referenced by Sawyer::Container::IntervalMap< Interval, int >::lowerBound().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
ConstNodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::lowerBound ( const Key key) const
inline

Find a node close to a key.

Finds the first node whose key is equal to or larger than the specified key and returns an iterator to that node. If no such node exists, then the end iterator is returned. The internal Comparator object is used to make the comparison. This method executes in logorithmic time based on the number of nodes in the container.

See also
upperBound

Definition at line 393 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
NodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::upperBound ( const Key key)
inline

Find a node close to a key.

Finds the first node whose key is larger than the specified key and returns an iterator to that node. If no such node exists, then the end iterator is returned. The internal Comparator object is used to make the comparison. This method executes in logorithmic time based on the number of nodes in the container.

See also
lowerBound

Definition at line 407 of file Sawyer/Map.h.

Referenced by Sawyer::Container::IntervalMap< Interval, int >::upperBound().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
ConstNodeIterator Sawyer::Container::Map< K, T, Cmp, Alloc >::upperBound ( const Key key) const
inline

Find a node close to a key.

Finds the first node whose key is larger than the specified key and returns an iterator to that node. If no such node exists, then the end iterator is returned. The internal Comparator object is used to make the comparison. This method executes in logorithmic time based on the number of nodes in the container.

See also
lowerBound

Definition at line 410 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 433 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 436 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::get ( const Key key)
inline

Lookup and return 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 449 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::get ( const Key key) const
inline

Lookup and return 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 455 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Optional<Value> Sawyer::Container::Map< K, T, Cmp, Alloc >::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. This method executes in logorithmic time.

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

...
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 486 of file Sawyer/Map.h.

Referenced by Sawyer::Attribute::Storage<>::attributeOrElse(), Rose::BinaryAnalysis::Partitioner2::GraphViz::BaseEmitter< G >::emitVertex(), Rose::BinaryAnalysis::Partitioner2::Partitioner::findPlaceholder(), Sawyer::Attribute::Storage<>::getAttribute(), and Sawyer::Container::GraphBimapIndex< VertexOrEdgeKey, VertexOrEdgeConstIterator >::lookup().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 498 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 502 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
const Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 513 of file Sawyer/Map.h.

Referenced by Rose::BinaryAnalysis::Partitioner2::Partitioner::addressName(), Sawyer::CommandLine::ParserResult::have(), and Rose::BinaryAnalysis::Partitioner2::GraphViz::BaseEmitter< ControlFlowGraph >::subgraphOrganization().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::insert ( const Key key,
const Value value 
)
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 543 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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:

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

Definition at line 566 of file Sawyer/Map.h.

Referenced by Sawyer::Container::IntervalMap< Interval, int >::erase(), and Sawyer::Container::Map< rose_addr_t, BasicBlockConfig >::insertMultiple().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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:

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

Definition at line 572 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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. This method executes in logarithmic time. 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 584 of file Sawyer/Map.h.

Referenced by Sawyer::Container::Map< rose_addr_t, BasicBlockConfig >::insertMaybeMultiple(), and SgAsmType::registerOrDelete().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Value& Sawyer::Container::Map< K, T, Cmp, Alloc >::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. This method executes in logarithmic time. 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 595 of file Sawyer/Map.h.

Referenced by Rose::BinaryAnalysis::RegisterParts::insert(), and Rose::BinaryAnalysis::Partitioner2::GraphViz::BaseEmitter< ControlFlowGraph >::subgraphOrganization().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class OtherNodeIterator >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 606 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::clear ( )
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::erase ( const Key key)
inline
template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class OtherKeyIterator >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::eraseMultiple ( const boost::iterator_range< OtherKeyIterator > &  range)
inline

Remove keys stored in another Map.

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. The method executes in N log(N+M) time.

See also
erase eraseAt eraseAtMultiple

Definition at line 642 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 655 of file Sawyer/Map.h.

Referenced by Sawyer::Container::DistinctList< size_t >::erase(), and Sawyer::Container::IntervalMap< Interval, int >::insert().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 659 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 667 of file Sawyer/Map.h.

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class Iter >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 681 of file Sawyer/Map.h.

Referenced by Sawyer::Container::IntervalMap< Interval, int >::erase().

template<class K, class T, class Cmp = std::less<K>, class Alloc = std::allocator<std::pair<const K, T> >>
template<class Iter >
Map& Sawyer::Container::Map< K, T, Cmp, Alloc >::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 686 of file Sawyer/Map.h.


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