📄 piclass.h
字号:
/*____________________________________________________________________________*\
*
Copyright (c) 1997-2003 John Roy, Holger Zimmermann. 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. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
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: /cvsroot/pi3web/Pi3Web_200/Source/Pi2API/PIClass.h,v $
* $Date: 2003/05/13 18:42:08 $
*
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 );
/*____________________________________________________________________________*\
*
Name:
PIClass_getLibrary
Synopsis:
const PIDLL *PIClass_getLibrary( const PIClass *pClass )
Description:
Return the library object associated with this class.
Notes:
Return Values:
Returns NULL on failure.
Errors:
PIAPI_EINVAL if pClass is NULL.
See Also:
\*____________________________________________________________________________*/
PUBLIC_PIAPI const PIDLL *PIClass_getLibrary( const PIClass *pClass );
#endif /* PICLASS_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -