Adding initial code jy.oak@samsung.com
[ric-app/kpimon.git] / src / KPI-Message-Handler / KPIMessageHandler.h
diff --git a/src/KPI-Message-Handler/KPIMessageHandler.h b/src/KPI-Message-Handler/KPIMessageHandler.h
new file mode 100755 (executable)
index 0000000..c9bcc20
--- /dev/null
@@ -0,0 +1,58 @@
+/*\r
+==================================================================================\r
+\r
+        Copyright (c) 2018-2019 AT&T Intellectual Property.\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================================\r
+*/\r
+\r
+\r
+#ifndef KPI_MESSAGE_HANDLER_H\r
+#define KPI_MESSAGE_HANDLER_H\r
+\r
+#include <mutex>\r
+#include <memory>\r
+#include <iostream>\r
+#include <ctime>    // For time()\r
+#include <cu_cp_resource_status_report_helper.hpp>\r
+#include <cu_cp_resource_status_report.hpp>\r
+#include <kpi_db.hpp>\r
+\r
+\r
+#ifdef __GNUC__\r
+#define likely(x)  __builtin_expect((x), 1)\r
+#define unlikely(x) __builtin_expect((x), 0)\r
+#else\r
+#define likely(x) (x)\r
+#define unlikely(x) (x)\r
+#endif\r
+\r
+class kpi_msg_handler\r
+{\r
+public: \r
+  kpi_msg_handler();\r
+  bool operator()(redisContext *,unsigned char *, size_t);\r
+  void clear();\r
+  std::string get_error(void) { return error_string;};\r
+\r
+private:\r
+\r
+  std::unique_ptr<std::mutex> m_access;\r
+  cucp_resource_helper kpi_data;\r
+  cucp_resource_status_report kpi_report;\r
+  kpi_db_resp kpi_db_res;\r
+  std::string error_string;\r
+};\r
+\r
+#endif\r