NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
cs-policy-priority-fifo.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
27 #define NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
28 
29 #include "cs-policy.hpp"
30 #include "common.hpp"
31 #include "core/scheduler.hpp"
32 
33 namespace nfd {
34 namespace cs {
35 namespace priority_fifo {
36 
37 typedef std::list<iterator> Queue;
39 
40 enum QueueType {
45 };
46 
47 struct EntryInfo
48 {
50  QueueIt queueIt;
52 };
53 
55 {
56  bool
57  operator()(const iterator& a, const iterator& b) const
58  {
59  return *a < *b;
60  }
61 };
62 
63 typedef std::map<iterator, EntryInfo*, EntryItComparator> EntryInfoMapFifo;
64 
73 class PriorityFifoPolicy : public Policy
74 {
75 public:
77 
78 public:
79  static const std::string POLICY_NAME;
80 
81 private:
82  virtual void
83  doAfterInsert(iterator i) DECL_OVERRIDE;
84 
85  virtual void
86  doAfterRefresh(iterator i) DECL_OVERRIDE;
87 
88  virtual void
89  doBeforeErase(iterator i) DECL_OVERRIDE;
90 
91  virtual void
92  doBeforeUse(iterator i) DECL_OVERRIDE;
93 
94  virtual void
95  evictEntries() DECL_OVERRIDE;
96 
97 private:
101  void
102  evictOne();
103 
107  void
108  attachQueue(iterator i);
109 
113  void
114  detachQueue(iterator i);
115 
118  void
119  moveToStaleQueue(iterator i);
120 
121 private:
122  Queue m_queues[QUEUE_MAX];
123  EntryInfoMapFifo m_entryInfoMap;
124 };
125 
126 } // namespace priorityfifo
127 
128 using priority_fifo::PriorityFifoPolicy;
129 
130 } // namespace cs
131 } // namespace nfd
132 
133 #endif // NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports this feature, otherwise expands to nothing ...
Definition: common.hpp:49
bool operator()(const iterator &a, const iterator &b) const
Table::const_iterator iterator
Definition: cs-internal.hpp:41
represents a CS replacement policy
Definition: cs-policy.hpp:39
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
std::map< iterator, EntryInfo *, EntryItComparator > EntryInfoMapFifo
Priority Fifo cs replacement policy.