eyedb_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 _EYEDB_EYEDB_P_H
00026 #define _EYEDB_EYEDB_P_H
00027 
00028 #include <eyedb/eyedb.h>
00029 #include <eyedb/ObjCache.h>
00030 #include <eyedblib/xdr.h>
00031 #include <eyedbsm/xdr.h>
00032 #include <eyedb/IteratorAtom.h>
00033 #include <eyedb/Iterator.h>
00034 #include <eyedb/api_lib.h>
00035 #include <eyedb/base_p.h>
00036 #include <eyedb/internals/ObjectHeader.h>
00037 #include <eyedb/ObjCache.h>
00038 #include <eyedb/make_obj.h>
00039 #include <eyedb/code.h>
00040 #include <eyedb/SchemaInfo.h>
00041 #include <eyedblib/log.h>
00042 #include <eyedb/Log.h>
00043 #include <string>
00044 #include <eyedblib/probe.h>
00045 #include <eyedblib/strutils.h>
00046 
00047 #include <assert.h>
00048 
00049 /*extern "C" {*/
00050 #include <eyedb/misc.h>
00051 /*}*/
00052 
00053 #include <eyedb/internals/kern_const.h>
00054 #include <eyedb/internals/ObjectPeer.h>
00055 #include <eyedb/ConnectionPeer.h>
00056 #include <eyedb/internals/ClassPeer.h>
00057 #include <eyedb/CollectionPeer.h>
00058 #include <eyedb/BufferString.h>
00059 #include <eyedb/GenContext.h>
00060 #include <eyedb/Argument_code.h>
00061 #include <eyedb/Argument.h>
00062 #include <eyedb/Executable.h>
00063 #include <eyedb/odlgen_utils.h>
00064 #include <eyedblib/std_alloc.h>
00065 
00066 namespace eyedbsm {
00067   extern Boolean trace_idx;
00068   extern Boolean trace_idx_sync;
00069   extern FILE *trace_idx_fd;
00070 }
00071 
00072 namespace eyedb {
00073 
00074   enum {
00075     StructClass_Code = 100,
00076     UnionClass_Code
00077   };
00078 
00079 #define idbVarDim(X) (-(X))
00080   //#define idbWholeSize ((Size)0xffffffff)
00081 
00082   extern eyedbsm::Oid ClassOidDecode(Data);
00083 
00084 #define idbNumber(X) (sizeof(X)/sizeof(X[0]))
00085 
00086   extern Status StatusMake(RPCStatus);
00087   extern Status StatusMake(Error, RPCStatus);
00088   extern RPCStatus rpcStatusMake(Status);
00089   extern Status StatusMake(Error, RPCStatus, const char *, ...);
00090   extern DbHandle *database_getDbHandle(Database *db);
00091   extern void (*garbage_handler)(void);
00092 
00093 #define mcp(D, S, N) \
00094 { \
00095   int __n__ = (N); \
00096   char *__d__ = (char *)(D), *__s__ = (char *)(S); \
00097   while(__n__--) \
00098     *__d__++ = *__s__++; \
00099 }
00100 
00101 #define mset(D, V, N) \
00102 { \
00103   int __n__ = (N); \
00104   char *__d__ = (char *)(D); \
00105   while(__n__--) \
00106     *__d__++ = V; \
00107 }
00108 
00109 void setBackendInterrupt(Bool);
00110 Bool isBackendInterrupted();
00111 extern void setServerMessage(const char *msg);
00112 extern void setServerOutOfBandData(unsigned int type, unsigned char *data,
00113                                        unsigned int len);
00114 #define IDB_SERVER_MESSAGE 1
00115 
00116 #define IDB_CHECK_INTR() \
00117 if (isBackendInterrupted()) \
00118 { \
00119     setBackendInterrupt(False); \
00120     return Exception::make(IDB_BACKEND_INTERRUPTED, ""); \
00121 }
00122 
00123 extern const char *eyedb_time();
00124 
00125 #define IDB_VECT
00126 
00127 #define idbNewVect(T, N) (T *)calloc(sizeof(T), N)
00128 
00129 #define idbFreeVect(X, T, N) \
00130   { \
00131     for (int i = 0; i < N; i++) \
00132       (X)[i].~T(); \
00133     free((char *)X); \
00134   }
00135 
00136 #define idbFreeIndVect(X, N) \
00137   { \
00138     for (int i = 0; i < N; i++) \
00139       delete (X)[i]; \
00140     free((char *)X); \
00141   }
00142 
00143 #define IDB_CLASS_NAME_LEN 33
00144 #define IDB_CLASS_NAME_OVERHEAD 1
00145 #define IDB_CLASS_NAME_TOTAL_LEN (IDB_CLASS_NAME_LEN+IDB_CLASS_NAME_OVERHEAD)
00146 #define IDB_CLASS_NAME_PAD (IDB_CLASS_NAME_LEN-8) // assert(sizeof(eyedbsm::Oid)==8)
00147 
00148 #define IDB_NAME_OUT_PLACE ((char)1)
00149 #define IDB_NAME_IN_PLACE  ((char)2)
00150 
00151 extern FILE *get_file(Bool init = True);
00152 extern std::ostream& convert_to_stream(std::ostream &);
00153 
00154 #define IDB_LOCAL_CALL ((void *)0xff125341)
00155 
00156 #define IDB_COLL_LOAD_DEFERRED() \
00157 if (!is_complete) \
00158  { \
00159   Status __s = loadDeferred(); \
00160   if (__s) return __s; \
00161  }
00162 
00163 extern Status post_etc_update(Database *);
00164 extern Status
00165 class_name_code(DbHandle *dbh, short dspid, Data *idr,
00166                     Offset *offset, Size *alloc_size, const char *name);
00167 
00168 extern Status
00169 class_name_decode(DbHandle *dbh, Data idr, Offset *offset,
00170                       char **name);
00171 extern p_ProbeHandle *eyedb_probe_h;
00172 
00173 #define IDB_CHECK_WRITE(DB) \
00174   if (!DB) \
00175     return Exception::make(IDB_ERROR, "no database associated with object"); \
00176   if (!((DB)->getOpenFlag() & _DBRW)) \
00177     return Exception::make(IDB_ERROR, "database is not opened for writing");
00178 
00179 #define IDB_COLLCACHE_OPT1 // added 24/07/01
00180 #define IDB_COLLMOD_OPT1   // added 24/07/01
00181 
00182 #define CHK_VALID(O) \
00183   if (!(O)->isValidObject()) \
00184     return Exception::make(IDB_ERROR, "object %p is not a valid runtime object", O)
00185 
00186 #define CHK_DAMAGED(O) \
00187 if ((O)->getDamaged()) \
00188    return Exception::make(IDB_ERROR, \
00189           "attribute %s of object %p of class %s has been damaged " \
00190           "during a prematured release", \
00191           (O)->getDamaged()->getName(), O, (O)->getClass()->getName())
00192 
00193 #define CHK_OBJ(O) \
00194   CHK_VALID(O); \
00195   CHK_DAMAGED(O)
00196 
00197 #define GBX_SUSPEND() gbxAutoGarbSuspender _gbxsusp_
00198 //#define GBX_SUSPEND() gbxAutoGarb _gbxsusp_(gbxAutoGarb::SUSPEND)
00199 
00200 #define AnyUserData ((void *)1)
00201 
00202 //#define IDB_UNDEF_ENUM_HINT
00203 
00204 #define IDB_NEWATTRNAT_VERSION 206002
00205 //#define IDB_SKIP_HASH_XCOEF
00206 
00207 #define IDB_IDX_MAGIC_HINTS 12
00208 #define IDB_IDX_MAGIC_HINTS_VALUE 0x8efea341
00209 
00210 #define IDB_ATTR_IS_STRING 0x8000
00211 
00212 #define CHECK_INCSIZE(MTHNAME, INCSIZE, SZ)  \
00213   if ((INCSIZE) != (SZ)) { \
00214     std::cerr << name << "::" << MTHNAME << " size: " << INCSIZE << " vs. " << SZ << std::endl; \
00215     assert(0); \
00216   }
00217 
00218 eyedbsm::DbHandle *get_eyedbsm_DbHandle(DbHandle *);
00219 
00220 const char strict_unix_user[] = "**||STRICT||UNIX||USER||**";
00221 
00222 }
00223 
00224 // 8/07/06 and 15/08/06
00225 #define DONT_SET_LITERAL_IN_NEWOBJ
00226 
00227 #endif

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