Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (C) 2014 Named Data Networking Project |
| 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
| 7 | #ifndef NFD_CORE_SCHEDULER_HPP |
| 8 | #define NFD_CORE_SCHEDULER_HPP |
| 9 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 10 | #include "global-io.hpp" |
| 11 | #include "time.hpp" |
| 12 | #include <ndn-cpp-dev/util/scheduler.hpp> |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 13 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 14 | namespace nfd { |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 15 | namespace scheduler { |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 16 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 17 | using ndn::Scheduler; |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 18 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 19 | /** \class EventId |
| 20 | * \brief Opaque type (shared_ptr) representing ID of a scheduled event |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 21 | */ |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 22 | using ndn::EventId; |
| 23 | |
| 24 | } // namespace scheduler |
| 25 | |
| 26 | // TODO delete this after transition |
| 27 | using scheduler::Scheduler; |
| 28 | |
| 29 | using scheduler::EventId; |
| 30 | |
| 31 | namespace scheduler { |
| 32 | |
| 33 | // TODO delete this after transition |
| 34 | Scheduler& |
| 35 | getGlobalScheduler(); |
| 36 | |
| 37 | inline EventId |
| 38 | schedule(const time::Duration& after, const Scheduler::Event& event) |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 39 | { |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 40 | return getGlobalScheduler().scheduleEvent(after, event); |
| 41 | } |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 42 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 43 | inline void |
| 44 | cancel(const EventId& eventId) |
| 45 | { |
| 46 | getGlobalScheduler().cancelEvent(eventId); |
| 47 | } |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 48 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 49 | } // namespace scheduler |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 50 | } // namespace nfd |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 51 | |
| 52 | #endif // NFD_CORE_SCHEDULER_HPP |