# waitcallback.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: waitcallback.h,v $
    00003  -------------------
    00004  cvs         : $Id: waitcallback.h,v 1.25 2005/04/30 07:54:55 aquamaniac Exp $
    00005  begin       : Sat Jan 17 2004
    00006  copyright   : (C) 2004 by Martin Preuss
    00007  email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028
    00029 #ifndef GWEN_WAIT_CALLBACK_H
    00030 #define GWEN_WAIT_CALLBACK_H
    00031
    00032 #include <gwenhywfar/gwenhywfarapi.h>
    00033 #include <gwenhywfar/inherit.h>
    00034 #include <gwenhywfar/misc.h>
    00035 #include <gwenhywfar/logger.h>
    00036
    00037 #ifdef __cplusplus
    00038 extern "C" {
    00039 #endif
    00040 typedef struct GWEN_WAITCALLBACK GWEN_WAITCALLBACK;
    00041 GWEN_LIST_FUNCTION_LIB_DEFS(GWEN_WAITCALLBACK, GWEN_WaitCallback, GWENHYWFAR_API)
    00042 GWEN_INHERIT_FUNCTION_LIB_DEFS(GWEN_WAITCALLBACK, GWENHYWFAR_API)
    00043 /* No trailing semicolon here because this is a macro call */
    00044 #ifdef __cplusplus
    00045 }
    00046 #endif
    00047
    00048
    00049 #include <gwenhywfar/types.h>
    00050
    00051
    00052 #ifdef __cplusplus
    00053 extern "C" {
    00054 #endif
    00055
    00075
    00076
    00077 #include <time.h>
    00078
    00079 #define GWEN_WAITCALLBACK_PROGRESS_NONE ((GWEN_TYPE_UINT64)(0xffffffffffffffff))
    00080
    00084 typedef enum {
    00086   GWEN_WaitCallbackResult_Continue=0,
    00088   GWEN_WaitCallbackResult_Abort
    00089 } GWEN_WAITCALLBACK_RESULT;
    00090
    00091
    00096
    00108 typedef
    00109   GWEN_WAITCALLBACK_RESULT
    00110   (*GWEN_WAITCALLBACK_CHECKABORTFN)(GWEN_WAITCALLBACK *ctx,
    00111                                     unsigned int level);
    00112
    00113
    00121 typedef
    00122   GWEN_WAITCALLBACK*
    00123   (*GWEN_WAITCALLBACK_INSTANTIATEFN)(GWEN_WAITCALLBACK *ctx);
    00124
    00125
    00138 typedef
    00139   void
    00140   (*GWEN_WAITCALLBACK_LOGFN)(GWEN_WAITCALLBACK *ctx,
    00141                              unsigned int level,
    00142                              GWEN_LOGGER_LEVEL loglevel,
    00143                              const char *s);
    00151
    00157 GWENHYWFAR_API
    00158   GWEN_WAITCALLBACK_RESULT GWEN_WaitCallback();
    00159
    00160 GWENHYWFAR_API
    00161 void GWEN_WaitCallback_free(GWEN_WAITCALLBACK *ctx);
    00162
    00169 GWENHYWFAR_API
    00170   GWEN_WAITCALLBACK_RESULT GWEN_WaitCallbackProgress(GWEN_TYPE_UINT64 pos);
    00171
    00172
    00173 GWENHYWFAR_API
    00174   void GWEN_WaitCallback_Enter_u(const char *id,
    00175                                  const char *file,
    00176                                  int line);
    00177
    00187 #define GWEN_WaitCallback_Enter(id) \
    00188   GWEN_WaitCallback_Enter_u(id, __FILE__, __LINE__)
    00189
    00190
    00195 GWENHYWFAR_API
    00196   void GWEN_WaitCallback_Leave();
    00197
    00202 GWENHYWFAR_API
    00203   void GWEN_WaitCallback_Log(GWEN_LOGGER_LEVEL logLevel,
    00204                              const char *s);
    00212
    00217 GWENHYWFAR_API
    00218   void GWEN_WaitCallback_SetProgressTotal(GWEN_TYPE_UINT64 total);
    00219
    00225 GWENHYWFAR_API
    00226   void GWEN_WaitCallback_SetProgressPos(GWEN_TYPE_UINT64 pos);
    00227
    00235 GWENHYWFAR_API
    00236   int GWEN_WaitCallback_GetDistance(GWEN_WAITCALLBACK *ctx);
    00237
    00242 GWENHYWFAR_API
    00243 int GWEN_WaitCallback_GetNestingLevel(const GWEN_WAITCALLBACK *ctx);
    00244
    00248 GWENHYWFAR_API
    00249   int GWEN_WaitCallback_Register(GWEN_WAITCALLBACK *ctx);
    00250
    00251 GWENHYWFAR_API
    00252   int GWEN_WaitCallback_Unregister(GWEN_WAITCALLBACK *ctx);
    00253
    00254
    00255 #if (defined(GWEN_EXTEND_WAITCALLBACK) || defined(DOXYGEN))
    00256
    00261
    00262 GWENHYWFAR_API
    00263   const char *GWEN_WaitCallback_GetId(GWEN_WAITCALLBACK *ctx);
    00264
    00269 GWENHYWFAR_API
    00270   GWEN_WAITCALLBACK *GWEN_WaitCallback_new(const char *id);
    00271
    00278 GWENHYWFAR_API
    00279   GWEN_TYPE_UINT64
    00280   GWEN_WaitCallback_GetProgressPos(GWEN_WAITCALLBACK *ctx);
    00281
    00288 GWENHYWFAR_API
    00289   GWEN_TYPE_UINT64
    00290   GWEN_WaitCallback_GetProgressTotal(GWEN_WAITCALLBACK *ctx);
    00291
    00295 GWENHYWFAR_API
    00296   void
    00297   GWEN_WaitCallback_SetCheckAbortFn(GWEN_WAITCALLBACK *ctx,
    00298                                     GWEN_WAITCALLBACK_CHECKABORTFN fn);
    00299
    00303 GWENHYWFAR_API
    00304   void
    00305   GWEN_WaitCallback_SetInstantiateFn(GWEN_WAITCALLBACK *ctx,
    00306                                      GWEN_WAITCALLBACK_INSTANTIATEFN fn);
    00307
    00311 GWENHYWFAR_API
    00312   void
    00313   GWEN_WaitCallback_SetLogFn(GWEN_WAITCALLBACK *ctx,
    00314                              GWEN_WAITCALLBACK_LOGFN fn);
    00315
    00320 GWENHYWFAR_API
    00321   time_t GWEN_WaitCallback_LastCalled(GWEN_WAITCALLBACK *ctx);
    00322
    00323
    00328 GWENHYWFAR_API
    00329   time_t GWEN_WaitCallback_LastEntered(GWEN_WAITCALLBACK *ctx);
    00330
    00331
    00337 GWENHYWFAR_API
    00338   void GWEN_WaitCallback_SetDistance(GWEN_WAITCALLBACK *ctx,
    00339                                      int d);
    00342 #endif
    00343
    00344
    00345
    00349 #ifdef __cplusplus
    00350 }
    00351 #endif
    00352
    00353
    00354 #endif
    00355