Apache Portable Runtime Utility Library
apr_optional.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef APR_OPTIONAL_H
18#define APR_OPTIONAL_H
19
20#include "apu.h"
25#ifdef __cplusplus
26extern "C" {
27#endif
28
42#define APR_OPTIONAL_FN_TYPE(name) apr_OFN_##name##_t
43
50#define APR_DECLARE_OPTIONAL_FN(ret,name,args) \
51typedef ret (APR_OPTIONAL_FN_TYPE(name)) args
52
59typedef void (apr_opt_fn_t)(void);
61APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName,
62 apr_opt_fn_t *pfn);
63
70#define APR_REGISTER_OPTIONAL_FN(name) do { \
71 APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \
72 apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \
73} while (0)
74
78APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName);
79
84#define APR_RETRIEVE_OPTIONAL_FN(name) \
85 (APR_OPTIONAL_FN_TYPE(name) *)apr_dynamic_fn_retrieve(#name)
86
88#ifdef __cplusplus
89}
90#endif
91
92#endif /* APR_OPTIONAL_H */
void() apr_opt_fn_t(void)
Definition: apr_optional.h:59