// Created by Frank M. Carrano and Tim Henry. // Copyright (c) 2013 __Pearson Education__. All rights reserved. // Listing 19-1. /** A class of nodes for a link-based 2-3 tree. @file TriNode.h */ #ifndef _TRI_NODE #define _TRI_NODE template class TriNode { private: ItemType smallItem, largeItem; // Data portion TriNode* leftChildPtr; // Left-child pointer TriNode* midChildPtr; // Middle-child pointer TriNode* rightChildPtr; // Right-child pointer public: TriNode(); TriNode(const ItemType& anItem); TriNode(const ItemType& anItem, TriNode* leftPtr, TriNode* midPtr, TriNode* rightPtr); bool isLeaf() const; bool isTwoNode() const; bool isThreeNode() const; ItemType getSmallItem() const; ItemType getLargeItem() const; void setSmallItem(const ItemType& anItem); void setLargeItem(const ItemType& anItem); TriNode* getLeftChildPtr() const; TriNode* getMidChildPtr() const; TriNode* getRightChildPtr() const; void setLeftChildPtr(TriNode* leftPtr); void setMidChildPtr(TriNode* midPtr); void setRightChildPtr(TriNode* rightPtr); }; // end TriNode #include "TriNode.cpp" #endif