//## begin module%1.7%.codegen_version preserve=yes // Read the documentation to learn more about C++ code generator // versioning. //## end module%1.7%.codegen_version //## begin module%4211C91D02DE.cm preserve=no //## end module%4211C91D02DE.cm //## begin module%4211C91D02DE.cp preserve=no // C O P Y R I G H T N O T I C E // This material is confidential to ERG and may not be disclosed in whole // or in part to any third party nor used in any manner whatsoever other // than for the purposes expressly consented to by ERG in writing. // // This material is also copyright and may not be reproduced, stored in a // retrieval system or transmitted in any form or by any means in whole or // in part without the express written consent of ERG. //## end module%4211C91D02DE.cp //## Module: TimeEstimate%4211C91D02DE; Pseudo Package body //## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4 //## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\TimeEstimate.cpp //## begin module%4211C91D02DE.additionalIncludes preserve=no //## end module%4211C91D02DE.additionalIncludes //## begin module%4211C91D02DE.includes preserve=yes //## end module%4211C91D02DE.includes // TimeEstimate #include "TimeEstimate.h" //## begin module%4211C91D02DE.additionalDeclarations preserve=yes //## end module%4211C91D02DE.additionalDeclarations // Class TimeEstimate //## Operation: TimeEstimate%4211CC9F029D TimeEstimate::TimeEstimate (TStatusPanel &panel) //## begin TimeEstimate::TimeEstimate%4211CC9F029D.hasinit preserve=no : m_panel(0), m_position(0), m_step( 0, 0, 2, 500 ), m_total(0) //## end TimeEstimate::TimeEstimate%4211CC9F029D.hasinit //## begin TimeEstimate::TimeEstimate%4211CC9F029D.initialization preserve=yes //## end TimeEstimate::TimeEstimate%4211CC9F029D.initialization { //## begin TimeEstimate::TimeEstimate%4211CC9F029D.body preserve=yes m_panel = &panel; //## end TimeEstimate::TimeEstimate%4211CC9F029D.body } TimeEstimate::~TimeEstimate() { //## begin TimeEstimate::~TimeEstimate%4211C91D02DE_dest.body preserve=yes stop(); m_panel = 0; // We don't own this. //## end TimeEstimate::~TimeEstimate%4211C91D02DE_dest.body } //## Other Operations (implementation) //## Operation: increment%4211CA05001F void TimeEstimate::increment (const unsigned int &delta) { //## begin TimeEstimate::increment%4211CA05001F.body preserve=yes update( m_position + delta ); //## end TimeEstimate::increment%4211CA05001F.body } //## Operation: start%4211C99F032C void TimeEstimate::start (const unsigned int &total) { //## begin TimeEstimate::start%4211C99F032C.body preserve=yes m_total = total; m_position = 0; m_start = m_update = TDateTime::CurrentDateTime(); //## end TimeEstimate::start%4211C99F032C.body } //## Operation: stop%4211C99F031C void TimeEstimate::stop () { //## begin TimeEstimate::stop%4211C99F031C.body preserve=yes m_panel->Text = ""; m_position = 0; m_total = 0; //## end TimeEstimate::stop%4211C99F031C.body } //## Operation: update%4211CA05002E void TimeEstimate::update (const unsigned int &position) { //## begin TimeEstimate::update%4211CA05002E.body preserve=yes // Do this only if we're open. if ( m_total ) { m_position = position; const TDateTime now = TDateTime::CurrentDateTime(); if ( now - m_update >= m_step ) { const double scale = double( m_total ) / double( m_position ); const double duration = now - m_start; const double estimate = ( duration * scale ) - duration; m_panel->Text = "Estimated Time Remaining: " + TDateTime( estimate ).FormatString( "tt" ); Application->ProcessMessages(); m_update = now; } } //## end TimeEstimate::update%4211CA05002E.body } // Additional Declarations //## begin TimeEstimate%4211C91D02DE.declarations preserve=yes //## end TimeEstimate%4211C91D02DE.declarations //## begin module%4211C91D02DE.epilog preserve=yes //## end module%4211C91D02DE.epilog