include/apr_optional.h

Go to the documentation of this file.
00001 /* Copyright 2001-2005 The Apache Software Foundation or its licensors, as
00002  * applicable.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef APR_OPTIONAL_H
00018 #define APR_OPTIONAL_H
00019 
00020 #include "apu.h"
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00042 #define APR_OPTIONAL_FN_TYPE(name) apr_OFN_##name##_t
00043 
00050 #define APR_DECLARE_OPTIONAL_FN(ret,name,args) \
00051 typedef ret (APR_OPTIONAL_FN_TYPE(name)) args
00052 
00059 typedef void (apr_opt_fn_t)(void);
00061 APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName, 
00062                                                   apr_opt_fn_t *pfn);
00063     
00065 APU_DECLARE_NONSTD(void) apr_register_optional_fn(const char *szName, 
00066                                                   apr_opt_fn_t *pfn);
00067 
00074 #define APR_REGISTER_OPTIONAL_FN(name) do { \
00075   APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \
00076   apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \
00077 } while (0)
00078 
00082 APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName);
00083 
00085 APU_DECLARE(apr_opt_fn_t *) apr_retrieve_optional_fn(const char *szName);
00086 
00091 #define APR_RETRIEVE_OPTIONAL_FN(name) \
00092         (APR_OPTIONAL_FN_TYPE(name) *)apr_dynamic_fn_retrieve(#name)
00093 
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098 
00099 #endif /* APR_OPTIONAL_H */

Generated on Tue Sep 11 08:13:14 2007 for Apache Portable Runtime Utility Library by  doxygen 1.5.2