/** \file
 *
 *  Contains the TextTableLogWriter class definition.
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 *
 */


#ifndef TEXTTABLELOGWRITER_H_
#define TEXTTABLELOGWRITER_H_

#include "TableLogWriter.h"

class OutStream;

class ElementURI;

/**
 *  Defines a LogWriter that generates a text table of values.  A list of
 *  variable names is supplied to the constructor.  If any of these variables
 *  change their value in a computation cycle, then a new line is added to the
 *  text table listing the current value of every variable.
 *
 *  See FileLogWriter for output to the filesystem.
 *
 *  \ingroup logging
 */
class TextTableLogWriter : public TableLogWriter
{
public:
    /// Constructor.
    TextTableLogWriter( const char* separator, int varCount, char** varList, char** unitList, bool hideUnits = false, bool interpolate = false );

    /// Destructor.
    virtual ~TextTableLogWriter();

    unsigned int writeHeader();

    unsigned int writeFooter();

private:
    // Note that the copy constructor below is private and not given a body.
    // Any attempt to call it will return a compiler error.
    TextTableLogWriter( const TextTableLogWriter& old ); // disallow copy constructor

    void initializeTextTableLogWriter();
    unsigned int writeRow();
    unsigned int writeToColumn( const DataEntry *dataEntry, const int column );

    const char* separator_;
    bool hideUnits_;

    Str* valueStrings_;

    char buf_[ 80 ];
};

#endif /*TEXTTABLELOGWRITER_H_*/
