timer.h

Go to the documentation of this file.
00001 /*
00002     libparted - a library for manipulating disk partitions
00003     Copyright (C) 2001, 2002 Free Software Foundation, Inc.
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00018 */
00019 
00027 #ifndef PED_TIMER_H_INCLUDED
00028 #define PED_TIMER_H_INCLUDED
00029 
00030 #include <time.h>
00031 
00032 typedef struct _PedTimer PedTimer;
00033 
00034 typedef void PedTimerHandler (PedTimer* timer, void* context);
00035 
00036 /*
00037  * Structure keeping track of progress and time
00038  */
00039 struct _PedTimer {
00040         float                   frac;           
00041         time_t                  start;          
00042         time_t                  now;            
00043         time_t                  predicted_end;  
00044         const char*             state_name;     
00045         PedTimerHandler*        handler;        
00046         void*                   context;        
00047 };
00048 
00049 extern PedTimer* ped_timer_new (PedTimerHandler* handler, void* context);
00050 extern void ped_timer_destroy (PedTimer* timer);
00051 
00052 /* a nested timer automatically notifies it's parent.  You should only
00053  * create one when you are going to use it (not before)
00054  */
00055 extern PedTimer* ped_timer_new_nested (PedTimer* parent, float nest_frac);
00056 extern void ped_timer_destroy_nested (PedTimer* timer);
00057 
00058 extern void ped_timer_touch (PedTimer* timer);
00059 extern void ped_timer_reset (PedTimer* timer);
00060 extern void ped_timer_update (PedTimer* timer, float new_frac);
00061 extern void ped_timer_set_state_name (PedTimer* timer, const char* state_name);
00062 
00063 #endif /* PED_TIMER_H_INCLUDED */
00064 
00065 

Generated on Fri May 4 05:15:31 2007 for libparted by  doxygen 1.5.2