00001 /* lib/context.h - Context structure 00002 Copyright (C) 1999, 2000, 2001 Thomas Uehlinger 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 00017 00025 #include <gobjconfig.h> 00026 00027 #ifndef gobj_lib_context_h 00028 #define gobj_lib_context_h 00029 00030 #include <gobj/types.h> 00031 #include <gobj/decls.h> 00032 #include <gobj/system.h> 00033 #include <gobj/persona.h> 00034 #include <gobj/session.h> 00035 #include <gobj/threads.h> 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif /* __cplusplus */ 00040 #if 0 00041 } 00042 #endif 00043 00044 00049 typedef struct gj_CtxChild_struct gj_CtxChild; 00050 00051 00056 typedef int Gj_CtxForkEntry(Gj_Ctx* ctx, void* data); 00057 00058 00063 struct Gj_Ctx_struct { 00064 00065 Gj_Errormgr* errormgr; 00066 Gj_Bool own_errormgr; 00067 00068 gj_CtxChild* children; 00069 Gj_Ctx* parent; 00070 00071 Gj_System* system; 00072 Gj_Bool own_system; 00073 00074 Gj_Persona* persona; 00075 Gj_Bool own_persona; 00076 00077 Gj_Session* session; 00078 Gj_Bool own_session; 00079 00080 }; 00081 00082 /*struct Gj_Ctx_struct { 00083 00084 Gj_Errormgr* errormgr; 00085 Gj_Bool errormgr_shared; 00086 00087 Gj_Idmgr* idmgr; 00088 Gj_Bool idmgr_shared; 00089 00090 Gj_Modelmgr* modelmgr; 00091 Gj_Bool modelmgr_shared; 00092 00093 Gj_Objectmgr* objectmgr; 00094 Gj_Bool objectmgr_shared; 00095 00096 Gj_Nativemgr* nativemgr; 00097 Gj_Bool nativemgr_shared; 00098 00099 Gj_Nameresolver* nameresolver; 00100 Gj_Bool nameresolver_shared; 00101 00102 Gj_Nameenv* nameenv; 00103 Gj_Bool nameenv_shared; 00104 00105 Gj_Ifacemgr* ifacemgr; 00106 Gj_Bool ifacemgr_shared; 00107 00108 Gj_Bool overrideInstanceCount; 00109 00110 };*/ 00111 00112 00122 Gj_Ctx* Gj_ctx_new(Gj_Ctx* ctx); 00123 00124 00133 Gj_Ctx* Gj_ctx_createInitial(); 00134 00135 00144 int Gj_ctx_delete(Gj_Ctx* ctx); 00145 00146 00157 int gj_ctx_deleteWithoutUnreg(Gj_Ctx* ctx); 00158 00159 00170 int Gj_ctx_deleteChildren(Gj_Ctx* ctx); 00171 00172 00177 Gj_Ctx* Gj_ctx_flatCopy(Gj_Ctx* ctx); 00178 00179 00184 Gj_Ctx* Gj_ctx_fork(Gj_Ctx* ctx); 00185 00186 00195 #ifdef GJ_MULTITHREADED 00196 int Gj_ctx_forkThreaded(Gj_Ctx* ctx, Gj_CtxForkEntry* entry, void* data); 00197 #endif 00198 00199 00204 Gj_Bool Gj_ctx_isInit(Gj_Ctx* ctx); 00205 00206 00207 /* 00208 @brief Initialize the context with standard components. 00209 00210 @returns 0 on success, -1 otherwise. 00211 00212 */ 00213 /*int Gj_ctx_initStd(Gj_Ctx* ctx);*/ 00214 00215 00216 /* 00217 * Create pre-initialized context structure 00218 * Error: returns the pointer to the context on success, 0 otherwise 00219 * 00220 */ 00221 /*Gj_Ctx* Gj_ctx_new();*/ 00222 00223 00224 /* 00225 * Destroy a finalized context structure 00226 * 00227 */ 00228 /*void Gj_ctx_delete(Gj_Ctx* ctx);*/ 00229 00230 00231 /* 00232 * Initialize a standard context 00233 * ctx has to be pre-initialized (ctx is pre-initialized after Gj_ctx_new() or Gj_ctx_finalize()) 00234 * Error: returns 0 on success, -1 otherwise 00235 * 00236 */ 00237 /*int Gj_ctx_initStd(Gj_Ctx* ctx);*/ 00238 00239 00240 /* 00241 * Finalize a context 00242 * after this call the context is in the finalized status, call Gj_ctx_delete() to delete it 00243 * Error: returns 0 on success, -1 otherwise 00244 * 00245 */ 00246 /*int Gj_ctx_finalize(Gj_Ctx* ctx);*/ 00247 00248 00249 /* 00250 * Fork the context into two pieces 00251 * if the shared flag is set only the viewer, nameenv and errormgr are copied 00252 * Error: returns the forked context on success, 0 otherwise (the old context remains unchanged) 00253 * 00254 */ 00255 /*Gj_Ctx* Gj_ctx_fork(Gj_Ctx* ctx, Gj_Bool shared);*/ 00256 00257 00258 #ifdef __cplusplus 00259 } 00260 #endif /* __cplusplus */ 00261 00262 #endif /* !gobj_lib_context_h */ 00263