home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
db02_src.zip
/
search.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1993-11-05
|
542b
|
44 lines
#include <malloc.h>
int headerSize(void)
{
return sizeof(headerData);
}
int tupleSize(void)
{
return keyLength + sizeof(void *);
}
keyType* getKeyAddr(int pos)
{
keyType* key = (keyType*)(data + pos * tupleSize() + sizeof(long));
return key;
}
long* getLinkAddr(int pos)
{
long* link = firstTuple()+pos*tupleSize();
return link;
}
bool searchForKey(object& theObject, int& ptr)
{
int i=0;
while (i < activeKeys)
{
if (theObject.isLess(getKeyAddr(i))
{
ptr = i;
return TRUE;
}
i++;
}
ptr=i;
return FALSE;
}