util: move Scheduler and related classes to ndn::scheduler
Remove deprecated header util/scheduler-scoped-event-id.hpp
Remove deprecated functions and type aliases
Refs: #4883
Change-Id: I83c6700c568db7fbbece98d9691ab3d75ff5d2f2
diff --git a/ndn-cxx/util/scheduler-scoped-event-id.hpp b/ndn-cxx/util/scheduler-scoped-event-id.hpp
deleted file mode 100644
index ea30af9..0000000
--- a/ndn-cxx/util/scheduler-scoped-event-id.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2013-2019 Regents of the University of California.
- *
- * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
- *
- * ndn-cxx library is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- *
- * You should have received copies of the GNU General Public License and GNU Lesser
- * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
- */
-
-#ifndef NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
-#define NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
-
-#pragma message("scheduler-scoped-event-id.hpp has been combined into scheduler.hpp")
-
-#include "ndn-cxx/util/scheduler.hpp"
-
-#endif // NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
diff --git a/ndn-cxx/util/scheduler.cpp b/ndn-cxx/util/scheduler.cpp
index f059a4b..f930810 100644
--- a/ndn-cxx/util/scheduler.cpp
+++ b/ndn-cxx/util/scheduler.cpp
@@ -25,7 +25,6 @@
#include <boost/scope_exit.hpp>
namespace ndn {
-namespace util {
namespace scheduler {
/** \brief Stores internal information about a scheduled event
@@ -91,7 +90,7 @@
}
Scheduler::Scheduler(boost::asio::io_service& ioService)
- : m_timer(make_unique<detail::SteadyTimer>(ioService))
+ : m_timer(make_unique<util::detail::SteadyTimer>(ioService))
{
}
@@ -176,5 +175,4 @@
}
} // namespace scheduler
-} // namespace util
} // namespace ndn
diff --git a/ndn-cxx/util/scheduler.hpp b/ndn-cxx/util/scheduler.hpp
index ed81a03..ae69cc6 100644
--- a/ndn-cxx/util/scheduler.hpp
+++ b/ndn-cxx/util/scheduler.hpp
@@ -30,11 +30,12 @@
#include <set>
namespace ndn {
-namespace util {
+namespace util {
namespace detail {
class SteadyTimer;
} // namespace detail
+} // namespace util
namespace scheduler {
@@ -45,7 +46,7 @@
*/
using EventCallback = std::function<void()>;
-/** \brief A handle of scheduled event.
+/** \brief A handle for a scheduled event.
*
* \code
* EventId eid = scheduler.schedule(10_ms, [] { doSomething(); });
@@ -56,20 +57,13 @@
* \warning Canceling an event after the scheduler has been destructed may trigger undefined
* behavior.
*/
-class EventId : public ndn::detail::CancelHandle
+class EventId : public detail::CancelHandle
{
public:
/** \brief Constructs an empty EventId
*/
EventId() noexcept = default;
- /** \brief Allow implicit conversion from nullptr.
- */
- [[deprecated]]
- EventId(std::nullptr_t) noexcept
- {
- }
-
/** \brief Determine whether the event is valid.
* \retval true The event is valid.
* \retval false This EventId is empty, or the event is expired or cancelled.
@@ -108,7 +102,7 @@
std::ostream&
operator<<(std::ostream& os, const EventId& eventId);
-/** \brief A scoped handle of scheduled event.
+/** \brief A scoped handle for a scheduled event.
*
* Upon destruction of this handle, the event is canceled automatically.
* Most commonly, the application keeps a ScopedEventId as a class member field, so that it can
@@ -124,20 +118,10 @@
* \warning Canceling an event after the scheduler has been destructed may trigger undefined
* behavior.
*/
-class ScopedEventId : public ndn::detail::ScopedCancelHandle
+class ScopedEventId : public detail::ScopedCancelHandle
{
public:
using ScopedCancelHandle::ScopedCancelHandle;
-
- ScopedEventId() noexcept = default;
-
- /** \deprecated Scheduler argument is no longer necessary. Use default construction instead.
- */
- [[deprecated]]
- explicit
- ScopedEventId(Scheduler&) noexcept
- {
- }
};
/** \brief Generic time-based scheduler
@@ -156,24 +140,6 @@
EventId
schedule(time::nanoseconds after, EventCallback callback);
- /** \deprecated use schedule(after, callback)
- */
- [[deprecated("use schedule(after, callback)")]]
- EventId
- scheduleEvent(time::nanoseconds after, EventCallback callback)
- {
- return schedule(after, std::move(callback));
- }
-
- /** \deprecated use EventId::cancel()
- */
- [[deprecated("use EventId::cancel()")]]
- void
- cancelEvent(const EventId& eid)
- {
- eid.cancel();
- }
-
/** \brief Cancel all scheduled events
*/
void
@@ -216,17 +182,8 @@
} // namespace scheduler
-// for backwards compatibility
-using Scheduler [[deprecated]] = scheduler::Scheduler;
-
-} // namespace util
-
-namespace scheduler = util::scheduler;
using scheduler::Scheduler;
-// for backwards compatibility
-using EventId [[deprecated]] = util::scheduler::EventId;
-
} // namespace ndn
#endif // NDN_UTIL_SCHEDULER_HPP
diff --git a/tests/integrated/scheduler-benchmark.cpp b/tests/integrated/scheduler-benchmark.cpp
index ecf6342..51192ee 100644
--- a/tests/integrated/scheduler-benchmark.cpp
+++ b/tests/integrated/scheduler-benchmark.cpp
@@ -29,7 +29,6 @@
#include <iostream>
namespace ndn {
-namespace util {
namespace scheduler {
namespace tests {
@@ -89,5 +88,4 @@
} // namespace tests
} // namespace scheduler
-} // namespace util
} // namespace ndn
diff --git a/tests/unit/util/scheduler.t.cpp b/tests/unit/util/scheduler.t.cpp
index 6497136..3c13c70 100644
--- a/tests/unit/util/scheduler.t.cpp
+++ b/tests/unit/util/scheduler.t.cpp
@@ -27,7 +27,6 @@
#include <boost/lexical_cast.hpp>
namespace ndn {
-namespace util {
namespace scheduler {
namespace tests {
@@ -366,5 +365,4 @@
} // namespace tests
} // namespace scheduler
-} // namespace util
} // namespace ndn