Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

msd_user.h

00001 /*-----------------------------------------------------
00002  msd_user.h
00003 
00004  Project: PDBe API Framework, EBI  
00005  Module:  User Layer definitions for PDBe API Framework 
00006  This header file is shared in plain C and C++ user applications
00007   
00008  User Layer
00009  Last updated: 25 February 2004 10:17
00010  (C) Siamak Sobhany
00011 ------------------------------------------------------*/
00012 
00013 #ifndef __MSD_USER_H__
00014 #define __MSD_USER_H__
00015 
00016 #define MAXRES 8 /* maximum numberof result objects in the MSDEnv container */
00017 
00018 #ifdef __cplusplus 
00019  #ifndef __MSD_CHEM_H__
00020   #include "msd_chem.h"
00021  #endif
00022  extern "C" {
00023 #endif
00024      
00025      enum msdstatus                     /* object status:*/
00026      { INIT,                            /* connection initialized ok 0 */
00027        ATTACHED,            /* attached to the oracle server 1 */
00028            NOTATTACHED,         /* not attached to the oracle server 2 */
00029            LOGGEDIN,            /* logged in 3 */
00030            NOTLOGGEDIN,         /* not logged in 4 */
00031            NOOBJECT,                    /* object not found 5 */
00032        NOTCONNECTED,        /* not connected  6 */
00033        NORESULTSET,         /* no result  7 */
00034        NOSQLQUERY,          /* no sql query 8 */
00035        LOGGEDOUT,           /* logged out 9 */
00036            NOTLOGGEDOUT,        /* not logged out 10 */
00037        DETACHED,            /* detached from the oracle server 11 */
00038        NOTDETACHED,         /* not detached from the oracle server 12 */
00039        MSDEND               /* msd end 13 */ 
00040          };
00041      
00042          typedef struct MSDNode MSDNode,*MSDValue;
00043          typedef struct MSDEnv MSDEnv,*pMSDEnv;
00044      struct MSDNode {                                   
00045              char type;             /* type of node */     
00046              char flags;                    /* flag bits */            
00047              int id;
00048          MSDValue (*pGetFunc) (pMSDEnv,int);
00049                  union MSDNodeValue {     /* value */           
00050                  int vint;          /* intnode */               
00051                  float vfloat;       /* flonum node */         
00052                  double vdouble;    /* flonum node */          
00053                  int vchcode;       /* character code node */   
00054                  char vchr;         /* character  node */       
00055                  char* vstr;        /* character string node */ 
00056                  
00057                  struct  {
00058                          int year;
00059                          int months;
00060                          int day;
00061                          int hour;
00062                          int minute;
00063                          int second;
00064                  } datetime;
00065                  struct {        /* vector node */          
00066                     int size;         /* vector size */        
00067                     MSDValue *data;          /* vector data */
00068                  } vec;
00069                  
00070                  struct {        /* foreign pointer node */
00071                     MSDValue type;    /* type symbol */
00072                     void *ptr;  /* the pointer */
00073                  } foreignptr;                                 
00074             
00075                 } value;
00076          };
00077          struct MSDEnv
00078      {  int ConID;
00079         int SqlID;
00080                 enum msdstatus stat;
00081                 void* conn;
00082                 void* select;
00083             void* manager;
00084             void* data;
00085                 void* result[MAXRES];
00086                 MSDNode node;
00087      };
00088         
00089         
00090                                         /*((x)->value.flonum)*/
00091     #define MSDGetFloat(x,v)        ((x)->value.vfloat)
00092         #define MSDGetInt(x)            ((x)->value.vint)
00093         #define MSDGetDouble(x)         ((x)->value.vdouble)
00094         #define MSDGetString(x)         ((x)->value.vstr)
00095         #define MSDSetFloat(x,v)            ((x)->value.vfloat = (v))
00096         #define MSDSetInt(x,v)          ((x)->value.vint = (v))
00097     #define MSDSetDouble(x,v)       ((x)->value.vdouble = (v))
00098         #define MSDSetString(x,v)           (strcpy((x)->value.msd_vstr,(v)))
00099     #define MSDGetElement(x,i)      ((x)->value.vec.data[i])
00100         
00101         int msd_init(pMSDEnv msd);
00102         int msd_rlogin(pMSDEnv msd, char* loginstring); /* "msdw1/msdw1@test9i" */  
00103     
00104         #ifdef MSD_ORACLE 
00105         int msd_attach(pMSDEnv msd, char* oserver);
00106     int msd_begin(pMSDEnv msd, char* usern, char* passwd);
00107     int msd_end(pMSDEnv msd); /* end session */ 
00108     int msd_detach(pMSDEnv msd); /* detach from the Oracle server */ 
00109     int msd_disconnect(pMSDEnv msd);
00110    #endif   /*MSD_ORACLE  */ 
00111     int msd_logoff(pMSDEnv msd);
00112     int msd_free(pMSDEnv msd);
00113     int msd_select (pMSDEnv msd ,char* stm);
00114     int msd_sqlinit (pMSDEnv msd, char* stm);
00115     int msd_setcriteria(pMSDEnv msd, const char* fmt,...); /* viod criteria */ /* vaiable number of args */
00116     int msd_getrownum(pMSDEnv msd);
00117     int msd_getnext(pMSDEnv msd);
00118         
00119         MSDValue msd_getvfloat(pMSDEnv msd,int col);
00120         MSDValue msd_getvint(pMSDEnv msd,int col);
00121         MSDValue msd_getvstr(pMSDEnv msd,int col);
00122         MSDValue msd_getvdouble(pMSDEnv msd,int col);
00123         MSDValue msd_getvalue(pMSDEnv msd,int col, MSDValue (*pGetFunc)(pMSDEnv,int));
00124    #define MSDGetValue(e,n,f,p) do { \
00125                                                  MSDValue x = msd_getvalue((&e),(n), (msd_get##p)); \
00126                                              (f) = (x->value.p); \
00127                                               break; \
00128                                         } while (0)   /*return;*/
00129 
00130         
00131         
00132         float msd_ugetfloat(pMSDEnv msd,int col);
00133         int msd_ugetint(pMSDEnv msd,int col);
00134         char* msd_ugetstr(pMSDEnv msd,int col,char* s);
00135         double  msd_ugetdouble(pMSDEnv msd,int col);
00136         
00137         #ifdef __WITH_XMMDB__
00138      int msd_manager(pMSDEnv msd);
00139      int msd_get_number_of_atoms(pMSDEnv msd);
00140          int msd_get_object_entry (pMSDEnv msd, int n_eID);
00141          
00142         #endif
00143         char* msd_get_accession_code(pMSDEnv msd, int e_ID);
00144     int msd_get_entry_id(pMSDEnv msd, char* acc_code);
00145         
00146         
00147         
00148         int msd_lisp_init(int argc, char* argv[]);
00149     int msd_lisp_load(char * fn);
00150     int msd_lisp_eval(void);
00151     int msd_write_table_attributes(char* schema, char* connstr, char* fname);
00152         int msd_soap_data_generator(char* schema, char* connstr, char* fname);
00153     int msd_get_tables_relations(char* schema, char* connstr);
00154     int msd_get_datamodel(char* schema, char* connstr);
00155         int msd_load_metadata(char* schema, char* connstr);
00156 
00157 #ifdef __cplusplus
00158 }
00159 #endif 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 #endif /* __MSD_USER_H__ */ 
00169 

Generated on Fri Apr 16 13:47:44 2004 for MSDAPI by doxygen 1.3.4-20031005