xdr_p.h

00001 /* 
00002    EyeDB Object Database Management System
00003    Copyright (C) 1994-2008 SYSRA
00004    
00005    EyeDB is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009    
00010    EyeDB is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014    
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with this library; if not, write to the Free Software
00017    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA 
00018 */
00019 
00020 /*
00021    Author: Eric Viara <viara@sysra.com>
00022 */
00023 
00024 
00025 #ifndef _EYEDBSM_XDR_P_H
00026 #define _EYEDBSM_XDR_P_H
00027 
00028 #include <xdr_off.h>
00029 #include <eyedbsm/xdr.h>
00030 
00031 namespace eyedbsm {
00032 
00033   extern void x2h_oidloc(OidLoc *oidloc, const void *addr);
00034   extern void h2x_oidloc(void *addr, OidLoc *oidloc);
00035 
00036   extern unsigned int x2h_getSize(unsigned int);
00037   extern unsigned int x2h_makeValid(unsigned int size);
00038 
00039   extern void x2h_mapHeader(MapHeader *hmap, const MapHeader *xmap);
00040   extern void h2x_mapHeader(MapHeader *xmap, const MapHeader *hmap);
00041 
00042   extern void x2h_dbHeader(DbHeader *hdbh, const DbHeader *xdbh);
00043   extern void h2x_dbHeader(DbHeader *xdbh, const DbHeader *hdbh);
00044 
00045   extern void x2h_protoids(Oid *prot_lock_oid, Oid *prot_list_oid,
00046                            Oid *prot_uid_oid, DbHeader *dbh);
00047 
00048   extern void h2x_protoids(Oid *prot_lock_oid, Oid *prot_list_oid,
00049                            Oid *prot_uid_oid, DbHeader *dbh);
00050 
00051 #define x2h_prologue(XMP, MP) \
00052   unsigned char buf[MapHeader_SIZE + 8]; \
00053   POINTER_INT_TYPE buf_off_8 = reinterpret_cast<POINTER_INT_TYPE>(&buf) & 0x7; \
00054   unsigned char *buf_align_8 = (buf_off_8) ? buf - buf_off_8 + 0x8 : buf; \
00055   MapHeader _tmp_(buf_align_8), *MP = &_tmp_; \
00056   x2h_mapHeader(MP, XMP)
00057 
00058 #define h2x_epilogue(XMP, MP) \
00059   h2x_mapHeader(XMP, MP)
00060 }
00061 
00062 #endif

Generated on Mon Dec 22 18:16:15 2008 for eyedb by  doxygen 1.5.3