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

#ifndef DECIMATIONLOGWRITER_H_
#define DECIMATIONLOGWRITER_H_

#include "LogWriter.h"
#include <ctype.h>

class DataValue;

/// Base class for a generalized set of "log data destinations," including
/// to files (text or binary), over communications links, etc.
///
/// \ingroup logging
class DecimationLogWriter : public LogWriter
{
public:

    enum DecimationType
    {
        UNDEFINED_DECIMATION = -1,
        NO_DECIMATION,
        ALL_DATA,
        LINEAR_APPROXIMATION,
        MOST_RECENT,
        DECIMATION_COUNT,
        DECIMATION_MULTI,
    };

    static const char* DecimationType2Str( DecimationLogWriter::DecimationType decimationType );

    static DecimationType Str2DecimationType( const char* const typeStr, int len = -1 );

    static const char* const DECIMATION_TYPE_STRS[DECIMATION_COUNT];

    static const size_t DECIMATION_TYPE_STRLEN[DECIMATION_COUNT];

    /// Constructor
    DecimationLogWriter( LogWriter& outputTo, DecimationType decimationType )
        : LogWriter(),
          outputTo_( outputTo ),
          decimationType_( decimationType )
    {}

    /// Destructor
    virtual ~DecimationLogWriter()
    {}

    DecimationType getDecimationType() const
    {
        return decimationType_;
    }

    virtual void setParameter( DataValue* parameter, Logger& logger ) {}

    virtual unsigned int flush()
    {
        return 0;
    }

protected:

    /// Stores an LogWriter.
    LogWriter& outputTo_;

    /// Stores the decimationType
    DecimationType decimationType_;

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

};

#endif /*DECIMATIONLOGWRITER_H_*/
