home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / WEBSERVE / PI3 / PI3WEB.EXE / DEVEL / INCLUDE / PIClass.h < prev    next >
C/C++ Source or Header  |  1997-10-19  |  5KB  |  155 lines

  1. /*____________________________________________________________________________*\
  2.  *
  3.  
  4.  Copyright (c) 1997 John Roy. All rights reserved.
  5.  
  6.  These sources, libraries and applications are
  7.  FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
  8.  as long as the following conditions are adhered to.
  9.  
  10.  Redistribution and use in source and binary forms, with or without
  11.  modification, are permitted provided that the following conditions
  12.  are met:
  13.  
  14.  1. Redistributions of source code must retain the above copyright
  15.     notice, this list of conditions and the following disclaimer. 
  16.  
  17.  2. Redistributions in binary form must reproduce the above copyright
  18.     notice, this list of conditions and the following disclaimer in
  19.     the documentation and/or other materials provided with the
  20.     distribution.
  21.  
  22.  3. Redistributions of any form whatsoever and all advertising materials 
  23.     mentioning features must contain the following
  24.     acknowledgment:
  25.     "This product includes software developed by John Roy
  26.     (http://www.johnroy.com/pi3/)."
  27.  
  28.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  29.  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30.  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  31.  IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  32.  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34.  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36.  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  38.  OF THE POSSIBILITY OF SUCH DAMAGE.
  39.  
  40.  *____________________________________________________________________________*|
  41.  *
  42.  * $Source: PIClass.h$
  43.  * $Date: Sun Aug 10 06:42:17 1997$
  44.  *
  45.  Description:
  46. \*____________________________________________________________________________*/
  47. /* $HeaderTop:$ */
  48.  
  49. #ifndef PICLASS_H_
  50. #define PICLASS_H_
  51.  
  52. #include "Pi2API.h"
  53.  
  54. /*____________________________________________________________________________*\
  55.  *
  56. Definitions
  57. \*____________________________________________________________________________*/
  58. typedef struct _PIClass PIClass;
  59. enum _PIClass_LoadAction { 
  60.     STARTUP=0,
  61.     SHUTDOWN,
  62.     RESTART,
  63.     EMERGENCYSHUTDOWN
  64.     };
  65. typedef enum _PIClass_LoadAction PIClass_LoadAction;
  66.  
  67. /*____________________________________________________________________________*\
  68.  *
  69.  Name:
  70.     PIClass_load
  71.  
  72.  Synopsis:
  73.     const PIClass *PIClass_load( PIDB *pDB, PIConfig *pConfig,
  74.         const char *pClassName )
  75.     
  76.  Description:
  77.     Attempts to load a class with name pClassName from a definition
  78.     in the parsed configuration DB pConfigDB.
  79.  
  80.     If pConfigDB is NULL then PIConfig_findConfiguration() is used to
  81.     find the configuration DB from pDB.
  82.  
  83.  Notes:
  84.     If the class library has not already been loaded PIClass_loadClass
  85.     will attempt to load it using PILibrary_load().
  86.  
  87.  Return Values:
  88.     On success PIClass_load() returns a const pointer to the specified class.
  89.  
  90.  Errors:
  91.     PIAPI_EINVAL    if pDB or pClassName is NULL.
  92.     PIAPI_ERROR        if another error occurred.
  93.  
  94.  See Also:
  95. \*____________________________________________________________________________*/
  96. PUBLIC_PIAPI const PIClass *PIClass_load( PIDB *pDB, PIConfig *pConfig,
  97.     const char *pName );
  98.  
  99. /*____________________________________________________________________________*\
  100.  *
  101.  Name:
  102.     PIClass_lookup
  103.  
  104.  Synopsis:
  105.     const PIClass *PIClass_lookup( PIDB *pDB, const char *pClassName );
  106.     
  107.  Description:
  108.     Looks under the root node of pDB for a PIDB tree with a key of
  109.     PIDBKEY_LIBRARIES and then under that for a PIDB with a key of
  110.     PIDBKEY_CLASSES, then searches within this tree for an element
  111.     with key pClassName. If found this element is returned.
  112.  
  113.  Notes:
  114.  Return Values:
  115.     On success PIClass_lookup() returns a const pointer to the specified class.
  116.  
  117.  Errors:
  118.     PIAPI_EINVAL    if pDB or pClassName is NULL.
  119.     PIAPI_ERROR        if another error occurred.
  120.  
  121.  See Also:
  122. \*____________________________________________________________________________*/
  123. PUBLIC_PIAPI const PIClass *PIClass_lookup( PIDB *pDB, const char *pName );
  124.  
  125. /*____________________________________________________________________________*\
  126.  *
  127.  Name:
  128.     PIClass_lookupOrLoad
  129.  
  130.  Synopsis:
  131.     const PIClass *PIClass_lookupOrLoad( PIDB *pDB, PIConfig *pConfig,
  132.         const char *pClassName )
  133.     
  134.  Description:
  135.     This function first attempts to find an existing class using
  136.     PIClass_lookup(). If that fails it attempts to load the class
  137.     from the parsed configuration DB pConfigDB using PIClass_load().
  138.  
  139.  Notes:
  140.     See PIClass_lookup() and PIClass_load() for more details.
  141.  Return Values:
  142.     On success PIClass_lookup() returns a const pointer to the specified class.
  143.  
  144.  Errors:
  145.     PIAPI_EINVAL    if pDB or pClassName is NULL.
  146.     PIAPI_ERROR        if another error occurred.
  147.  
  148.  See Also:
  149. \*____________________________________________________________________________*/
  150. PUBLIC_PIAPI const PIClass *PIClass_lookupOrLoad( PIDB *pDB, 
  151.     PIConfig *pConfig, const char *pClassName );
  152.  
  153. #endif    /* PICLASS_H_ */
  154.  
  155.