Itzam/C++

Main Index

Created by Scott Robert Ladd at Coyote Gulch Productions.


itzam::btree_index< key_t, mutex_t > Class Template Reference

Unique key index. More...

#include <complex_database.h>

Inheritance diagram for itzam::btree_index< key_t, mutex_t >:

itzam::btree_index_base< key_t, mutex_t > itzam::database_object List of all members.

Public Member Functions


Detailed Description

template<class key_t, class mutex_t = simple_mutex>
class itzam::btree_index< key_t, mutex_t >

This index type only supports unique keys -- as in, each key is associated with a single record reference. Duplicate keys are forbidden, and will generate an exception if they occur.
Parameters:
key_t A key type, derived from data_t, implementing a static member function for comparing keys
mutex_t A mutex type; by default, this is a null_mutex that does not perform locking


Constructor & Destructor Documentation

template<class key_t, class mutex_t = simple_mutex>
itzam::btree_index< key_t, mutex_t >::btree_index const string &  name,
itzam_file_lock_mode  lock_mode
[inline]
 

Creates a index object. If name exists, the file is opened as an index; otherwise, the requested file is created and initialized. The base class constructor performs an implicit open on the index.

Parameters:
name Database file name
lock_mode File-locking mode

template<class key_t, class mutex_t = simple_mutex>
itzam::btree_index< key_t, mutex_t >::~btree_index  )  [inline]
 

Automatically closes an index, if it is not closed already.


Member Function Documentation

template<class key_t, class mutex_t = simple_mutex>
virtual bool itzam::btree_index< key_t, mutex_t >::exists const key_t &  key  )  [inline, virtual]
 

Checks to see if a key already exists in the index

Parameters:
key The unique key identifying the index to be removed
Returns:
true is the key exists; false if it does not

Implements itzam::btree_index_base< key_t, mutex_t >.

template<class key_t, class mutex_t = simple_mutex>
virtual itzam_ref itzam::btree_index< key_t, mutex_t >::find const key_t &  key  )  [inline, virtual]
 

Searches the index for the given key, and returns the asscociate record reference.

Parameters:
key The unique key identifying the index to be removed
Returns:
A reference for rge record indeified by key; ITZAM_NULL_REF if the key was not found

template<class key_t, class mutex_t = simple_mutex>
virtual void itzam::btree_index< key_t, mutex_t >::insert const key_t &  key,
itzam_ref  ref
[inline, virtual]
 

Adds a new index that associates the given key with a record reference. Duplicate keys are forbidden, and will generate an exception if they occur.

Parameters:
key The unique key
ref Record reference to be associated with key

Implements itzam::btree_index_base< key_t, mutex_t >.

template<class key_t, class mutex_t = simple_mutex>
virtual itzam_ref itzam::btree_index< key_t, mutex_t >::remove const key_t &  key  )  [inline, virtual]
 

Removes the given key from the index.

Parameters:
key The unique key


The documentation for this class was generated from the following file:

© 1996-2005 Scott Robert Ladd. All rights reserved.
HTML documentation generated by Dimitri van Heesch's excellent Doxygen tool.