Copyright updated
[ric-app/kpimon.git] / src / KPI-Message-Handler / KPIMessageHandler.h
1 /*\r
2 ==================================================================================\r
3 \r
4         Copyright (c) 2018-2019 SAMSUNG and AT&T Intellectual Property.\r
5 \r
6    Licensed under the Apache License, Version 2.0 (the "License");\r
7    you may not use this file except in compliance with the License.\r
8    You may obtain a copy of the License at\r
9 \r
10        http://www.apache.org/licenses/LICENSE-2.0\r
11 \r
12    Unless required by applicable law or agreed to in writing, software\r
13    distributed under the License is distributed on an "AS IS" BASIS,\r
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15    See the License for the specific language governing permissions and\r
16    limitations under the License.\r
17 ==================================================================================\r
18 */\r
19 \r
20 \r
21 #ifndef KPI_MESSAGE_HANDLER_H\r
22 #define KPI_MESSAGE_HANDLER_H\r
23 \r
24 #include <mutex>\r
25 #include <memory>\r
26 #include <iostream>\r
27 #include <ctime>    // For time()\r
28 #include <cu_cp_resource_status_report_helper.hpp>\r
29 #include <cu_cp_resource_status_report.hpp>\r
30 #include <kpi_db.hpp>\r
31 \r
32 \r
33 #ifdef __GNUC__\r
34 #define likely(x)  __builtin_expect((x), 1)\r
35 #define unlikely(x) __builtin_expect((x), 0)\r
36 #else\r
37 #define likely(x) (x)\r
38 #define unlikely(x) (x)\r
39 #endif\r
40 \r
41 class kpi_msg_handler\r
42 {\r
43 public: \r
44   kpi_msg_handler();\r
45   bool operator()(redisContext *,unsigned char *, size_t);\r
46   void clear();\r
47   std::string get_error(void) { return error_string;};\r
48 \r
49 private:\r
50 \r
51   std::unique_ptr<std::mutex> m_access;\r
52   cucp_resource_helper kpi_data;\r
53   cucp_resource_status_report kpi_report;\r
54   kpi_db_resp kpi_db_res;\r
55   std::string error_string;\r
56 };\r
57 \r
58 #endif\r