/* * stringstore.hpp * * Created on: Nov 18, 2010 * Author: mike * for use in Yale course CPSC 427a, Fall 2010 */ #pragma once // Singleton string store class #define MAXLETS 10000 // maximum number of characters in store // ========================================================================== class StringStore { private: static StringStore* instance; char* letters; // String storage area. int remain; // Space remaining in current Pool. int next; // Subscript of next available slot. // private constructor StringStore(int sz=MAXLETS): letters(new char[sz]), remain(sz), next(0) {} public: ~StringStore(){ delete [] letters; } static StringStore& getStore(); const char* put( const char* s, int ln ); };