home *** CD-ROM | disk | FTP | other *** search
- /* Copyright (c) 1995 by Oracle Corporation. All Rights Reserved.
- *
- * ysc.h - OMX Context Management
- *
- * DESCRIPTION
- * Any component that needs access to a "global" variable must use the
- * context management package. The type of the context is identified
- * by the declaration of an enumeration constant in the type ysctxid.
- */
-
- #ifndef YSC_ORACLE
- #define YSC_ORACLE
-
- #ifndef SYSX_ORACLE
- #include <sysx.h>
- #endif
- #ifndef YS_ORACLE
- #include <ys.h>
- #endif
-
- EXTC_START
-
- /*
- * ysctxid - global contexts
- *
- * DESCRIPTION
- * If you need a global context, declare a context type for it by adding
- * an enumeration constant to the following list. Global contexts should
- * be used only for components, not applications or servers.
- */
- enum ysctxid
- {
- YSC_YSCTX, /* service layer context */
- YSC_YSGLB, /* global heap pointer */
- YSC_BYNAME, /* contexts-by-name */
- YSC_YSTCTX, /* Thread package context */
- YSC_MKE, /* mke compat layer */
- YSC_YTCTX, /* transport layer context */
- YSC_YOCTX, /* object layer context */
- YSC_MTCCTX, /* mtcctx compat layer */
- YSC_OTSCTX, /* object transaction svc context */
- YSC_TEMP2, /* unused slot */
- YSC_YSCLAST /* index of last element */
- };
-
- typedef enum ysctxid ysctxid; /* enumerated list of global contexts */
-
- /*
- * yscGet, yscSet - get & set a context pointer
- *
- * SYNOPSIS
- * dvoid *yscGet(ysctxid type);
- * dvoid *yscSet(ysctxid type, dvoid *ptr);
- *
- * DESCRIPTION
- * yscSet() stores a context pointer for the given context type. The old
- * context pointer is returned; if there is no old context pointer, a null
- * pointer is returned. yscGet() returns the current context pointer for
- * the given context type. If no such context pointer exists, a null pointer
- * is returned.
- */
- #define yscGet(ty) (((dvoid **) syscGetPG())[ty])
- dvoid *yscSet(ysctxid type, dvoid *ptr);
-
- /*
- * yscGetKeyed, yscSetKeyed - get & set a keyed context
- *
- * DESCRIPTION
- * A context type may use keys to store more than one context pointer for
- * a given type. One common key is a thread identifier, thus allowing
- * each thread to have a distinct context. The pre-defined context type
- * YSC_BYNAME may be used in combination with keyed contexts to associate
- * names with context pointers, thus providing a convenient extension for
- * infrequently used global variables.
- *
- * yscSetKeyed() stores a context pointer for type, and associates it with
- * the given key value. The key value is described with key, which points
- * to the key value and keysz, which specifies the size of the key value.
- * If the given key value already exists, the new context pointer will
- * replace the old context pointer. The old context pointer is returned.
- * Otherwise, a null pointer is returned if there is no old context.
- *
- * yscGetKeyed() returns the current context pointer for the given context
- * type and the given key. If no such context pointer exists, a null
- * pointer is returned. Both key and keysz must match exactly with values
- * passed to a previous call to yscSetKeyed() to constitute a match.
- *
- * Key values are copied by yscSetKeyed() so the key buffer does not need
- * to be preserved by the caller. To release resources associated with a
- * particular context type and key value, simply pass a null context pointer
- * to yscSetKeyed().
- *
- * These routines may panic with YS_EX_BADMAGIC if a keyed context routine
- * is used for a context type that was previously used by a non-keyed
- * context routine.
- */
- dvoid *yscGetKeyed(ysctxid type, dvoid *key, size_t keysz);
- dvoid *yscSetKeyed(ysctxid type, dvoid *key, size_t keysz, dvoid *ptr);
-
- EXTC_END
- #endif /* YSC_ORACLE */
-