OSDN Git Service

Fixed chkconfig option
[ultramonkey-l7/ultramonkey-l7-v2.git] / parameter / parameter_wrapper.h
1 #ifndef PARAMETER_WRAPPER
2 #define PARAMETER_WRAPPER
3
4 #include "parameter.h"
5
6 /*!
7  * check whether integer data exists.
8  * @param[in]   comp    section TAG
9  * @param[in]   *key    key string
10  * @return      1 = exist setting value / 0 = non exist setting value
11  */
12 inline int parameter_is_int_exist(const PARAMETER_COMPONENT_TAG comp, const char* key)
13 {
14         if (l7vs::Parameter::getInstance().isIntExist(comp, key)) {
15                 return 1;
16         }
17         return 0;
18 }
19
20 /*!
21  * check whether character data exists.
22  * @param[in]   comp    section TAG
23  * @param[in]   *key    key string
24  * @return      1 = exist setting value / 0 = non exist setting value
25  */
26 inline int parameter_is_char_exist(const PARAMETER_COMPONENT_TAG comp, const char* key)
27 {
28         if (l7vs::Parameter::getInstance().isStringExist(comp, key)) {
29                 return 1;
30         }
31         return 0;
32 }
33
34 /*!
35  * get integer data.
36  * @param[in]   comp    section TAG
37  * @param[in]   *key    key string
38  * @return      value
39  */
40 inline int parameter_get_int_value(const PARAMETER_COMPONENT_TAG comp, const char* key)
41 {
42         return l7vs::Parameter::getInstance().getIntValue(comp, key);
43 }
44
45 /*!
46  * get character data.
47  * @param[in]   comp    section TAG
48  * @param[in]   *key    key string
49  * @return      value
50  */
51 inline const char* parameter_get_char_value(const PARAMETER_COMPONENT_TAG comp, const char* key)
52 {
53         return (l7vs::Parameter::getInstance().getStringValue(comp, key)).c_str();
54 }
55
56 /*!
57  * reload config file
58  * @param[in]   comp    section TAG
59  * @return      0 = success read file / -1 = failure read file
60  */
61 inline int parameter_reread_file(const PARAMETER_COMPONENT_TAG comp)
62 {
63         if (l7vs::Parameter::getInstance().rereadFile(comp)) {
64                 return 0;
65         }
66         return -1;
67 }
68
69 /*!
70  * set-parameter function pointer relates component-tag
71  * @param[in]   comp    section TAG
72  * @param[in]   p_func  function pointer
73  */
74 inline void parameter_register_function_pointer(const PARAMETER_COMPONENT_TAG comp, void(*p_func)())
75 {
76         l7vs::Parameter::getInstance().registerFunctionPointer(comp, p_func);
77 }
78
79 #endif  //PARAMETER_WRAPPER
80