Polaris: RefKeyDatabase< S, T > Class Template Reference

RefKeyDatabase< S, T > Class Template Reference

DESCRIPTION

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

#include <RefKeyDatabase.h>

Inheritance diagram for RefKeyDatabase< S, T >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

INLINE RefKeyDatabase ()
INLINE RefKeyDatabase (const RefKeyDatabase< S, T > &m)
virtual INLINE ~RefKeyDatabase ()
INLINE T & ins (S *key, const 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 void print (ostream &out, char *sep1, char *sep2) const
 print database to out with sep1 between key and data and sep2 between each element of the map
INLINE RefKeyDatabase< S,
T > & 
operator= (const RefKeyDatabase< S, T > &l)
 Copy operator completely copies the RefKeyDatabase.
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 RefKeyDatabase< S, T >

DESCRIPTION

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

A template for a database for owned 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 database take a pointer to the key and data and do not allocate space. (i.e., the database aliases whatever is in the list). However, the database takes over ownership of the keys on insert and will delete both a database element and its associated key.

Definition at line 33 of file RefKeyDatabase.h.


Constructor & Destructor Documentation

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

< nothing to do

Definition at line 86 of file RefKeyDatabase.h.

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

< Invoke copy constructor

Definition at line 93 of file RefKeyDatabase.h.

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

< Delete the information before the class disappears.

Definition at line 101 of file RefKeyDatabase.h.

References BaseMapRoot::clear().


Member Function Documentation

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

kill key

Reimplemented from BaseMapRoot.

Definition at line 77 of file RefKeyDatabase.h.

template<class S, class T>
INLINE T & RefKeyDatabase< S, T >::ins S *  key,
const 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 an equivalent key already exists, delete the old one and replace it with the new one.

Definition at line 109 of file RefKeyDatabase.h.

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

Referenced by RefKeyDatabase< S, T >::operator=().

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

delete element with key del_key

Definition at line 125 of file RefKeyDatabase.h.

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

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

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

Definition at line 135 of file RefKeyDatabase.h.

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

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

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

Copy operator completely copies the RefKeyDatabase.

< Clear out current map

< Copy all the items one by one

Definition at line 151 of file RefKeyDatabase.h.

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

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

Needed for Listable class.

Implements Listable.

Definition at line 167 of file RefKeyDatabase.h.

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

Definition at line 174 of file RefKeyDatabase.h.

References RefKeyDatabase< 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:08:04 2005