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" |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 11 | #include <ndn-cpp-dev/util/scheduler.hpp> |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 12 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 13 | namespace nfd { |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 14 | namespace scheduler { |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 15 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 16 | using ndn::Scheduler; |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 17 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 18 | /** \class EventId |
| 19 | * \brief Opaque type (shared_ptr) representing ID of a scheduled event |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 20 | */ |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 21 | using ndn::EventId; |
| 22 | |
| 23 | } // namespace scheduler |
| 24 | |
| 25 | // TODO delete this after transition |
| 26 | using scheduler::Scheduler; |
| 27 | |
| 28 | using scheduler::EventId; |
| 29 | |
| 30 | namespace scheduler { |
| 31 | |
| 32 | // TODO delete this after transition |
| 33 | Scheduler& |
| 34 | getGlobalScheduler(); |
| 35 | |
| 36 | inline EventId |
Alexander Afanasyev | eb3197f | 2014-03-17 19:28:18 -0700 | [diff] [blame^] | 37 | schedule(const time::nanoseconds& after, const Scheduler::Event& event) |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 38 | { |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 39 | return getGlobalScheduler().scheduleEvent(after, event); |
| 40 | } |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 41 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 42 | inline void |
| 43 | cancel(const EventId& eventId) |
| 44 | { |
| 45 | getGlobalScheduler().cancelEvent(eventId); |
| 46 | } |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 47 | |
Junxiao Shi | c041ca3 | 2014-02-25 20:01:15 -0700 | [diff] [blame] | 48 | } // namespace scheduler |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 49 | } // namespace nfd |
Alexander Afanasyev | 920af2f | 2014-01-25 22:56:11 -0800 | [diff] [blame] | 50 | |
| 51 | #endif // NFD_CORE_SCHEDULER_HPP |