|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
|
2 /* |
|
3 * Copyright (c) 2005 INRIA |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License version 2 as |
|
7 * published by the Free Software Foundation; |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 * |
|
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 */ |
|
20 |
|
21 #ifndef SCHEDULER_LIST_H |
|
22 #define SCHEDULER_LIST_H |
|
23 |
|
24 #include "scheduler.h" |
|
25 #include "event-id.h" |
|
26 #include <list> |
|
27 #include <utility> |
|
28 #include <stdint.h> |
|
29 |
|
30 namespace ns3 { |
|
31 |
|
32 class EventImpl; |
|
33 |
|
34 class ListScheduler : public Scheduler { |
|
35 public: |
|
36 ListScheduler (); |
|
37 virtual ~ListScheduler (); |
|
38 |
|
39 virtual void Insert (const EventId &id); |
|
40 virtual bool IsEmpty (void) const; |
|
41 virtual EventId PeekNext (void) const; |
|
42 virtual EventId RemoveNext (void); |
|
43 virtual bool Remove (const EventId &ev); |
|
44 |
|
45 private: |
|
46 inline bool IsLower (Scheduler::EventKey const*a, Scheduler::EventKey const*b) const; |
|
47 |
|
48 typedef std::list<std::pair<EventImpl*, EventKey> > Events; |
|
49 typedef std::list<std::pair<EventImpl*, EventKey> >::iterator EventsI; |
|
50 Events m_events; |
|
51 }; |
|
52 |
|
53 }; // namespace ns3 |
|
54 |
|
55 |
|
56 #endif /* SCHEDULER_LIST_H */ |