1 /* lutil_meter.h - progress meters */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright (c) 2009 by Emily Backes, Symas Corp.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was initially developed by Emily Backes for inclusion
18 * in OpenLDAP software.
21 #ifndef _LUTIL_METER_H
22 #define _LUTIL_METER_H
28 #include <sys/types.h>
30 #include <ac/stdlib.h>
34 int (*display_open) (void **datap);
35 int (*display_update) (void **datap, double frac, time_t remaining_time, time_t elapsed, double byte_rate);
36 int (*display_close) (void **datap);
37 } lutil_meter_display_t;
40 int (*estimator_open) (void **datap);
41 int (*estimator_update) (void **datap, double start, double frac, time_t *remaining_time);
42 int (*estimator_close) (void **datap);
43 } lutil_meter_estimator_t;
46 const lutil_meter_display_t *display;
48 const lutil_meter_estimator_t *estimator;
49 void * estimator_data;
56 extern const lutil_meter_display_t lutil_meter_text_display;
57 extern const lutil_meter_estimator_t lutil_meter_linear_estimator;
59 extern int lutil_meter_open (
60 lutil_meter_t *lutil_meter,
61 const lutil_meter_display_t *display,
62 const lutil_meter_estimator_t *estimator,
64 extern int lutil_meter_update (
65 lutil_meter_t *lutil_meter,
68 extern int lutil_meter_close (lutil_meter_t *lutil_meter);
70 #endif /* _LUTIL_METER_H */