/*
 * lineshuffler.hpp
 *
 * Interface definition for the LineShuffler class, which stores a sequence
 * of lines and allows them to be retrieved in random order.
 *
 */

#ifndef LINESHUFFLER_HPP_INCLUDED	// Usual C++ include guard for header
#define LINESHUFFLER_HPP_INCLUDED 1

#include <vector>			
#include <string>
using namespace std;                    // Necessary incantation in ISO C++.

#include "random.hpp"

class LineShuffler {
public:

    /* LineShuffler [constructor]:
     *     In:	    NONE
     * 
     * Creates a new LineShuffler object.  Initially it contains no lines.
     * (isEmpty returns true).
     */
    LineShuffler();

    /* LineShuffler [constructor]:
     *     In:	    unsigned long seed	The seed for the random number
     *					generator.
     * 
     * Creates a new LineShuffler object.  Initially it contains no lines.
     * (isEmpty returns true).
     */
    LineShuffler(unsigned long seed);

    /* removeLine [member function]:
     *     In:	    NONE
     *	   Returns: string		One of the strings previously stored
     *					in the LineShuffler.
     * 
     * This function removes one of the lines stored in the LineShuffler.
     */
    string removeLine();

    /* addLine [member function]:
     *     In:	    string line	Line to add to the collection
     *	   Returns: void		
     *					
     * This function adds a line to the collection stored in the LineShuffler.
     */
    void addLine(const string& line);

    /* addLine [member function]:
     *	   Returns: bool		True if the shuffler is empty		
     *					
     * This function tests whether the LineShuffler is empty.
     */
    bool isEmpty();

private:
    /*
     * Prohibited Operations (assignment & copy construction)
     */
    LineShuffler(const LineShuffler&);
    LineShuffler& operator=(const LineShuffler& rhs);

    /*
     * Private data.
     */

    Random rnd_;			// State of random number generator.
    vector<const char*> lines_;		// Collection (array) of lines (we
					// use raw arrays of characters for
					// a change).
};

#endif // LINESHUFFLER_HPP_INCLUDED


/* Junk to make emacs use the right C++ style when editing this code:
 *   Local Variables:
 *   c-file-style: "stroustrup"
 *   End:
 */
