blob: 0732047341ad75c7710c94bcfb3f2eea53c5b8ca [file] [log] [blame]
Junxiao Shifc206962015-01-16 11:12:22 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014-2015, 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
26#ifndef NFD_DAEMON_TABLE_CS_ENTRY_IMPL_HPP
27#define NFD_DAEMON_TABLE_CS_ENTRY_IMPL_HPP
28
29#include "cs-internal.hpp"
30#include "cs-entry.hpp"
31#include "core/scheduler.hpp"
32
33namespace nfd {
34namespace cs {
35
36/** \brief an Entry in ContentStore implementation
37 *
38 * An Entry is either a stored Entry which contains a Data packet and related attributes,
39 * or a query Entry which contains a Name that is LessComparable to other stored/query Entry
40 * and is used to lookup a container of entries.
41 *
42 * \note This type is internal to this specific ContentStore implementation.
43 */
44class EntryImpl : public Entry
45{
46public:
47 /** \brief construct Entry for query
48 * \note Name is implicitly convertible to Entry, so that Name can be passed to
49 * lookup functions on a container of Entry
50 */
51 EntryImpl(const Name& name);
52
53 /** \brief construct Entry for storage
54 */
55 EntryImpl(shared_ptr<const Data> data, bool isUnsolicited);
56
57 /** \return true if entry can become stale, false if entry is never stale
58 */
59 bool
60 canStale() const;
61
62 void
63 unsetUnsolicited();
64
65 bool
66 operator<(const EntryImpl& other) const;
67
68private:
69 bool
70 isQuery() const;
71
72public:
73 QueueType queueType;
74 QueueIt queueIt;
75 scheduler::EventId moveStaleEvent;
76
77private:
78 Name m_queryName;
79};
80
81} // namespace cs
82} // namespace nfd
83
84#endif // NFD_DAEMON_TABLE_CS_ENTRY_IMPL_HPP