Junxiao Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Eric Newberry | f4056d0 | 2017-05-26 17:31:53 +0000 | [diff] [blame] | 3 | * Copyright (c) 2014-2017, Regents of the University of California, |
Junxiao Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 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 Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 29 | #include "cs-entry.hpp" |
Junxiao Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 30 | |
| 31 | namespace nfd { |
| 32 | namespace 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 | */ |
| 42 | class EntryImpl : public Entry |
| 43 | { |
| 44 | public: |
| 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 | |
Junxiao Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 55 | void |
| 56 | unsetUnsolicited(); |
| 57 | |
| 58 | bool |
| 59 | operator<(const EntryImpl& other) const; |
| 60 | |
| 61 | private: |
| 62 | bool |
| 63 | isQuery() const; |
| 64 | |
Junxiao Shi | fc20696 | 2015-01-16 11:12:22 -0700 | [diff] [blame] | 65 | private: |
| 66 | Name m_queryName; |
| 67 | }; |
| 68 | |
| 69 | } // namespace cs |
| 70 | } // namespace nfd |
| 71 | |
| 72 | #endif // NFD_DAEMON_TABLE_CS_ENTRY_IMPL_HPP |