Source of Listing18-5.h


  1: //  Created by Frank M. Carrano and Timothy M. Henry.
  2: //  Copyright (c) 2017 Pearson Education, Hoboken, New Jersey.

  4: // Listing 18-5.

  6: /** A class of entry objects for a hashing implementation of the
  7:     ADT dictionary.
  8:  @file HashedEntry.h */
  9:  
 10: #ifndef _HASHED_ENTRY
 11: #define _HASHED_ENTRY

 13: #include "Entry.h"

 15: template<class KeyType, class ValueType>
 16: class HashedEntry : public Entry<KeyType, ValueType>
 17: {
 18: private:
 19:    std::shared_ptr<HashedEntry<KeyType, ValueType>> nextPtr;
 20:    
 21: public:
 22:    HashedEntry();
 23:    HashedEntry(KeyType searchKey, ValueType newValue);
 24:    HashedEntry(KeyType searchKey, ValueType newValue,
 25:                std::shared_ptr<HashedEntry<KeyType, ValueType>> nextEntryPtr);
 26:                
 27:    void setNext(std::shared_ptr<HashedEntry<KeyType, ValueType>> nextEntryPtr nextEntryPtr);
 28:    auto getNext() const;
 29: }; // end HashedEntry

 31: #include "HashedEntry.cpp"
 32: #endif