IM: im_counter.h Source File
From IM - An Imaging Tool
im_counter.h
Go to the documentation of this file.00001 /** \file 00002 * \brief Processing Counter 00003 * 00004 * See Copyright Notice in im_lib.h 00005 * $Id: im_counter.h,v 1.1 2005/04/02 22:07:00 scuri Exp $ 00006 */ 00007 00008 #ifndef __IM_COUNTER_H 00009 #define __IM_COUNTER_H 00010 00011 #if defined(__cplusplus) 00012 extern "C" { 00013 #endif 00014 00015 00016 /** \defgroup counter Counter 00017 * \par 00018 * Used to notify the application that a step in the loading, saving or processing operation has been performed. 00019 * \par 00020 * See \ref im_counter.h 00021 * \ingroup util */ 00022 00023 /** Counter callback, informs the progress of the operation to the client. \n 00024 * Text contains a constant string that is NULL during normal counting, a title in the begining of a sequence 00025 * and a message in the begining of a count. 00026 * Counter id identifies diferrent counters. \n 00027 * Progress in a count reports a value from 0 to 1000. If -1 indicates the start of a sequence of operations, 1001 ends the sequence. \n 00028 * If returns 0 the client should abort the operation. \n 00029 * If the counter is aborted, the callback will be called one last time at 1001. 00030 * \ingroup counter */ 00031 typedef int (*imCounterCallback)(int counter, void* user_data, const char* text, int progress); 00032 00033 /** Changes the counter callback. Returns old callback. \n 00034 * User data is changed only if not NULL. 00035 * \ingroup counter */ 00036 imCounterCallback imCounterSetCallback(void* user_data, imCounterCallback counter_func); 00037 00038 /** Begins a new count, or a partial-count in a sequence. \n 00039 * Calls the callback with "-1" and text=title, if it is at the top level. \n 00040 * This is to be used by the operations. Returns a counter Id. 00041 * \ingroup counter */ 00042 int imCounterBegin(const char* title); 00043 00044 /** Ends a count, or a partial-count in a sequence. \n 00045 * Calls the callback with "1001", text=null, and releases the counter if it is at top level count. \n 00046 * \ingroup counter */ 00047 void imCounterEnd(int counter); 00048 00049 /** Increments a count. Must set the total first. \n 00050 * Calls the callback, text=message if it is the first increment for the count. \n 00051 * Returns 0 if the callback aborted, 1 if returns normally. 00052 * \ingroup counter */ 00053 int imCounterInc(int counter); 00054 00055 /** Sets the total increments of a count. 00056 * \ingroup counter */ 00057 void imCounterTotal(int counter, int total, const char* message); 00058 00059 00060 #if defined(__cplusplus) 00061 } 00062 #endif 00063 00064 #endif