/* Declaration of class Row.

------------------------------------------------------------------*/

typedef double TableElement;              // simplify changing
                                          //     element type
class Row
{
   TableElement                           // pointer to one-dim array
      *Array;

   unsigned                               // length of the array
     Length_;

public:

   /*------------------------------------------------------------------
      This function constructs a Row.

      Precondition:   A Row object has been declared.
      Receive:        N, the number of elements to be allocated
                        (default 0)
      Postcondition:  In the Row containing this function the Length_
                        member is set to N, and the Array member
                        contains the address of an array of N
                        elements (or the NULL address).
   -------------------------------------------------------------------*/
   Row(unsigned N = 0);

   /*------------------------------------------------------------------
      This function makes a copy of a Row.

      Precondition:  The compiler needs a copy of a Row.
      Receive:       OrigRow, the Row being copied
      Postcondition: In the Row containing this function,
                        the Length_ member is set to OrigRow.Length_,
                        and the Array member contains the address of
                        an array that is a copy of OrigRow's array
                        (or the NULL address).
   ------------------------------------------------------------------*/
   Row(const Row& OrigRow);

   /*------------------------------------------------------------------
      This function tears down a Row.

      Precondition:  The Row containing this function should cease to
                        exist.
      Postcondition: The run-time storage of this Row has been
                        deallocated, and its members are set
                        appropriately as an empty Row.
   ------------------------------------------------------------------*/
   ~Row(void);

   /*------------------------------------------------------------------
      This function performs the subscript operation on a Row object.

      Receive: i, an integer value;
      Return:  The element of the array pointed to by Array whose
                  index is i (assuming that i is a valid index).
   ------------------------------------------------------------------*/
   TableElement& operator[](unsigned i);

   /*------------------------------------------------------------------
      This function assigns a Row.

      Receive: RowObj, a Row object
      Return:  The Row containing this function, as a distinct copy of
                  RowObj
   ------------------------------------------------------------------*/
   Row& operator=(const Row& RowObj);

};

