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

#include "AllLogWriter.h"

#include "io/OutStream.h"


/// Constructor
AllLogWriter::AllLogWriter( LogWriter& outputTo )
    : DecimationLogWriter( outputTo, DecimationLogWriter::ALL_DATA )
{}

// Destructor
AllLogWriter::~AllLogWriter()
{}

/// Write the log header, if any
unsigned int AllLogWriter::writeHeader()
{
    unsigned int bytesSent( 0 );
    bytesSent += outputTo_.writeHeader();
    wroteHeader_ = true;
    return bytesSent;
}

/// Write the given LogEntry - should lock the writeMutex_
unsigned int AllLogWriter::write( const LogEntry* entry, const Unit* unit )
{
    unsigned int bytesSent( 0 );
    bytesSent += outputTo_.write( entry, unit );
    return bytesSent;
}

/// Do what needs to be done at the end of the cycle.
void AllLogWriter::endCycle()
{
    outputTo_.endCycle();
}

/// Write the log footer, if any
unsigned int AllLogWriter::writeFooter()
{
    unsigned int bytesSent( 0 );
    bytesSent += outputTo_.writeFooter();
    return bytesSent;
}
