blob: d061f883f61b865a7be70f060188e634ba4cf370 [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
Junxiao Shifc206962015-01-16 11:12:22 -070029#include "cs-entry.hpp"
Junxiao Shifc206962015-01-16 11:12:22 -070030
31namespace nfd {
32namespace cs {
33
34/** \brief an Entry in ContentStore implementation
35 *
36 * An Entry is either a stored Entry which contains a Data packet and related attributes,
37 * or a query Entry which contains a Name that is LessComparable to other stored/query Entry
38 * and is used to lookup a container of entries.
39 *
40 * \note This type is internal to this specific ContentStore implementation.
41 */
42class EntryImpl : public Entry
43{
44public:
45 /** \brief construct Entry for query
46 * \note Name is implicitly convertible to Entry, so that Name can be passed to
47 * lookup functions on a container of Entry
48 */
49 EntryImpl(const Name& name);
50
51 /** \brief construct Entry for storage
52 */
53 EntryImpl(shared_ptr<const Data> data, bool isUnsolicited);
54
55 /** \return true if entry can become stale, false if entry is never stale
56 */
57 bool
58 canStale() const;
59
60 void
61 unsetUnsolicited();
62
63 bool
64 operator<(const EntryImpl& other) const;
65
66private:
67 bool
68 isQuery() const;
69
Junxiao Shifc206962015-01-16 11:12:22 -070070private:
71 Name m_queryName;
72};
73
74} // namespace cs
75} // namespace nfd
76
77#endif // NFD_DAEMON_TABLE_CS_ENTRY_IMPL_HPP