blob: 1328cc0940a1082a8083ea48ef14a0ef25a0db5d [file] [log] [blame]
Alexander Afanasyevc91ebfa2015-01-03 18:09:57 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis
10 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * \author Ilya Moiseenko <http://ilyamoiseenko.com/>
26 * \author Junxiao Shi <http://www.cs.arizona.edu/people/shijunxiao/>
27 * \author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
28 */
29
30#ifndef NFD_DAEMON_TABLE_CS_SKIP_LIST_ENTRY_HPP
31#define NFD_DAEMON_TABLE_CS_SKIP_LIST_ENTRY_HPP
32
33#include "common.hpp"
34#include "cs-entry.hpp"
35
36namespace nfd {
37namespace cs {
38namespace skip_list {
39
40/** \brief represents an entry in a CS with skip list implementation
41 */
42class Entry : public cs::Entry
43{
44public:
45 typedef std::map<int, std::list<Entry*>::iterator > LayerIterators;
46
47 Entry() = default;
48
49 /** \brief releases reference counts on shared objects
50 */
51 void
52 release();
53
54 /** \brief saves the iterator pointing to the CS entry on a specific layer of skip list
55 */
56 void
57 setIterator(int layer, const LayerIterators::mapped_type& layerIterator);
58
59 /** \brief removes the iterator pointing to the CS entry on a specific layer of skip list
60 */
61 void
62 removeIterator(int layer);
63
64 /** \brief returns the table containing <layer, iterator> pairs.
65 */
66 const LayerIterators&
67 getIterators() const;
68
69private:
70 /** \brief prints <layer, iterator> pairs.
71 */
72 void
73 printIterators() const;
74
75private:
76 LayerIterators m_layerIterators;
77};
78
79inline const Entry::LayerIterators&
80Entry::getIterators() const
81{
82 return m_layerIterators;
83}
84
85} // namespace skip_list
86} // namespace cs
87} // namespace nfd
88
89#endif // NFD_DAEMON_TABLE_CS_SKIP_LIST_ENTRY_HPP