Polaris: Database< S, T > Class Template Reference

Database< S, T > Class Template Reference

#include <Database.h>

Inheritance diagram for Database< S, T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

INLINE Database ()
INLINE Database (const Database< S, T > &m)
virtual INLINE ~Database ()
INLINE T & ins (const S &key, T *data)
 Insert element with (key, data) into the database, 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 (const S &del_key)
 grab 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 Database< S, T > & operator= (const Database< S, T > &l)
 Copy operator completely copies the Database.
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)

Detailed Description

template<class S, class T>
class Database< S, T >

DESCRIPTION

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

A template for a database 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 database is implemented as a tree of pointers to whatever type is specified. Thus, all methods to insert elements into a database take a reference to the key and a pointer to the data and do not allocate space. (i.e., the database aliases whatever is inserted). However, the database takes over ownership of the data on insert and will delete only a map element and not its associated key.

Definition at line 38 of file Database.h.


Constructor & Destructor Documentation

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

< nothing to do

Definition at line 93 of file Database.h.

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

< Invoke copy constructor

Definition at line 100 of file Database.h.

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

< Delete the information before the class disappears.

Definition at line 108 of file Database.h.

References BaseMapRoot::clear().


Member Function Documentation

template<class S, class T>
INLINE void Database< 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 83 of file Database.h.

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

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

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

Definition at line 132 of file Database.h.

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

Referenced by InterPCodeDomain::_add_whole_pgms_interproc(), IntraPCodeDomain::_build_map(), BinRep::_ief_parse(), AIRangeDict::_set_range(), build_def_map(), build_in_out_set(), build_in_out_sets(), EquivalenceDict::clean(), define_switch(), InterPCodeDomain::expand_context_after(), IntraPCodeDomain::expand_context_after(), InterPCodeDomain::expand_context_before(), IntraPCodeDomain::expand_context_before(), FormatDB::FormatDB(), KeySet< S >::ins(), Dictionary< T >::ins(), InterPCodeDomain::InterPCodeDomain(), main(), Database< S, T >::operator=(), optimize_ssa_zero(), register_instance(), SEARCH(), stmt_toporder(), and Equivalence::write().

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

delete element with key del_key

Reimplemented in KeySet< S >.

Definition at line 150 of file Database.h.

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

Referenced by KeySet< S >::del(), Dictionary< T >::del(), BinRep::del(), main(), and unregister_instance().

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

grab an element with key del_key

Definition at line 166 of file Database.h.

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

Referenced by EquivalenceDict::clean(), KeySet< S >::grab(), Dictionary< T >::grab(), main(), read_pu(), and Equivalence::write().

template<class S, class T>
INLINE void Database< 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 116 of file Database.h.

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

Referenced by Dictionary< T >::print(), and Database< S, T >::print().

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

Copy operator completely copies the Database.

< Clear out current map

< Copy all the items one by one

Definition at line 177 of file Database.h.

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

Referenced by FormatDB::FormatDB(), Program::operator=(), FormatDB::operator=(), Dictionary< T >::operator=(), and Program::Program().

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

Needed for Listable class.

Implements Listable.

Definition at line 192 of file Database.h.

template<class S, class T>
INLINE void Database< 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 Dictionary< T >, FormatDB, Program, Dictionary< CommonBlock >, Dictionary< VoidPtrDef >, Dictionary< Equivalence >, Dictionary< Symbol >, and Dictionary< Namelist >.

Definition at line 199 of file Database.h.

References Database< 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:09 2005