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  virtual
80 
81 public:
82  static const std::string POLICY_NAME;
83 
84 private:
85  virtual void
86  doAfterInsert(iterator i) DECL_OVERRIDE;
87 
88  virtual void
89  doAfterRefresh(iterator i) DECL_OVERRIDE;
90 
91  virtual void
92  doBeforeErase(iterator i) DECL_OVERRIDE;
93 
94  virtual void
95  doBeforeUse(iterator i) DECL_OVERRIDE;
96 
97  virtual void
98  evictEntries() DECL_OVERRIDE;
99 
100 private:
104  void
105  evictOne();
106 
110  void
111  attachQueue(iterator i);
112 
116  void
117  detachQueue(iterator i);
118 
121  void
122  moveToStaleQueue(iterator i);
123 
124 private:
125  Queue m_queues[QUEUE_MAX];
126  EntryInfoMapFifo m_entryInfoMap;
127 };
128 
129 } // namespace priorityfifo
130 
131 using priority_fifo::PriorityFifoPolicy;
132 
133 } // namespace cs
134 } // namespace nfd
135 
136 #endif // NFD_DAEMON_TABLE_CS_POLICY_FIFO_HPP
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
Table::const_iterator iterator
Definition: cs-internal.hpp:41
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
represents a CS replacement policy
Definition: cs-policy.hpp:39
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
std::map< iterator, EntryInfo *, EntryItComparator > EntryInfoMapFifo
bool operator()(const iterator &a, const iterator &b) const
Priority Fifo cs replacement policy.