From 313e28df2a8776c82f5493aef6fe44ad40f1935a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 6 Oct 2010 07:01:28 +0000 Subject: Changed the Bu::Heap to allow iteration, and added lots of cool features to Bu::MiniCron. --- src/tests/heap.cpp | 11 ++++++++--- src/tests/minicron.cpp | 13 ++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src/tests') diff --git a/src/tests/heap.cpp b/src/tests/heap.cpp index 6f68598..7538936 100644 --- a/src/tests/heap.cpp +++ b/src/tests/heap.cpp @@ -38,14 +38,19 @@ typedef struct num } } num; -void printHeap( Bu::Heap &/*h*/, int j ) +void printHeap( Bu::Heap &h, int j ) { - return; +// return; Bu::FString sFName; sFName.format("graph-step-%02d.dot", j ); Bu::File fOut( sFName, Bu::File::WriteNew ); Bu::Formatter f( fOut ); -// h.print( f ); + f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; + for( Bu::Heap::iterator i = h.begin(); i; i++ ) + { + f << *i << f.nl; + } + f << f.nl; } int main() diff --git a/src/tests/minicron.cpp b/src/tests/minicron.cpp index 8abf8ad..0749f90 100644 --- a/src/tests/minicron.cpp +++ b/src/tests/minicron.cpp @@ -41,11 +41,14 @@ void job3( Bu::MiniCron::Job &job ) int main() { - - mCron.addJob( slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) ); - mCron.addJob( slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) ); - mCron.addJob( slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") ); - mCron.addJob( slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) ); + mCron.addJob( + "job0", slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) ); + mCron.addJob( + "job1", slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) ); + mCron.addJob( + "job2", slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") ); + mCron.addJob( + "job3", slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) ); sio << time( NULL ) << ": Program started." << sio.nl; -- cgit v1.2.3