home *** CD-ROM | disk | FTP | other *** search
- /*____________________________________________________________________________*\
- *
-
- Copyright (c) 1997 John Roy. All rights reserved.
-
- These sources, libraries and applications are
- FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
- as long as the following conditions are adhered to.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. Redistributions of any form whatsoever and all advertising materials
- mentioning features must contain the following
- acknowledgment:
- "This product includes software developed by John Roy
- (http://www.johnroy.com/pi3/)."
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- OF THE POSSIBILITY OF SUCH DAMAGE.
-
- *____________________________________________________________________________*|
- *
- * $Source: PIClass.h$
- * $Date: Sun Aug 10 06:42:17 1997$
- *
- Description:
- \*____________________________________________________________________________*/
- /* $HeaderTop:$ */
-
- #ifndef PICLASS_H_
- #define PICLASS_H_
-
- #include "Pi2API.h"
-
- /*____________________________________________________________________________*\
- *
- Definitions
- \*____________________________________________________________________________*/
- typedef struct _PIClass PIClass;
- enum _PIClass_LoadAction {
- STARTUP=0,
- SHUTDOWN,
- RESTART,
- EMERGENCYSHUTDOWN
- };
- typedef enum _PIClass_LoadAction PIClass_LoadAction;
-
- /*____________________________________________________________________________*\
- *
- Name:
- PIClass_load
-
- Synopsis:
- const PIClass *PIClass_load( PIDB *pDB, PIConfig *pConfig,
- const char *pClassName )
-
- Description:
- Attempts to load a class with name pClassName from a definition
- in the parsed configuration DB pConfigDB.
-
- If pConfigDB is NULL then PIConfig_findConfiguration() is used to
- find the configuration DB from pDB.
-
- Notes:
- If the class library has not already been loaded PIClass_loadClass
- will attempt to load it using PILibrary_load().
-
- Return Values:
- On success PIClass_load() returns a const pointer to the specified class.
-
- Errors:
- PIAPI_EINVAL if pDB or pClassName is NULL.
- PIAPI_ERROR if another error occurred.
-
- See Also:
- \*____________________________________________________________________________*/
- PUBLIC_PIAPI const PIClass *PIClass_load( PIDB *pDB, PIConfig *pConfig,
- const char *pName );
-
- /*____________________________________________________________________________*\
- *
- Name:
- PIClass_lookup
-
- Synopsis:
- const PIClass *PIClass_lookup( PIDB *pDB, const char *pClassName );
-
- Description:
- Looks under the root node of pDB for a PIDB tree with a key of
- PIDBKEY_LIBRARIES and then under that for a PIDB with a key of
- PIDBKEY_CLASSES, then searches within this tree for an element
- with key pClassName. If found this element is returned.
-
- Notes:
- Return Values:
- On success PIClass_lookup() returns a const pointer to the specified class.
-
- Errors:
- PIAPI_EINVAL if pDB or pClassName is NULL.
- PIAPI_ERROR if another error occurred.
-
- See Also:
- \*____________________________________________________________________________*/
- PUBLIC_PIAPI const PIClass *PIClass_lookup( PIDB *pDB, const char *pName );
-
- /*____________________________________________________________________________*\
- *
- Name:
- PIClass_lookupOrLoad
-
- Synopsis:
- const PIClass *PIClass_lookupOrLoad( PIDB *pDB, PIConfig *pConfig,
- const char *pClassName )
-
- Description:
- This function first attempts to find an existing class using
- PIClass_lookup(). If that fails it attempts to load the class
- from the parsed configuration DB pConfigDB using PIClass_load().
-
- Notes:
- See PIClass_lookup() and PIClass_load() for more details.
- Return Values:
- On success PIClass_lookup() returns a const pointer to the specified class.
-
- Errors:
- PIAPI_EINVAL if pDB or pClassName is NULL.
- PIAPI_ERROR if another error occurred.
-
- See Also:
- \*____________________________________________________________________________*/
- PUBLIC_PIAPI const PIClass *PIClass_lookupOrLoad( PIDB *pDB,
- PIConfig *pConfig, const char *pClassName );
-
- #endif /* PICLASS_H_ */
-
-