Polaris: RefDatabase< S, T > Class Template Reference

RefDatabase< S, T > Class Template Reference

DESCRIPTION

RefDatabase<key,data> owns(), value(key) More...

#include <RefDatabase.h>

Inheritance diagram for RefDatabase< S, T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

INLINE RefDatabase ()
 < implementation
INLINE RefDatabase (const RefDatabase< S, T > &m)
virtual INLINE ~RefDatabase ()
INLINE T & ins (const S &key, const 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
INLINE T * grab_ref (const S &del_key)
 return a reference to an element and delete 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 RefDatabase< S, T > & operator= (const RefDatabase< S, T > &l)
 Copy operator completely copies the RefDatabase.
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 (in this class, kill the owned key copy)

Friends

class KeyIterator<S, T>

Detailed Description

template<class S, class T>
class RefDatabase< S, T >

DESCRIPTION

RefDatabase<key,data> owns(), value(key)

A template for a database for keys of type S to 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 database is implemented as a tree of pointers to whatever type is specified. Thus, all methods to insert elements into a map take a pointer reference to the key and data and do not allocate space. (i.e., the database aliases whatever is inserted).

Definition at line 35 of file RefDatabase.h.


Constructor & Destructor Documentation

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

< implementation

< nothing to do

Definition at line 82 of file RefDatabase.h.

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

< Invoke copy constructor

Definition at line 89 of file RefDatabase.h.

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

< Delete the information before the class disappears.

Definition at line 97 of file RefDatabase.h.

References BaseMapRoot::clear().


Member Function Documentation

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

kill key (in this class, kill the owned key copy)

< Kill the owned copy of the original key

Reimplemented from BaseMapRoot.

Definition at line 105 of file RefDatabase.h.

template<class S, class T>
INLINE T & RefDatabase< S, T >::ins const S &  key,
const 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 115 of file RefDatabase.h.

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

Referenced by _determine_entry_points(), _iterate_to_fixed_point(), Program::compute_call_lists(), Program::entry_points(), main(), RefDatabase< S, T >::operator=(), replace_lambda_call(), and SEARCH().

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

delete element with key del_key

Definition at line 131 of file RefDatabase.h.

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

Referenced by main().

template<class S, class T>
INLINE T * RefDatabase< S, T >::grab_ref const S &  del_key  ) 
 

return a reference to an element and delete element with key del_key

Definition at line 142 of file RefDatabase.h.

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

template<class S, class T>
INLINE void RefDatabase< 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

Definition at line 153 of file RefDatabase.h.

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

Referenced by RefDatabase< S, T >::print().

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

Copy operator completely copies the RefDatabase.

< Clear out current map

< Copy all the items one by one

Definition at line 169 of file RefDatabase.h.

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

Referenced by EntryPoints::operator=().

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

Needed for Listable class.

Implements Listable.

Definition at line 183 of file RefDatabase.h.

template<class S, class T>
INLINE void RefDatabase< 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 EntryPoints.

Definition at line 190 of file RefDatabase.h.

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


Friends And Related Function Documentation

template<class S, class T>
friend class KeyIterator<S, T> [friend]
 

Definition at line 36 of file RefDatabase.h.


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:08:03 2005