databases::NameCollection Class Reference

A collection for named records. More...

#include <collection.h>

Inheritance diagram for databases::NameCollection:

databases::Collection

List of all members.

Public Types

typedef
containers::Hash
< NameRecord *, char
const * > 
name_hash
 Type of the name hash.
typedef
name_hashlist::iterator 
niterator
 Normal name iterator type.
typedef
name_hashlist::const_iterator 
const_niterator
 Const name iterator type.
typedef
name_hashlist::reverse_iterator 
reverse_niterator
 Reverse name iterator type.
typedef
name_hashlist::const_reverse_iterator 
const_reverse_niterator
 Const reverse name iterator type.

Public Member Functions

 NameCollection (name_hash &hash)
 Constructor.
virtual bool change_name (NameRecord *record, char const *newname)
 Notifies the collection that a record's name has changed.
niterator nbegin ()
 Returns an iterator for the beginning of the name collection.
niterator nend ()
 Returns an iterator to the end of the name collection.
const_niterator nbegin () const
 Returns a const iterator for the beginning of the name collection.
const_niterator nend () const
 Returns a const iterator to the end of the name collection.
reverse_niterator nrbegin ()
 Returns a reverse iterator to the beginning of the name collection.
reverse_niterator nrend ()
 Returns a reverse iterator to the end of the name collection.
const_reverse_niterator nrbegin () const
 Returns a const reverse iterator to the beginning of the name collection.
const_reverse_niterator nrend () const
 Returns a const reverse iterator to the end of the name collection.
virtual size_t memory_usage () const
 Same as Collection::memory_usage().
NameRecordnfind (char const *name)
 Finds a record in the collection, by name.
NameRecord const * nfind (char const *name) const
 Const version of nfind().

Protected Types

typedef
containers::HashList
< NameRecord *, char
const *,
name_hashsize
name_hashlist
 Type of the name hash list.

Protected Member Functions

virtual bool add_list (Record *record)
 Same as Collection::add_list().
virtual void remove_list (Record *record)
 Same as Collection::remove_list().
virtual void clear_list ()
 Same as Collection::clear_list().

Protected Attributes

name_hashlist m_nmembers
 The collection members, searchable by names.

Static Protected Attributes

static uint32_t const name_hashsize = NAME_HASH_SIZE
 Size of the name hash list.


Detailed Description

This collection adds methods to search records by names. It works on records derived from NameRecord.

Constructor & Destructor Documentation

databases::NameCollection::NameCollection ( name_hash hash  )  [inline, explicit]

Constructor.

Parameters:
[in] hash The hash to use with the name hashlist.


Member Function Documentation

virtual bool databases::NameCollection::change_name ( NameRecord record,
char const *  newname 
) [virtual]

Notifies the collection that a record's name has changed. The collection will then update itself so that it can find the record through its new name.

Parameters:
[in] record The record, whose name() function should return its old name. If (record == newname) yields true, then the function won't do anything.
[in] newname The new name of the record.
Returns:
true if successful, false otherwise. In the latter case, the caller should cancel the name change as the record will STILL be in the collection under its old name.

NameRecord* databases::NameCollection::nfind ( char const *  name  ) 

Finds a record in the collection, by name.

Parameters:
[in] name The name of the record to find.
Returns:
A pointer to the found record, or 0 if it was not found.


The documentation for this class was generated from the following file:
Generated on Fri Apr 18 22:03:28 2008 for Epona API by  doxygen 1.5.3