drv.h

Go to the documentation of this file.
00001 /*
00002 %M This module contains the driver definitions.
00003 %a Joao Luiz Elias Campos.
00004 %d September 5th, 1998.
00005 %r $Id: drv.h,v 1.1 2004/06/22 05:29:58 joaoluiz Exp $
00006 %w (C) COPYRIGHT 1995-1996, Eduardo Nobre Lages.
00007    (C) COPYRIGHT 1997-1998, Joao Luiz Elias Campos.
00008    All Rights Reserved
00009    Duplication of this program or any part thereof without the express
00010    written consent of the author is prohibited.
00011 */
00012 
00013 #ifndef _DRV_H
00014 #define _DRV_H
00015 
00016 #include "rui.h"
00017 
00018 /*
00019 %T Driver type definition
00020 */
00021 typedef enum _drvtype
00022 {
00023  STANDARD,
00024  STANDARD_VE,
00025  STANDARD_VE_FLAC,
00026  REZONE,
00027  LOAD_STEP,
00028  IMPLINEAR,
00029  IMPNRM,
00030  IMPBFGS,
00031  HYBRID,
00032  LOAD_CASE,
00033  NumDrvTypes
00034 } eDrvType;
00035 
00036 /*
00037 %T Driver data structure definition
00038 */
00039 typedef struct _driver
00040 {
00041  eDrvType type;
00042  void *data;
00043 } sDriver;
00044 
00045 /*
00046 %T Driver class definition
00047 */
00048 typedef struct _drvclass
00049 {
00050  void (*init)(void);
00051  void (*new)(sDriver **);
00052  void (*free)(sDriver *);
00053  int  (*analysis)(UI_State *);
00054  int  (*printres)(int, double *, double *);
00055 } sDrvClass;
00056 
00057 /* Driver class
00058  */
00059 extern sDrvClass DrvClass[NumDrvTypes];
00060 
00061 /* Driver Object
00062  */
00063 extern sDriver *DrvObj;
00064 
00065 /*
00066 ** ------------------------------------------------------------------------
00067 ** Macro definitions:
00068 */
00069 
00070 #define DrvInit(type)                                   \
00071         if(DrvClass[type].init != 0L)                   \
00072          (*DrvClass[type].init)( )
00073 
00074 #define DrvNew(type,drv)                                \
00075         if(DrvClass[type].new != 0L)                    \
00076          (*DrvClass[type].new)( drv )
00077 
00078 #define DrvFree(drv)                                    \
00079         if(DrvClass[drv->type].free != 0L)              \
00080          (*DrvClass[drv->type].free)( drv )
00081 
00082 #define DrvAnalysis(ui,drv)                             \
00083         ((DrvClass[drv->type].analysis != 0L) ?         \
00084          (*DrvClass[drv->type].analysis)(ui) :          \
00085          0)
00086 
00087 #define DrvPrintResult(drv,ite,u,v)                     \
00088         if(DrvClass[drv->type].printres != 0L)          \
00089          (*DrvClass[drv->type].printres)(ite, u, v)
00090 
00091 /* Public functions
00092  */
00093 void DriverInit(void);
00094 void DriverFree(void);
00095 
00096 #endif
00097 

Generated on Tue Oct 23 11:23:29 2007 for Relax by  doxygen 1.5.3