home *** CD-ROM | disk | FTP | other *** search
/ Oracle Video Server 3.0.3.1 / OVS_3031_NT.iso / win32 / medianet / server / include / ysc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-23  |  4.1 KB  |  102 lines

  1. /* Copyright (c) 1995 by Oracle Corporation.  All Rights Reserved.
  2.  *
  3.  * ysc.h - OMX Context Management
  4.  *
  5.  * DESCRIPTION
  6.  * Any component that needs access to a "global" variable must use the
  7.  * context management package.  The type of the context is identified
  8.  * by the declaration of an enumeration constant in the type ysctxid.
  9.  */
  10.  
  11. #ifndef YSC_ORACLE
  12. #define YSC_ORACLE
  13.  
  14. #ifndef SYSX_ORACLE
  15. #include <sysx.h>
  16. #endif
  17. #ifndef YS_ORACLE
  18. #include <ys.h>
  19. #endif
  20.  
  21. EXTC_START
  22.  
  23. /*
  24.  * ysctxid - global contexts
  25.  *
  26.  * DESCRIPTION
  27.  * If you need a global context, declare a context type for it by adding
  28.  * an enumeration constant to the following list.  Global contexts should
  29.  * be used only for components, not applications or servers.
  30.  */
  31. enum ysctxid
  32. {
  33.   YSC_YSCTX,                                        /* service layer context */
  34.   YSC_YSGLB,                                          /* global heap pointer */
  35.   YSC_BYNAME,                                            /* contexts-by-name */
  36.   YSC_YSTCTX,                                      /* Thread package context */
  37.   YSC_MKE,                                               /* mke compat layer */
  38.   YSC_YTCTX,                                      /* transport layer context */
  39.   YSC_YOCTX,                                         /* object layer context */
  40.   YSC_MTCCTX,                                         /* mtcctx compat layer */
  41.   YSC_OTSCTX,                              /* object transaction svc context */
  42.   YSC_TEMP2,                                                  /* unused slot */
  43.   YSC_YSCLAST                                       /* index of last element */
  44. };
  45.  
  46. typedef enum ysctxid ysctxid;          /* enumerated list of global contexts */
  47.  
  48. /*
  49.  * yscGet, yscSet - get & set a context pointer
  50.  *
  51.  * SYNOPSIS
  52.  * dvoid *yscGet(ysctxid type);
  53.  * dvoid *yscSet(ysctxid type, dvoid *ptr);
  54.  *
  55.  * DESCRIPTION
  56.  * yscSet() stores a context pointer for the given context type.  The old
  57.  * context pointer is returned; if there is no old context pointer, a null
  58.  * pointer is returned.  yscGet() returns the current context pointer for
  59.  * the given context type.  If no such context pointer exists, a null pointer
  60.  * is returned.
  61.  */
  62. #define yscGet(ty)  (((dvoid **) syscGetPG())[ty])
  63. dvoid *yscSet(ysctxid type, dvoid *ptr);
  64.  
  65. /*
  66.  * yscGetKeyed, yscSetKeyed - get & set a keyed context
  67.  *
  68.  * DESCRIPTION
  69.  * A context type may use keys to store more than one context pointer for
  70.  * a given type.  One common key is a thread identifier, thus allowing
  71.  * each thread to have a distinct context.  The pre-defined context type
  72.  * YSC_BYNAME may be used in combination with keyed contexts to associate
  73.  * names with context pointers, thus providing a convenient extension for
  74.  * infrequently used global variables.
  75.  *
  76.  * yscSetKeyed() stores a context pointer for type, and associates it with
  77.  * the given key value.  The key value is described with key, which points
  78.  * to the key value and keysz, which specifies the size of the key value.
  79.  * If the given key value already exists, the new context pointer will
  80.  * replace the old context pointer.  The old context pointer is returned.
  81.  * Otherwise, a null pointer is returned if there is no old context.
  82.  *
  83.  * yscGetKeyed() returns the current context pointer for the given context
  84.  * type and the given key.  If no such context pointer exists, a null
  85.  * pointer is returned.  Both key and keysz must match exactly with values
  86.  * passed to a previous call to yscSetKeyed() to constitute a match.
  87.  *
  88.  * Key values are copied by yscSetKeyed() so the key buffer does not need
  89.  * to be preserved by the caller.  To release resources associated with a
  90.  * particular context type and key value, simply pass a null context pointer
  91.  * to yscSetKeyed().
  92.  *
  93.  * These routines may panic with YS_EX_BADMAGIC if a keyed context routine
  94.  * is used for a context type that was previously used by a non-keyed
  95.  * context routine.
  96.  */
  97. dvoid *yscGetKeyed(ysctxid type, dvoid *key, size_t keysz);
  98. dvoid *yscSetKeyed(ysctxid type, dvoid *key, size_t keysz, dvoid *ptr);
  99.  
  100. EXTC_END
  101. #endif /* YSC_ORACLE */
  102.