Polaris: Map< S, T > Class Template Reference

Map< S, T > Class Template Reference

#include <Map.h>

Inheritance diagram for Map< S, T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

INLINE Map ()
INLINE Map (const Map< S, T > &m)
virtual INLINE ~Map ()
INLINE T & ins (const S &key, T *data)
 Insert element with (key, data) into the map, and return a reference to '*data' (for purposes of programming convenience).
INLINE void del (S &del_key)
 delete element with key del_key (run-time error if none exists)
INLINE T * grab (S &del_key)
 remove and return an element with key del_key
INLINE void print (ostream &out, char *sep1, char *sep2) const
 print map to out with sep1 between key and data and sep2 between each element of the map
INLINE Map< S, T > & operator= (const Map< S, T > &l)
 Copy operator completely copies the Map.
INLINE Listablelistable_clone () const
 Needed for Listable class.
INLINE void print (ostream &o) const
 Needed for Listable class.

Protected Member Functions

virtual INLINE void _kill_key (BMKey &key)
 kill key

Detailed Description

template<class S, class T>
class Map< S, T >

DESCRIPTION

Map<key,data> owns(data), address(key)

A template for a map for keys of type S to owned objects of type T where:

    1.  'S' is a class with:
    a) <, == and << operators taking S& arguments.
    b) a copy constructor S(S &) to clone the
    input object or simple enough structure
    for the default copy constructor to work.
   
    2.  'T' is a class derived from Listable.

The map is implemented as a tree of pointers to whatever type is specified. Thus, all methods to insert elements into a map take a reference to the key and a pointer to the data and do not allocate space. (i.e., the map aliases whatever is in the list). However, the map takes over ownership of the data on insert and will delete both a map element.

Definition at line 37 of file Map.h.


Constructor & Destructor Documentation

template<class S, class T>
INLINE Map< S, T >::Map  ) 
 

Definition at line 91 of file Map.h.

template<class S, class T>
INLINE Map< S, T >::Map const Map< S, T > &  m  ) 
 

< Invoke copy constructor

Definition at line 101 of file Map.h.

template<class S, class T>
INLINE Map< S, T >::~Map  )  [virtual]
 

< Delete the information before the class disappears.

Definition at line 113 of file Map.h.

References BaseMapRoot::clear().


Member Function Documentation

template<class S, class T>
virtual INLINE void Map< S, T >::_kill_key BMKey key  )  [protected, virtual]
 

kill key

Reimplemented from BaseMapRoot.

template<class S, class T>
INLINE T & Map< S, T >::ins const S &  key,
T *  data
 

Insert element with (key, data) into the map, and return a reference to '*data' (for purposes of programming convenience).

If a node with an equivalent key already exists, delete the old one and replace it with the new one.

Definition at line 125 of file Map.h.

References BMKey::_keyptr, BaseMapRoot::ins(), and BaseMapRoot::remove().

Referenced by _create_new_consts(), _create_old_const_mods(), _filter_out_mod_params(), SSAFullRangeDict::_get_range_ref(), GSAFullRangeDict::_get_range_ref(), _update_old_consts(), AliasSets::AliasSets(), ar_interleave(), GSAPathExpr::clone(), DefLocMap::DefLocMap(), Statement::ins_read_access(), Statement::ins_readwrite_access(), Statement::ins_write_access(), VDL::install_expr(), main(), InlineObject::make_conformable(), MakeDefMap(), Map< S, T >::operator=(), AliasSets::print(), process(), PropCtrlRangeWS::PropCtrlRangeWS(), Statement::relink_lptrs(), InlineObject::remap_arg_names(), SymbolAccessRefMap::remap_interface_vars(), remove_assigned_goto_stmts(), StmtRanges::set_range(), RangeAccessor::set_range(), RangeComparator::signz(), and TranslateObject::TranslateObject().

template<class S, class T>
INLINE void Map< S, T >::del S &  del_key  ) 
 

delete element with key del_key (run-time error if none exists)

Definition at line 144 of file Map.h.

References BMKey::_keyptr, and BaseMapRoot::remove().

Referenced by StmtRanges::del_range(), IPCPConstants::filter_out_vars_not_in_set(), main(), and DefLocMap::remove_invalid_defloc().

template<class S, class T>
INLINE T * Map< S, T >::grab S &  del_key  ) 
 

remove and return an element with key del_key

Definition at line 160 of file Map.h.

References BMKey::_keyptr, and BaseMapRoot::remove().

Referenced by StmtRanges::grab_range(), main(), and Statement::relink_lptrs().

template<class S, class T>
INLINE void Map< S, T >::print ostream &  out,
char *  sep1,
char *  sep2
const
 

print map to out with sep1 between key and data and sep2 between each element of the map

Reimplemented from ProtoMap< S, T >.

Definition at line 171 of file Map.h.

References BMKey::_keyptr, and ProtoMap< S, T >::_print().

Referenced by Map< S, T >::print(), and process().

template<class S, class T>
INLINE Map< S, T > & Map< S, T >::operator= const Map< S, T > &  m  ) 
 

Copy operator completely copies the Map.

< Clear out current map

< Copy all the items one by one

Definition at line 187 of file Map.h.

References BaseMapRoot::clear(), and Map< S, T >::ins().

template<class S, class T>
INLINE Listable * Map< S, T >::listable_clone  )  const [virtual]
 

Needed for Listable class.

Implements Listable.

Reimplemented in GSAPathExpr.

Definition at line 202 of file Map.h.

template<class S, class T>
INLINE void Map< S, T >::print ostream &  o  )  const [virtual]
 

Needed for Listable class.

It invokes a non-virtual member function to print a representation of the data structure at this level of the Collection hierarchy, and, since it is not a class member function, it must be explicitly instantiated before use.

Implements Listable.

Reimplemented in GSAPathExpr.

Definition at line 209 of file Map.h.

References Map< S, T >::print().


The documentation for this class was generated from the following file:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:07:47 2005