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

#include "LogEngineComponent.h"

#include "supervisor/CycleStarter.h"

#ifdef __arm__
const Timespan LogEngineComponent::PERIOD( 0.05 );
#else
const Timespan LogEngineComponent::PERIOD( 0.001 );
#endif

const Timespan LogEngineComponent::TIMEOUT( 0.05 );

// Constructor
LogEngineComponent::LogEngineComponent( LogEngine* logEngine, const char *nameIn )
    : AsyncComponent( nameIn, NULL, PERIOD ),
      logEngine_( logEngine )
{
}

// Destructor
LogEngineComponent::~LogEngineComponent()
{
    if( NULL != logEngine_ )
    {
        delete logEngine_;
    }
}

// Run the component
void LogEngineComponent::run( void )
{
    if( NULL != logEngine_ )
    {
        /// Process the queue
        logEngine_->processQueue( TIMEOUT );
    }
}
