NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
name-tree-entry.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014-2019, 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_NAME_TREE_ENTRY_HPP
27
#define NFD_DAEMON_TABLE_NAME_TREE_ENTRY_HPP
28
29
#include "
table/fib-entry.hpp
"
30
#include "
table/pit-entry.hpp
"
31
#include "
table/measurements-entry.hpp
"
32
#include "
table/strategy-choice-entry.hpp
"
33
34
namespace
nfd
{
35
namespace
name_tree {
36
37
class
Node;
38
41
class
Entry
: noncopyable
42
{
43
public
:
44
Entry
(
const
Name
& prefix,
Node
* node);
45
46
const
Name
&
47
getName
()
const
48
{
49
return
m_name;
50
}
51
55
Entry
*
56
getParent
()
const
57
{
58
return
m_parent;
59
}
60
67
void
68
setParent
(
Entry
& entry);
69
74
void
75
unsetParent
();
76
79
bool
80
hasChildren
()
const
81
{
82
return
!m_children.empty();
83
}
84
87
const
std::vector<Entry*>&
88
getChildren
()
const
89
{
90
return
m_children;
91
}
92
96
bool
97
isEmpty
()
const
98
{
99
return
!this->
hasChildren
() && !this->
hasTableEntries
();
100
}
101
102
public
:
// attached table entries
106
bool
107
hasTableEntries
()
const
;
108
109
fib::Entry
*
110
getFibEntry
()
const
111
{
112
return
m_fibEntry.get();
113
}
114
115
void
116
setFibEntry
(unique_ptr<fib::Entry> fibEntry);
117
118
bool
119
hasPitEntries
()
const
120
{
121
return
!this->
getPitEntries
().empty();
122
}
123
124
const
std::vector<shared_ptr<pit::Entry>>&
125
getPitEntries
()
const
126
{
127
return
m_pitEntries;
128
}
129
130
void
131
insertPitEntry
(shared_ptr<pit::Entry> pitEntry);
132
133
void
134
erasePitEntry
(
pit::Entry
* pitEntry);
135
136
measurements::Entry
*
137
getMeasurementsEntry
()
const
138
{
139
return
m_measurementsEntry.get();
140
}
141
142
void
143
setMeasurementsEntry
(unique_ptr<measurements::Entry> measurementsEntry);
144
145
strategy_choice::Entry
*
146
getStrategyChoiceEntry
()
const
147
{
148
return
m_strategyChoiceEntry.get();
149
}
150
151
void
152
setStrategyChoiceEntry
(unique_ptr<strategy_choice::Entry> strategyChoiceEntry);
153
159
template
<
typename
ENTRY>
160
static
Entry
*
161
get
(
const
ENTRY& tableEntry)
162
{
163
return
tableEntry.m_nameTreeEntry;
164
}
165
166
private
:
167
Name
m_name;
168
Node
* m_node;
169
Entry
* m_parent =
nullptr
;
170
std::vector<Entry*> m_children;
171
172
unique_ptr<fib::Entry> m_fibEntry;
173
std::vector<shared_ptr<pit::Entry>> m_pitEntries;
174
unique_ptr<measurements::Entry> m_measurementsEntry;
175
unique_ptr<strategy_choice::Entry> m_strategyChoiceEntry;
176
177
friend
Node
*
getNode
(
const
Entry
& entry);
178
};
179
183
template
<
typename
ENTRY>
184
class
GetTableEntry
185
{
186
public
:
189
using
Getter
= ENTRY* (
Entry
::*)()
const
;
190
194
explicit
195
GetTableEntry
(
Getter
getter =
nullptr
)
196
: m_getter(getter)
197
{
198
}
199
200
const
ENTRY&
201
operator()
(
const
Entry
& nte)
const
202
{
203
return
*(nte.*m_getter)();
204
}
205
206
private
:
207
Getter
m_getter;
208
};
209
210
}
// namespace name_tree
211
}
// namespace nfd
212
213
#endif // NFD_DAEMON_TABLE_NAME_TREE_ENTRY_HPP
nfd::name_tree::Entry::hasChildren
bool hasChildren() const
Check whether this entry has any children.
Definition:
name-tree-entry.hpp:80
nfd::name_tree::Entry
An entry in the name tree.
Definition:
name-tree-entry.hpp:42
nfd::name_tree::Entry::getChildren
const std::vector< Entry * > & getChildren() const
Definition:
name-tree-entry.hpp:88
nfd::name_tree::Entry::setParent
void setParent(Entry &entry)
Set parent of this entry.
Definition:
name-tree-entry.cpp:41
measurements-entry.hpp
nfd::name_tree::GetTableEntry::GetTableEntry
GetTableEntry(Getter getter=nullptr)
Definition:
name-tree-entry.hpp:195
fib-entry.hpp
nfd::name_tree::Entry::getPitEntries
const std::vector< shared_ptr< pit::Entry > > & getPitEntries() const
Definition:
name-tree-entry.hpp:125
nfd::name_tree::Entry::erasePitEntry
void erasePitEntry(pit::Entry *pitEntry)
Definition:
name-tree-entry.cpp:98
nfd::name_tree::Entry::isEmpty
bool isEmpty() const
Definition:
name-tree-entry.hpp:97
nfd::name_tree::Entry::unsetParent
void unsetParent()
Unset parent of this entry.
Definition:
name-tree-entry.cpp:52
ndn::Name
Represents an absolute name.
Definition:
name.hpp:44
nfd::name_tree::Entry::getName
const Name & getName() const
Definition:
name-tree-entry.hpp:47
nfd
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-common.hpp:40
nfd::name_tree::Entry::setMeasurementsEntry
void setMeasurementsEntry(unique_ptr< measurements::Entry > measurementsEntry)
Definition:
name-tree-entry.cpp:113
pit-entry.hpp
nfd::name_tree::Node
a hashtable node
Definition:
name-tree-hashtable.hpp:62
nfd::name_tree::GetTableEntry::operator()
const ENTRY & operator()(const Entry &nte) const
Definition:
name-tree-entry.hpp:201
nfd::name_tree::Entry::getStrategyChoiceEntry
strategy_choice::Entry * getStrategyChoiceEntry() const
Definition:
name-tree-entry.hpp:146
nfd::pit::Entry
An Interest table entry.
Definition:
pit-entry.hpp:59
nfd::name_tree::Entry::insertPitEntry
void insertPitEntry(shared_ptr< pit::Entry > pitEntry)
Definition:
name-tree-entry.cpp:88
nfd::fib::Entry
represents a FIB entry
Definition:
fib-entry.hpp:54
nfd::name_tree::Entry::getMeasurementsEntry
measurements::Entry * getMeasurementsEntry() const
Definition:
name-tree-entry.hpp:137
nfd::name_tree::Entry::setFibEntry
void setFibEntry(unique_ptr< fib::Entry > fibEntry)
Definition:
name-tree-entry.cpp:73
nfd::strategy_choice::Entry
Represents a Strategy Choice entry.
Definition:
strategy-choice-entry.hpp:46
nfd::name_tree::Entry::get
static Entry * get(const ENTRY &tableEntry)
Definition:
name-tree-entry.hpp:161
nfd::name_tree::Entry::Entry
Entry(const Name &prefix, Node *node)
Definition:
name-tree-entry.cpp:32
nfd::name_tree::Entry::getNode
friend Node * getNode(const Entry &entry)
Definition:
name-tree-hashtable.cpp:107
nfd::name_tree::GetTableEntry::Getter
ENTRY *(Entry::*)() const Getter
A function pointer to the getter on Entry class that returns ENTRY.
Definition:
name-tree-entry.hpp:189
nfd::measurements::Entry
Represents a Measurements entry.
Definition:
measurements-entry.hpp:42
strategy-choice-entry.hpp
nfd::name_tree::Entry::hasPitEntries
bool hasPitEntries() const
Definition:
name-tree-entry.hpp:119
nfd::name_tree::Entry::hasTableEntries
bool hasTableEntries() const
Definition:
name-tree-entry.cpp:64
nfd::name_tree::Entry::getFibEntry
fib::Entry * getFibEntry() const
Definition:
name-tree-entry.hpp:110
nfd::name_tree::Entry::setStrategyChoiceEntry
void setStrategyChoiceEntry(unique_ptr< strategy_choice::Entry > strategyChoiceEntry)
Definition:
name-tree-entry.cpp:128
nfd::name_tree::Entry::getParent
Entry * getParent() const
Definition:
name-tree-entry.hpp:56
nfd::name_tree::GetTableEntry
a functor to get a table entry from a name tree entry
Definition:
name-tree-entry.hpp:185
ndnSIM
NFD
daemon
table
name-tree-entry.hpp
Generated on Mon Jun 1 2020 22:32:16 for ndnSIM by
1.8.18