Database Key Class


Topics:

Overview
Conditional Directives
Constants
Type Definitions
Enumerations
Data Members
Functions


Overview

The DatabaseKeyB base class is an abstract base class used to define database key types and the methods by which database keys are sorted. Database keys are used by the B-tree class for searching and sorting structured data and indexing associated objects or records stored in a data file.

In this implementation all database keys must be derived from the abstract DatabaseKeyB base class. The DatabaseKeyB class operates independently of actual key type allowing it to work with any type of data. The derived class is responsible for defining key comparison methods thus enabling you to define how the keys are sorted in the B-tree.


Public Data Members

FAU DatabaseKeyB::right_child - File pointer to the right child.

void *DatabaseKeyB::db_key - Memory pointer to the database key.


Functions

DatabaseKeyB::DatabaseKeyB()
DatabaseKeyB::~DatabaseKeyB()
DatabaseKeyB::KeySize()
DatabaseKeyB::SizeOfDatabaseKey()
DatabaseKeyB::operator==()
DatabaseKeyB::operator>()

DatabaseKeyB::DatabaseKeyB(void *kptr) - Class constructor used to construct a DatabaseKeyB object and initialize the database key pointer variable.

DatabaseKeyB::DatabaseKeyB(const DatabaseKeyB &ob) - Protected member copy constructor. Copying is only permitted in the derived class.

DatabaseKeyB& DatabaseKeyB::operator=(const DatabaseKeyB &ob) - Protected member assignment operator. Assignment is only permitted in the derived class.

virtual DatabaseKeyB::~DatabaseKeyB() - Virtual class destructor that does not perform any operations. The derived class is responsible for de-allocating memory allocated for database key.

virtual size_t DatabaseKeyB::KeySize() - Pure virtual function overridden in the derived class to return the database key size. The key size must equal the size of the data pointed to by the "DatabaseKeyB::db_key" pointer.

size_t DatabaseKeyB::SizeOfDatabaseKey() - Public member function that returns the total size of the database key which is equal to: DatabaseKeyB::KeySize() + sizeof(right_child).

virtual int DatabaseKeyB::operator==(const DatabaseKeyB& key) const = 0 - Pure virtual function overridden in the derived class to compare database keys. Must return true if this key is equal to the specified key or false if the keys are not equal.

virtual int operator&DatabaseKeyB::>(const DatabaseKeyB& key) const = 0 - Pure virtual function overridden in the derived class to compare database keys. Must return true if this key is greater then the specified key or false if this key is less then or equal to the specified key.


End Of Document