[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 d5030ab..6a76c57 100644
--- a/core/global-io.hpp
+++ b/core/global-io.hpp
@@ -29,19 +29,27 @@
namespace nfd {
-/** \return the global io_service instance
- */
-boost::asio::io_service&
-getGlobalIoService();
+namespace detail {
-#ifdef WITH_TESTS
-/** \brief delete the global io_service instance
- *
- * It will be recreated at the next invocation of getGlobalIoService.
+/**
+ * @brief Simulator-based IO that implements a few interfaces from boost::asio::io_service
*/
-void
-resetGlobalIoService();
-#endif
+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();
} // namespace nfd