/* $Id: progresslog.cpp,v 1.3 2005/06/28 13:55:21 chfreund Exp $ */ #include "progresslog.hpp" #include /********************************************************** * class Progress **********************************************************/ Progress::Progress( const int TitleLockLength ) : m_Title( TitleLockLength ), m_Progress( 0.0 ), m_TitleIsValid( false ) { } /**********************************************************/ Progress::~Progress() { } /**********************************************************/ void Progress::setTitle( const char* const title ) { DBG( 1 ) { CHECK( m_Title.isLocked(), "Progress::setTitle(\"%s\"): title string is not" "locked\n", title ); } m_Title = title; m_TitleIsValid = true; } /********************************************************** * class ProgressLog **********************************************************/ ProgressLog::ProgressLog() : m_Progress( NULL ), m_nLevels( 0 ) { } /**********************************************************/ ProgressLog::ProgressLog( const int TitleLockLength, const int nLevels ) { ASSERT( create(TitleLockLength, nLevels), "ProgressLog::ProgressLog: failed creation\n" ); } /**********************************************************/ ProgressLog::~ProgressLog() { reset(); } /**********************************************************/ bool ProgressLog::create( const int TitleLockLength, const int nLevels ) { const char fn[] = "ProgressLog::create"; reset(); // create array of logging levels ASSERT( NULL != (m_Progress = NEW Progress [m_nLevels = nLevels]), "%s: could not create array of %d progress objects\n", fn, nLevels ); // initialize progress levels for( int i = 0; i < nLevels; i++ ) { if( TitleLockLength >= 0 ) { ASSERT( m_Progress[i].lockTitleLength(TitleLockLength), "%s: could not lock title string to %d characters\n", fn, TitleLockLength ); } } return true; } /**********************************************************/ void ProgressLog::reset() { delete [] m_Progress; m_Progress = NULL; m_nLevels = 0; } /**********************************************************/