⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btkey.h

📁 用Borland C写的B-Tree算法
💻 H
字号:
/****************************************************************************** * btree-mem-C/btkey.h * * COPYRIGHT (c) 1995, 1997 by David Van Wagner ALL RIGHTS RESERVED * This source may be distributed under the terms of the GNU General Public * License version 2, see the file COPYING for details. * * davevw@alumni.cse.ucsc.edu * http://alumni.cse.ucsc.edu/~davevw/ *****************************************************************************/#ifndef BTKEY_H#define BTKEY_H#include <iostream.h>#include <strstream.h>#include <stdlib.h>#include <memory.h>#include <math.h>#include <time.h>#include "my_assert.h"class BTREE_KEY_LONG {  protected:	signed long lnum;  public:	inline BTREE_KEY_LONG(const signed long n=0) { lnum=n; }	// CONSTRUCTOR	inline int operator ==(const BTREE_KEY_LONG& k) const {	// CONDITIONAL OPS		return lnum == k.lnum; }	inline int operator !=(const BTREE_KEY_LONG& k) const {		return lnum != k.lnum; }	inline int operator >=(const BTREE_KEY_LONG& k) const {		return lnum >= k.lnum; }	inline int operator <=(const BTREE_KEY_LONG& k) const {		return lnum <= k.lnum; }	inline int operator >(const BTREE_KEY_LONG& k) const {		return lnum > k.lnum; }	inline int operator <(const BTREE_KEY_LONG& k) const {		return lnum < k.lnum; }	// OUTPUT TO STREAM/COUT	inline ostream& print(ostream& stream) const { return stream << lnum; }	inline void print() const { print(cout) << endl; }};inline ostream& operator <<(ostream& stream, const BTREE_KEY_LONG& k){	return k.print(stream);}class BTREE_KEY_STR {  protected:	char *str;  public:	inline BTREE_KEY_STR(const char *s=NULL) {		// CONSTRUCTOR		if (s==NULL) {			str = new char[1];			*str = '\0';		} else {			str = new char[strlen(s)+1];			strcpy(str, s);		}	}	inline BTREE_KEY_STR(const BTREE_KEY_STR& k) {	// COPY CONSTRUCTOR		str = new char[strlen(k.str)+1];		strcpy(str, k.str);	}	inline ~BTREE_KEY_STR() { delete [] str; }		// DESTRUCTOR	inline BTREE_KEY_STR& operator =(const BTREE_KEY_STR& k) {	// ASSIGNMENT OP		if (&k != this) {			delete [] str;			str = new char[strlen(k.str)+1];			strcpy(str, k.str);		}		return *this;	}	inline int operator ==(const BTREE_KEY_STR& k) const {	// CONDITIONAL OPS		return strcmp(str, k.str)==0; }	inline int operator !=(const BTREE_KEY_STR& k) const {		return strcmp(str, k.str)!=0; }	inline int operator >=(const BTREE_KEY_STR& k) const {		int result=strcmp(str, k.str);		return result>=0; }	inline int operator <=(const BTREE_KEY_STR& k) const {		int result=strcmp(str, k.str);		return result<=0; }	inline int operator >(const BTREE_KEY_STR& k) const {		return strcmp(str, k.str)>0; }	inline int operator <(const BTREE_KEY_STR& k) const {		return strcmp(str, k.str)<0; }	// STREAM/COUT OUTPUT	inline ostream& print(ostream& stream) const { return stream << str; }	inline void print() const { cout << str; }};inline ostream& operator <<(ostream& stream, const BTREE_KEY_STR& k){	return k.print(stream);}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -