Tools.h++ Class Reference

Table Of Contents
Make sure all buffers used for keys are at least as long as the key length (remember,
storage and comparison will not stop with a null value);
Use a comparison function (such as memcmp()) that ignores nulls.
This class is meant to be used with class RWFileManager which manages the allocation and
deallocation of space in a disk file.
When you construct an RWBTreeOnDisk you give the location of the root node in the
constructor as argument start. If this value is RWNIL (the default) then the location will be
retrieved from the RWFileManager using function start() (see class RWFileManager). You can
also use the enumeration createMode to set whether to use an existing tree (creating one if one
doesn't exist) or to force the creation of a new tree. The location of the resultant root node can be
retrieved using member function baseLocation().
More than one B-tree can exist in a disk file. Each must have its own separate root node. This can
be done by constructing more than one RWBTreeOnDisk, each with createMode set to create.
The order of the B-tree can be set in the constructor. Larger values will result in shallower trees,
but less efficient use of disk space. The minimum number of entries in a node can also be set.
Smaller values may result in less time spent balancing the tree, but less efficient use of disk
space.
Persistence
None
Enumerations
enum styleMode {V6Style, V5Style};
This enumeration is used by the constructor to allow backwards compatibility with older
V5.X style trees, which supported only 16-byte key lengths. It is used only when creating a
new tree. If opening a tree for update, its type is determined automatically at runtime.
V6Style Initialize a new tree using V6.X style trees. This is the default.
V5Style Initialize a new tree using V5.X style trees. In this case, the key length is
fixed at 16 bytes.
enum createMode {autoCreate, create};
This enumeration is used by the constructor to determine whether to force the creation of a
new tree.
autoCreate Look in the location given by the constructor argument start for the root
node. If valid, use it. Otherwise, allocate a new tree. This is the default.
create Forces the creation of a new tree. The argument start is ignored.