[ndnSIM] core: Partial emulation of boost::asio::io_service for NS-3
This commit assumes that ndn::Scheduler is redirected to ns3::Simulator
routines inside the ndn-cxx library.
Change-Id: Ib987f09f76a5d2103365312261fc5a2eba7024d2
diff --git a/core/global-io.hpp b/core/global-io.hpp
index 0fb2fbe..e182dd7 100644
--- a/core/global-io.hpp
+++ b/core/global-io.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2018 Regents of the University of California,
+ * Copyright (c) 2014-2019 Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,17 +29,28 @@
namespace nfd {
-/** \return the global io_service instance
+namespace detail {
+
+/**
+ * @brief Simulator-based IO that implements a few interfaces from boost::asio::io_service
*/
-boost::asio::io_service&
+class SimulatorIo
+{
+public:
+ void
+ post(const std::function<void()>& callback);
+
+ void
+ dispatch(const std::function<void()>& callback);
+};
+
+} // namespace detail
+
+/** \return Simulator-based IO object
+ */
+detail::SimulatorIo&
getGlobalIoService();
-void
-setMainIoService(boost::asio::io_service* mainIo);
-
-void
-setRibIoService(boost::asio::io_service* ribIo);
-
/** \brief run a function on the main io_service instance
*/
void
@@ -50,21 +61,12 @@
void
runOnRibIoService(const std::function<void()>& f);
-boost::asio::io_service&
+detail::SimulatorIo&
getMainIoService();
-boost::asio::io_service&
+detail::SimulatorIo&
getRibIoService();
-#ifdef WITH_TESTS
-/** \brief delete the global io_service instance
- *
- * It will be recreated at the next invocation of getGlobalIoService.
- */
-void
-resetGlobalIoService();
-#endif
-
} // namespace nfd
#endif // NFD_CORE_GLOBAL_IO_HPP