Add support for config file parsing and watching
[ric-plt/xapp-frame-cpp.git] / src / config / config_cb.hpp
1
2 // vi: ts=4 sw=4 noet:
3 /*
4 ==================================================================================
5         Copyright (c) 2020 Nokia
6         Copyright (c) 2020 AT&T Intellectual Property.
7
8    Licensed under the Apache License, Version 2.0 (the "License");
9    you may not use this file except in compliance with the License.
10    You may obtain a copy of the License at
11
12        http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19 ==================================================================================
20 */
21
22 /*
23         Mnemonic:       callback.hpp
24         Abstract:       Manages config notification callback data and such.
25                                 This is a bit of over kill because, unlike the message
26                                 receipt callbacks, there is only one potential callback
27                                 for the config. We could manage this inside of the conf
28                                 class, but if there is ever the need to have multiple
29                                 callbacks, the base is set.
30
31         Date:           27 July 2020
32         Author:         E. Scott Daniels
33 */
34
35
36 #ifndef _XAPP_CONF_CB_HPP
37 #define _XAPP_CONF_CB_HPP
38
39 #include <memory>
40
41 namespace xapp {
42
43 class Config;
44
45 /*
46         Describes the user function that we will invoke
47 */
48 typedef void(*notify_callback)( xapp::Config& c, void* user_data );
49
50 class Config_cb {
51
52         private:
53                 notify_callback user_fun;
54                 void*   udata;                                                                  // user data
55
56         public:
57                 Config_cb( notify_callback cbfun, void* user_data );            // builder
58                 void Drive_cb( xapp::Config& c, void* udata );                          // invoker
59 };
60
61 } // namespace
62
63 #endif
64