HelloWorld E2SM unit tests
[ric-app/hw.git] / src / xapp.hpp
index bcfff5b..a769b43 100644 (file)
@@ -1,7 +1,7 @@
 /*
 ==================================================================================
 
-        Copyright (c) 2018-2019 AT&T Intellectual Property.
+        Copyright (c) 2019-2020 AT&T Intellectual Property.
 
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
  *//*
  * xapp.hpp
  *
- *  Modified: Mar, 2020 (Shraboni Jana)
+ *  Mar, 2020 (Shraboni Jana)
  *
  */
 
 #include <memory>
 #include <csignal>
 #include <stdio.h>
+#include <pthread.h>
+#include <unordered_map>
 #include "xapp_rmr.hpp"
 #include "xapp_sdl.hpp"
 #include "rapidjson/writer.h"
+#include "rapidjson/document.h"
+#include "rapidjson/error/error.h"
 
 #include "msgs_proc.hpp"
 #include "subs_mgmt.hpp"
 #include "xapp_config.hpp"
-//#include "rnib/rnibreader.h"
-
-
+extern "C" {
+#include "rnib/rnibreader.h"
+}
 using namespace std;
 using namespace std::placeholders;
+using namespace rapidjson;
+
 
 class Xapp{
 public:
 
   Xapp(XappSettings &, XappRmr &);
-  Xapp(XappSettings &, XappRmr &, XappSDL &);
+  Xapp(XappSettings &, XappRmr &, SubscriptionHandler &);
+
   ~Xapp(void);
 
+  void stop(void);
+
   void startup();
   void shutdown(void);
 
-  void start_xapp_receiver();
+  void start_xapp_receiver(XappMsgHandler &);
+  void Run();
+
+  void sdl_data(void);
 
   Xapp(Xapp const &)=delete;
   Xapp& operator=(Xapp const &) = delete;
 
+  void register_handler(XappMsgHandler &fn){
+         _callbacks.emplace_back(fn);
+  }
+
+  //getters/setters.
+  void set_rnib_gnblist(void);
+  std::vector<std::string> get_rnib_gnblist(){ return rnib_gnblist; }
+
 private:
   void startup_subscribe_requests(void );
   void shutdown_subscribe_deletes(void);
   void startup_get_policies(void );
-  void sdl_data(void);
-  void rnib_data(void);
+
 
   XappRmr * rmr_ref;
   XappSettings * config_ref;
-  XappSDL *sdl_ref = NULL;
+  SubscriptionHandler *subhandler_ref;
+
   std::mutex *xapp_mutex;
   std::vector<std::thread> xapp_rcv_thread;
+  std::vector<std::string> rnib_gnblist;
+  std::vector<XappMsgHandler> _callbacks;
+
 };